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
399dce09
Commit
399dce09
authored
Mar 07, 2017
by
Tiago Cunha
Committed by
GitHub
Mar 07, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #232 from RocketChat/fix/firebase-crashes
Crashes
parents
68232055
a875cca8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
25 deletions
+25
-25
build.gradle
persistence-realm/build.gradle
+1
-1
RealmMessageRepository.java
...ersistence/realm/repositories/RealmMessageRepository.java
+5
-14
RealmRoomRepository.java
...t/persistence/realm/repositories/RealmRoomRepository.java
+1
-2
MessageInteractor.java
.../java/chat/rocket/core/interactors/MessageInteractor.java
+9
-4
SessionInteractor.java
.../java/chat/rocket/core/interactors/SessionInteractor.java
+9
-4
No files found.
persistence-realm/build.gradle
View file @
399dce09
...
...
@@ -9,7 +9,7 @@ buildscript {
}
dependencies
{
classpath
'com.android.tools.build:gradle:2.3.0'
classpath
'io.realm:realm-gradle-plugin:2.3.
1
'
classpath
'io.realm:realm-gradle-plugin:2.3.
2
'
classpath
'me.tatarka:gradle-retrolambda:3.5.0'
classpath
'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
classpath
'com.jakewharton.hugo:hugo-plugin:1.2.1'
...
...
persistence-realm/src/main/java/chat/rocket/persistence/realm/repositories/RealmMessageRepository.java
View file @
399dce09
...
...
@@ -41,17 +41,9 @@ public class RealmMessageRepository extends RealmRepository implements MessageRe
pair
->
close
(
pair
.
first
,
pair
.
second
)
)
.
unsubscribeOn
(
AndroidSchedulers
.
from
(
Looper
.
myLooper
()))
.
filter
(
it
->
it
!=
null
&&
it
.
isLoaded
()
&&
it
.
isValid
())
.
map
(
realmMessages
->
{
if
(
realmMessages
.
size
()
>
0
)
{
return
Optional
.
of
(
realmMessages
.
get
(
0
).
asMessage
());
}
return
Optional
.<
Message
>
absent
();
})
.
firstElement
()
.
toSingle
());
.
filter
(
it
->
it
.
isLoaded
()
&&
it
.
isValid
()
&&
it
.
size
()
>
0
)
.
map
(
realmMessages
->
Optional
.
of
(
realmMessages
.
get
(
0
).
asMessage
()))
.
first
(
Optional
.
absent
()));
}
@Override
...
...
@@ -91,7 +83,7 @@ public class RealmMessageRepository extends RealmRepository implements MessageRe
return
RxJavaInterop
.
toV2Flowable
(
realm
.
copyToRealmOrUpdate
(
realmMessage
)
.
asObservable
())
.
filter
(
it
->
it
!=
null
&&
it
.
isLoaded
()
&&
it
.
isValid
())
.
filter
(
it
->
it
.
isLoaded
()
&&
it
.
isValid
())
.
firstElement
()
.
doOnSuccess
(
it
->
realm
.
commitTransaction
())
.
doOnError
(
throwable
->
realm
.
cancelTransaction
())
...
...
@@ -143,8 +135,7 @@ public class RealmMessageRepository extends RealmRepository implements MessageRe
pair
->
close
(
pair
.
first
,
pair
.
second
)
)
.
unsubscribeOn
(
AndroidSchedulers
.
from
(
Looper
.
myLooper
()))
.
filter
(
it
->
it
!=
null
&&
it
.
isLoaded
()
&&
it
.
isValid
())
.
filter
(
it
->
it
.
isLoaded
()
&&
it
.
isValid
())
.
map
(
this
::
toList
));
}
...
...
persistence-realm/src/main/java/chat/rocket/persistence/realm/repositories/RealmRoomRepository.java
View file @
399dce09
...
...
@@ -131,8 +131,7 @@ public class RealmRoomRepository extends RealmRepository implements RoomReposito
return
RxJavaInterop
.
toV2Flowable
(
realm
.
copyToRealmOrUpdate
(
loadMessage
)
.
asObservable
())
.
filter
(
realmObject
->
realmObject
!=
null
&&
realmObject
.
isLoaded
()
&&
realmObject
.
isValid
())
.
filter
(
realmObject
->
realmObject
.
isLoaded
()
&&
realmObject
.
isValid
())
.
firstElement
()
.
doOnSuccess
(
it
->
realm
.
commitTransaction
())
.
doOnError
(
throwable
->
realm
.
cancelTransaction
())
...
...
rocket-chat-core/src/main/java/chat/rocket/core/interactors/MessageInteractor.java
View file @
399dce09
...
...
@@ -46,10 +46,15 @@ public class MessageInteractor {
return
!
roomHistoryState
.
isComplete
()
&&
(
syncState
==
SyncState
.
SYNCED
||
syncState
==
SyncState
.
FAILED
);
})
.
firstElement
()
.
toSingle
()
.
flatMap
(
roomHistoryState
->
roomRepository
.
setHistoryState
(
roomHistoryState
.
withSyncState
(
SyncState
.
NOT_SYNCED
)));
.
map
(
Optional:
:
of
)
.
first
(
Optional
.
absent
())
.
flatMap
(
historyStateOptional
->
{
if
(!
historyStateOptional
.
isPresent
())
{
return
Single
.
just
(
false
);
}
return
roomRepository
.
setHistoryState
(
historyStateOptional
.
get
().
withSyncState
(
SyncState
.
NOT_SYNCED
));
});
}
public
Single
<
Boolean
>
send
(
Room
destination
,
User
sender
,
String
messageText
)
{
...
...
rocket-chat-core/src/main/java/chat/rocket/core/interactors/SessionInteractor.java
View file @
399dce09
...
...
@@ -32,10 +32,15 @@ public class SessionInteractor {
.
map
(
Optional:
:
get
)
.
filter
(
session
->
session
.
getToken
()
!=
null
&&
(!
session
.
isTokenVerified
()
||
session
.
getError
()
!=
null
))
.
map
(
session
->
session
.
withTokenVerified
(
false
).
withError
(
null
))
.
firstElement
()
.
toSingle
()
.
flatMap
(
sessionRepository:
:
save
);
.
map
(
session
->
Optional
.
of
(
session
.
withTokenVerified
(
false
).
withError
(
null
)))
.
first
(
Optional
.
absent
())
.
flatMap
(
sessionOptional
->
{
if
(!
sessionOptional
.
isPresent
())
{
return
Single
.
just
(
false
);
}
return
sessionRepository
.
save
(
sessionOptional
.
get
());
});
}
private
Session
.
State
getStateFrom
(
Session
session
)
{
...
...
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