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
a09e2c3a
Commit
a09e2c3a
authored
May 29, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Call realtime createDirectMessage method on opening a new DM
parent
524f47e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
ChatRoomsPresenter.kt
...cket/android/chatrooms/presentation/ChatRoomsPresenter.kt
+13
-1
No files found.
app/src/main/java/chat/rocket/android/chatrooms/presentation/ChatRoomsPresenter.kt
View file @
a09e2c3a
...
@@ -34,6 +34,7 @@ import chat.rocket.common.model.SimpleUser
...
@@ -34,6 +34,7 @@ import chat.rocket.common.model.SimpleUser
import
chat.rocket.common.model.User
import
chat.rocket.common.model.User
import
chat.rocket.common.util.ifNull
import
chat.rocket.common.util.ifNull
import
chat.rocket.core.internal.model.Subscription
import
chat.rocket.core.internal.model.Subscription
import
chat.rocket.core.internal.realtime.createDirectMessage
import
chat.rocket.core.internal.realtime.socket.model.State
import
chat.rocket.core.internal.realtime.socket.model.State
import
chat.rocket.core.internal.realtime.socket.model.StreamMessage
import
chat.rocket.core.internal.realtime.socket.model.StreamMessage
import
chat.rocket.core.internal.realtime.socket.model.Type
import
chat.rocket.core.internal.realtime.socket.model.Type
...
@@ -124,8 +125,19 @@ class ChatRoomsPresenter @Inject constructor(
...
@@ -124,8 +125,19 @@ class ChatRoomsPresenter @Inject constructor(
if
(
myself
?.
username
==
null
)
{
if
(
myself
?.
username
==
null
)
{
view
.
showMessage
(
R
.
string
.
msg_generic_error
)
view
.
showMessage
(
R
.
string
.
msg_generic_error
)
}
else
{
}
else
{
val
id
=
if
(
isDirectMessage
&&
!
chatRoom
.
open
)
{
retryIO
(
"createDirectMessage(${chatRoom.name})"
)
{
client
.
createDirectMessage
(
chatRoom
.
name
)
}
val
fromTo
=
mutableListOf
(
myself
.
id
,
chatRoom
.
id
).
apply
{
sort
()
}
fromTo
.
joinToString
(
""
)
}
else
{
chatRoom
.
id
}
val
isChatRoomOwner
=
chatRoom
.
user
?.
username
==
myself
.
username
||
isDirectMessage
val
isChatRoomOwner
=
chatRoom
.
user
?.
username
==
myself
.
username
||
isDirectMessage
navigator
.
toChatRoom
(
chatRoom
.
id
,
roomName
,
navigator
.
toChatRoom
(
id
,
roomName
,
chatRoom
.
type
.
toString
(),
chatRoom
.
readonly
?:
false
,
chatRoom
.
type
.
toString
(),
chatRoom
.
readonly
?:
false
,
chatRoom
.
lastSeen
?:
-
1
,
chatRoom
.
lastSeen
?:
-
1
,
chatRoom
.
open
,
isChatRoomOwner
)
chatRoom
.
open
,
isChatRoomOwner
)
...
...
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