Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
0d0e4556
Commit
0d0e4556
authored
Nov 22, 2017
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some refactoring
parent
692cd67f
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
378 additions
and
396 deletions
+378
-396
RealmBasedConnectivityManager.java
...rocket/android/service/RealmBasedConnectivityManager.java
+4
-0
RocketChatWebSocketThread.java
...hat/rocket/android/service/RocketChatWebSocketThread.java
+370
-388
RealmSessionRepository.java
...ersistence/realm/repositories/RealmSessionRepository.java
+4
-8
No files found.
app/src/main/java/chat/rocket/android/service/RealmBasedConnectivityManager.java
View file @
0d0e4556
package
chat
.
rocket
.
android
.
service
;
import
android.annotation.SuppressLint
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
android.content.ServiceConnection
;
...
...
@@ -68,6 +69,7 @@ import io.reactivex.subjects.PublishSubject;
}
}
@SuppressLint
(
"RxLeakedSubscription"
)
@DebugLog
@Override
public
void
ensureConnections
()
{
...
...
@@ -84,6 +86,7 @@ import io.reactivex.subjects.PublishSubject;
});
}
@SuppressLint
(
"RxLeakedSubscription"
)
@Override
public
void
addOrUpdateServer
(
String
hostname
,
@Nullable
String
name
,
boolean
insecure
)
{
RealmBasedServerInfo
.
addOrUpdate
(
hostname
,
name
,
insecure
);
...
...
@@ -95,6 +98,7 @@ import io.reactivex.subjects.PublishSubject;
},
RCLog:
:
e
);
}
@SuppressLint
(
"RxLeakedSubscription"
)
@Override
public
void
removeServer
(
String
hostname
)
{
RealmBasedServerInfo
.
remove
(
hostname
);
...
...
app/src/main/java/chat/rocket/android/service/RocketChatWebSocketThread.java
View file @
0d0e4556
This diff is collapsed.
Click to expand it.
persistence-realm/src/main/java/chat/rocket/persistence/realm/repositories/RealmSessionRepository.java
View file @
0d0e4556
...
...
@@ -7,6 +7,7 @@ import com.hadisatrio.optional.Optional;
import
chat.rocket.core.models.Session
;
import
chat.rocket.core.repositories.SessionRepository
;
import
chat.rocket.persistence.realm.RealmHelper
;
import
chat.rocket.persistence.realm.RealmStore
;
import
chat.rocket.persistence.realm.models.internal.RealmSession
;
import
hu.akarnokd.rxjava.interop.RxJavaInterop
;
...
...
@@ -35,7 +36,7 @@ public class RealmSessionRepository extends RealmRepository implements SessionRe
return
RxJavaInterop
.
toV2Flowable
(
pair
.
first
.
where
(
RealmSession
.
class
)
.
equalTo
(
RealmSession
.
ID
,
id
)
.
findAll
()
.<
RealmSession
>
asObservable
());
.<
RealmSession
>
asObservable
()
.
first
()
);
},
pair
->
close
(
pair
.
first
,
pair
.
second
)
)
...
...
@@ -45,7 +46,7 @@ public class RealmSessionRepository extends RealmRepository implements SessionRe
if
(
realmSessions
.
size
()
==
0
)
{
return
Optional
.
absent
();
}
return
Optional
.
of
(
realmSessions
.
get
(
0
).
asSession
());
return
Optional
.
of
(
realmSessions
.
get
(
0
).
asSession
());
}));
}
...
...
@@ -74,14 +75,9 @@ public class RealmSessionRepository extends RealmRepository implements SessionRe
realmSession
.
setTokenVerified
(
session
.
isTokenVerified
());
realmSession
.
setError
(
session
.
getError
());
realm
.
beginTransaction
();
return
RxJavaInterop
.
toV2Flowable
(
realm
.
copyToRealmOrUpdate
(
realmSession
)
.
asObservable
())
return
RealmHelper
.
copyToRealmOrUpdate
(
realm
,
realmSession
)
.
filter
(
it
->
it
!=
null
&&
it
.
isLoaded
()
&&
it
.
isValid
())
.
firstElement
()
.
doOnSuccess
(
it
->
realm
.
commitTransaction
())
.
doOnError
(
throwable
->
realm
.
cancelTransaction
())
.
doOnEvent
((
realmObject
,
throwable
)
->
close
(
realm
,
looper
))
.
toSingle
()
.
map
(
realmObject
->
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment