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
042626cd
Commit
042626cd
authored
Aug 22, 2017
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update RoomPresenter.java
Add method getUserByUsername(...).
parent
f8975ff0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
RoomPresenter.java
.../chat/rocket/android/fragment/chatroom/RoomPresenter.java
+21
-2
No files found.
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomPresenter.java
View file @
042626cd
...
@@ -4,7 +4,9 @@ import android.support.annotation.NonNull;
...
@@ -4,7 +4,9 @@ import android.support.annotation.NonNull;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.support.v4.util.Pair
;
import
android.support.v4.util.Pair
;
import
chat.rocket.persistence.realm.models.ddp.RealmUser
;
import
com.hadisatrio.optional.Optional
;
import
com.hadisatrio.optional.Optional
;
import
io.reactivex.Flowable
;
import
io.reactivex.Single
;
import
io.reactivex.Single
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.disposables.Disposable
;
import
io.reactivex.disposables.Disposable
;
...
@@ -217,11 +219,28 @@ public class RoomPresenter extends BasePresenter<RoomContract.View>
...
@@ -217,11 +219,28 @@ public class RoomPresenter extends BasePresenter<RoomContract.View>
.
map
(
Optional:
:
get
)
.
map
(
Optional:
:
get
)
.
subscribeOn
(
AndroidSchedulers
.
from
(
BackgroundLooper
.
get
()))
.
subscribeOn
(
AndroidSchedulers
.
from
(
BackgroundLooper
.
get
()))
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
.
subscribe
(
room
->
{
room
->
view
.
render
(
room
),
if
(
room
.
isDirectMessage
())
{
getUserByUsername
(
room
,
room
.
getName
());
}
else
{
view
.
render
(
room
,
null
);
}
},
Logger:
:
report
Logger:
:
report
);
);
addSubscription
(
subscription
);
}
private
void
getUserByUsername
(
Room
room
,
String
username
)
{
final
Disposable
subscription
=
userRepository
.
getByUsername
(
username
)
.
distinctUntilChanged
()
.
filter
(
Optional:
:
isPresent
)
.
map
(
Optional:
:
get
)
.
subscribeOn
(
AndroidSchedulers
.
from
(
BackgroundLooper
.
get
()))
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
user
->
view
.
render
(
room
,
user
),
Logger:
:
report
);
addSubscription
(
subscription
);
addSubscription
(
subscription
);
}
}
...
...
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