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
174d5d12
Commit
174d5d12
authored
Feb 21, 2017
by
Tiago Cunha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix resend crash
parent
93333f70
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
8 deletions
+16
-8
RoomPresenter.java
.../chat/rocket/android/fragment/chatroom/RoomPresenter.java
+11
-6
MessageInteractor.java
.../java/chat/rocket/core/interactors/MessageInteractor.java
+3
-2
Message.java
...t-core/src/main/java/chat/rocket/core/models/Message.java
+2
-0
No files found.
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomPresenter.java
View file @
174d5d12
...
...
@@ -114,7 +114,8 @@ public class RoomPresenter extends BasePresenter<RoomContract.View>
@Override
public
void
resendMessage
(
Message
message
)
{
final
Disposable
subscription
=
messageInteractor
.
resend
(
message
)
final
Disposable
subscription
=
getCurrentUser
()
.
flatMap
(
user
->
messageInteractor
.
resend
(
message
,
user
))
.
subscribeOn
(
AndroidSchedulers
.
from
(
BackgroundLooper
.
get
()))
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
();
...
...
@@ -204,11 +205,7 @@ public class RoomPresenter extends BasePresenter<RoomContract.View>
private
Single
<
Pair
<
Room
,
User
>>
getRoomUserPair
()
{
return
Single
.
zip
(
getSingleRoom
(),
userRepository
.
getCurrent
()
.
filter
(
Optional:
:
isPresent
)
.
map
(
Optional:
:
get
)
.
firstElement
()
.
toSingle
(),
getCurrentUser
(),
Pair:
:
new
);
}
...
...
@@ -218,4 +215,12 @@ public class RoomPresenter extends BasePresenter<RoomContract.View>
.
firstElement
()
.
toSingle
();
}
private
Single
<
User
>
getCurrentUser
()
{
return
userRepository
.
getCurrent
()
.
filter
(
Optional:
:
isPresent
)
.
map
(
Optional:
:
get
)
.
firstElement
()
.
toSingle
();
}
}
rocket-chat-core/src/main/java/chat/rocket/core/interactors/MessageInteractor.java
View file @
174d5d12
...
...
@@ -63,9 +63,10 @@ public class MessageInteractor {
return
messageRepository
.
save
(
message
);
}
public
Single
<
Boolean
>
resend
(
Message
message
)
{
public
Single
<
Boolean
>
resend
(
Message
message
,
User
sender
)
{
return
messageRepository
.
save
(
message
.
withSyncState
(
SyncState
.
NOT_SYNCED
));
message
.
withSyncState
(
SyncState
.
NOT_SYNCED
)
.
withUser
(
sender
));
}
public
Single
<
Boolean
>
delete
(
Message
message
)
{
...
...
rocket-chat-core/src/main/java/chat/rocket/core/models/Message.java
View file @
174d5d12
...
...
@@ -40,6 +40,8 @@ public abstract class Message {
public
abstract
Message
withSyncState
(
int
syncState
);
public
abstract
Message
withUser
(
User
user
);
public
static
Builder
builder
()
{
return
new
AutoValue_Message
.
Builder
();
}
...
...
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