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
49126a4a
Commit
49126a4a
authored
Dec 17, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat.Android into new/draft-message
parents
531c5a0f
a2535dd8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
91 deletions
+108
-91
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+63
-58
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+0
-2
UiModelMapper.kt
...ava/chat/rocket/android/chatroom/uimodel/UiModelMapper.kt
+1
-1
UserDetailsPresenter.kt
.../android/userdetails/presentation/UserDetailsPresenter.kt
+44
-30
No files found.
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
49126a4a
...
...
@@ -134,6 +134,8 @@ class ChatRoomPresenter @Inject constructor(
launch
(
CommonPool
+
strategy
.
jobs
)
{
try
{
unfinishedMessageKey
=
"${currentServer}_${LocalRepository.UNFINISHED_MSG_KEY}$roomId"
chatRoomId
=
roomId
chatRoomType
=
roomType
chatRoles
=
if
(
roomTypeOf
(
roomType
)
!
is
RoomType
.
DirectMessage
)
{
client
.
chatRoomRoles
(
roomType
=
roomTypeOf
(
roomType
),
roomName
=
roomName
)
}
else
{
...
...
@@ -176,18 +178,21 @@ class ChatRoomPresenter @Inject constructor(
}
private
suspend
fun
subscribeRoomChanges
()
{
chatRoomId
?.
let
{
manager
.
addRoomChannel
(
it
,
roomChangesChannel
)
for
(
room
in
roomChangesChannel
)
{
dbManager
.
getRoom
(
room
.
id
)
?.
let
{
view
.
onRoomUpdated
(
roomMapper
.
map
(
chatRoom
=
it
,
showLastMessage
=
true
))
withContext
(
CommonPool
+
strategy
.
jobs
)
{
chatRoomId
?.
let
{
manager
.
addRoomChannel
(
it
,
roomChangesChannel
)
for
(
room
in
roomChangesChannel
)
{
dbManager
.
getRoom
(
room
.
id
)
?.
let
{
view
.
onRoomUpdated
(
roomMapper
.
map
(
chatRoom
=
it
,
showLastMessage
=
true
))
}
}
}
}
}
private
fun
unsubscribeRoomChanges
()
{
chatRoomId
?.
let
{
manager
.
removeRoomChannel
(
it
)
}
chatRoomId
?.
let
{
manager
.
removeRoomChannel
(
it
)
}
}
private
fun
isOwnerOrMod
():
Boolean
{
...
...
@@ -944,32 +949,32 @@ class ChatRoomPresenter @Inject constructor(
dbManager
.
chatRoomDao
().
getSync
(
roomId
)
?.
let
{
with
(
it
.
chatRoom
)
{
ChatRoom
(
id
=
id
,
subscriptionId
=
subscriptionId
,
type
=
roomTypeOf
(
type
),
unread
=
unread
,
broadcast
=
broadcast
?:
false
,
alert
=
alert
,
fullName
=
fullname
,
name
=
name
,
favorite
=
favorite
?:
false
,
default
=
isDefault
?:
false
,
readonly
=
readonly
,
open
=
open
,
lastMessage
=
null
,
archived
=
false
,
status
=
null
,
user
=
null
,
userMentions
=
userMentions
,
client
=
client
,
announcement
=
null
,
description
=
null
,
groupMentions
=
groupMentions
,
roles
=
null
,
topic
=
null
,
lastSeen
=
this
.
lastSeen
,
timestamp
=
timestamp
,
updatedAt
=
updatedAt
id
=
id
,
subscriptionId
=
subscriptionId
,
type
=
roomTypeOf
(
type
),
unread
=
unread
,
broadcast
=
broadcast
?:
false
,
alert
=
alert
,
fullName
=
fullname
,
name
=
name
,
favorite
=
favorite
?:
false
,
default
=
isDefault
?:
false
,
readonly
=
readonly
,
open
=
open
,
lastMessage
=
null
,
archived
=
false
,
status
=
null
,
user
=
null
,
userMentions
=
userMentions
,
client
=
client
,
announcement
=
null
,
description
=
null
,
groupMentions
=
groupMentions
,
roles
=
null
,
topic
=
null
,
lastSeen
=
this
.
lastSeen
,
timestamp
=
timestamp
,
updatedAt
=
updatedAt
)
}
}
...
...
@@ -987,32 +992,32 @@ class ChatRoomPresenter @Inject constructor(
}.
map
{
with
(
it
.
chatRoom
)
{
ChatRoom
(
id
=
id
,
subscriptionId
=
subscriptionId
,
type
=
roomTypeOf
(
type
),
unread
=
unread
,
broadcast
=
broadcast
?:
false
,
alert
=
alert
,
fullName
=
fullname
,
name
=
name
?:
""
,
favorite
=
favorite
?:
false
,
default
=
isDefault
?:
false
,
readonly
=
readonly
,
open
=
open
,
lastMessage
=
null
,
archived
=
false
,
status
=
null
,
user
=
null
,
userMentions
=
userMentions
,
client
=
client
,
announcement
=
null
,
description
=
null
,
groupMentions
=
groupMentions
,
roles
=
null
,
topic
=
null
,
lastSeen
=
this
.
lastSeen
,
timestamp
=
timestamp
,
updatedAt
=
updatedAt
id
=
id
,
subscriptionId
=
subscriptionId
,
type
=
roomTypeOf
(
type
),
unread
=
unread
,
broadcast
=
broadcast
?:
false
,
alert
=
alert
,
fullName
=
fullname
,
name
=
name
?:
""
,
favorite
=
favorite
?:
false
,
default
=
isDefault
?:
false
,
readonly
=
readonly
,
open
=
open
,
lastMessage
=
null
,
archived
=
false
,
status
=
null
,
user
=
null
,
userMentions
=
userMentions
,
client
=
client
,
announcement
=
null
,
description
=
null
,
groupMentions
=
groupMentions
,
roles
=
null
,
topic
=
null
,
lastSeen
=
this
.
lastSeen
,
timestamp
=
timestamp
,
updatedAt
=
updatedAt
)
}
}
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
49126a4a
...
...
@@ -19,7 +19,6 @@ import android.view.Menu
import
android.view.MenuItem
import
android.view.View
import
android.view.ViewGroup
import
android.widget.Button
import
android.widget.EditText
import
android.widget.FrameLayout
import
android.widget.ImageView
...
...
@@ -70,7 +69,6 @@ import chat.rocket.android.helper.MessageParser
import
chat.rocket.android.util.extension.asObservable
import
chat.rocket.android.util.extension.createImageFile
import
chat.rocket.android.util.extensions.circularRevealOrUnreveal
import
chat.rocket.android.util.extensions.content
import
chat.rocket.android.util.extensions.fadeIn
import
chat.rocket.android.util.extensions.fadeOut
import
chat.rocket.android.util.extensions.getBitmpap
...
...
app/src/main/java/chat/rocket/android/chatroom/uimodel/UiModelMapper.kt
View file @
49126a4a
...
...
@@ -168,7 +168,7 @@ class UiModelMapper @Inject constructor(
// TODO: move this to new interactor or FetchChatRoomsInteractor?
private
suspend
fun
getChatRoomAsync
(
roomId
:
String
):
ChatRoom
?
=
withContext
(
CommonPool
)
{
return
@withContext
dbManager
.
chatRoomDao
().
getSync
(
roomId
)
?.
let
{
return
@withContext
dbManager
.
getRoom
(
id
=
roomId
)
?.
let
{
with
(
it
.
chatRoom
)
{
ChatRoom
(
id
=
id
,
...
...
app/src/main/java/chat/rocket/android/userdetails/presentation/UserDetailsPresenter.kt
View file @
49126a4a
...
...
@@ -2,6 +2,7 @@ package chat.rocket.android.userdetails.presentation
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.db.DatabaseManager
import
chat.rocket.android.db.model.ChatRoomEntity
import
chat.rocket.android.server.domain.GetConnectingServerInteractor
import
chat.rocket.android.server.infraestructure.ConnectionManagerFactory
import
chat.rocket.android.util.extension.launchUI
...
...
@@ -97,43 +98,56 @@ class UserDetailsPresenter @Inject constructor(
}
if
(
userEntity
!=
null
)
{
view
.
toDirectMessage
(
chatRoom
=
ChatRoom
(
id
=
result
.
id
,
type
=
roomTypeOf
(
RoomType
.
DIRECT_MESSAGE
),
name
=
userEntity
.
username
?:
userEntity
.
name
.
orEmpty
(),
fullName
=
userEntity
.
name
,
favorite
=
false
,
open
=
false
,
alert
=
false
,
status
=
userStatusOf
(
userEntity
.
status
),
client
=
client
,
broadcast
=
false
,
archived
=
false
,
default
=
false
,
description
=
null
,
groupMentions
=
null
,
userMentions
=
null
,
lastMessage
=
null
,
lastSeen
=
null
,
topic
=
null
,
announcement
=
null
,
roles
=
null
,
unread
=
0
,
readonly
=
false
,
muted
=
null
,
subscriptionId
=
""
,
timestamp
=
null
,
updatedAt
=
result
.
updatedAt
,
user
=
null
)
val
chatRoom
=
ChatRoom
(
id
=
result
.
id
,
type
=
roomTypeOf
(
RoomType
.
DIRECT_MESSAGE
),
name
=
userEntity
.
username
?:
userEntity
.
name
.
orEmpty
(),
fullName
=
userEntity
.
name
,
favorite
=
false
,
open
=
false
,
alert
=
false
,
status
=
userStatusOf
(
userEntity
.
status
),
client
=
client
,
broadcast
=
false
,
archived
=
false
,
default
=
false
,
description
=
null
,
groupMentions
=
null
,
userMentions
=
null
,
lastMessage
=
null
,
lastSeen
=
null
,
topic
=
null
,
announcement
=
null
,
roles
=
null
,
unread
=
0
,
readonly
=
false
,
muted
=
null
,
subscriptionId
=
""
,
timestamp
=
null
,
updatedAt
=
result
.
updatedAt
,
user
=
null
)
withContext
(
CommonPool
+
strategy
.
jobs
)
{
dbManager
.
chatRoomDao
().
insertOrReplace
(
chatRoom
=
ChatRoomEntity
(
id
=
chatRoom
.
id
,
name
=
chatRoom
.
name
,
description
=
chatRoom
.
description
,
type
=
chatRoom
.
type
.
toString
(),
fullname
=
chatRoom
.
fullName
,
subscriptionId
=
chatRoom
.
subscriptionId
,
updatedAt
=
chatRoom
.
updatedAt
))
}
view
.
toDirectMessage
(
chatRoom
=
chatRoom
)
}
}
catch
(
ex
:
Exception
)
{
Timber
.
e
(
ex
)
view
.
onOpenDirectMessageError
()
}
}
private
suspend
fun
chatRoomByName
(
name
:
String
?
=
null
):
List
<
ChatRoom
>
=
withContext
(
CommonPool
)
{
return
@withContext
dbManager
.
chatRoomDao
().
getAllSync
().
filter
{
if
(
name
==
null
)
{
...
...
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