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
7694ff8a
Commit
7694ff8a
authored
Feb 22, 2017
by
Tiago Cunha
Committed by
GitHub
Feb 22, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #216 from RocketChat/fix/resend-crashes
Fix resend crash
parents
994b32c3
c8630df4
Changes
3
Hide 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 @
7694ff8a
...
@@ -114,7 +114,8 @@ public class RoomPresenter extends BasePresenter<RoomContract.View>
...
@@ -114,7 +114,8 @@ public class RoomPresenter extends BasePresenter<RoomContract.View>
@Override
@Override
public
void
resendMessage
(
Message
message
)
{
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
()))
.
subscribeOn
(
AndroidSchedulers
.
from
(
BackgroundLooper
.
get
()))
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
();
.
subscribe
();
...
@@ -204,11 +205,7 @@ public class RoomPresenter extends BasePresenter<RoomContract.View>
...
@@ -204,11 +205,7 @@ public class RoomPresenter extends BasePresenter<RoomContract.View>
private
Single
<
Pair
<
Room
,
User
>>
getRoomUserPair
()
{
private
Single
<
Pair
<
Room
,
User
>>
getRoomUserPair
()
{
return
Single
.
zip
(
return
Single
.
zip
(
getSingleRoom
(),
getSingleRoom
(),
userRepository
.
getCurrent
()
getCurrentUser
(),
.
filter
(
Optional:
:
isPresent
)
.
map
(
Optional:
:
get
)
.
firstElement
()
.
toSingle
(),
Pair:
:
new
Pair:
:
new
);
);
}
}
...
@@ -218,4 +215,12 @@ public class RoomPresenter extends BasePresenter<RoomContract.View>
...
@@ -218,4 +215,12 @@ public class RoomPresenter extends BasePresenter<RoomContract.View>
.
firstElement
()
.
firstElement
()
.
toSingle
();
.
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 @
7694ff8a
...
@@ -63,9 +63,10 @@ public class MessageInteractor {
...
@@ -63,9 +63,10 @@ public class MessageInteractor {
return
messageRepository
.
save
(
message
);
return
messageRepository
.
save
(
message
);
}
}
public
Single
<
Boolean
>
resend
(
Message
message
)
{
public
Single
<
Boolean
>
resend
(
Message
message
,
User
sender
)
{
return
messageRepository
.
save
(
return
messageRepository
.
save
(
message
.
withSyncState
(
SyncState
.
NOT_SYNCED
));
message
.
withSyncState
(
SyncState
.
NOT_SYNCED
)
.
withUser
(
sender
));
}
}
public
Single
<
Boolean
>
delete
(
Message
message
)
{
public
Single
<
Boolean
>
delete
(
Message
message
)
{
...
...
rocket-chat-core/src/main/java/chat/rocket/core/models/Message.java
View file @
7694ff8a
...
@@ -40,6 +40,8 @@ public abstract class Message {
...
@@ -40,6 +40,8 @@ public abstract class Message {
public
abstract
Message
withSyncState
(
int
syncState
);
public
abstract
Message
withSyncState
(
int
syncState
);
public
abstract
Message
withUser
(
User
user
);
public
static
Builder
builder
()
{
public
static
Builder
builder
()
{
return
new
AutoValue_Message
.
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