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
0b5dce3a
Unverified
Commit
0b5dce3a
authored
Dec 17, 2018
by
Leonardo Aramaki
Committed by
GitHub
Dec 17, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into fix/increase-db-retry
parents
0e4c9cee
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 @
0b5dce3a
...
@@ -132,6 +132,8 @@ class ChatRoomPresenter @Inject constructor(
...
@@ -132,6 +132,8 @@ class ChatRoomPresenter @Inject constructor(
)
{
)
{
launch
(
CommonPool
+
strategy
.
jobs
)
{
launch
(
CommonPool
+
strategy
.
jobs
)
{
try
{
try
{
chatRoomId
=
roomId
chatRoomType
=
roomType
chatRoles
=
if
(
roomTypeOf
(
roomType
)
!
is
RoomType
.
DirectMessage
)
{
chatRoles
=
if
(
roomTypeOf
(
roomType
)
!
is
RoomType
.
DirectMessage
)
{
client
.
chatRoomRoles
(
roomType
=
roomTypeOf
(
roomType
),
roomName
=
roomName
)
client
.
chatRoomRoles
(
roomType
=
roomTypeOf
(
roomType
),
roomName
=
roomName
)
}
else
emptyList
()
}
else
emptyList
()
...
@@ -172,18 +174,21 @@ class ChatRoomPresenter @Inject constructor(
...
@@ -172,18 +174,21 @@ class ChatRoomPresenter @Inject constructor(
}
}
private
suspend
fun
subscribeRoomChanges
()
{
private
suspend
fun
subscribeRoomChanges
()
{
chatRoomId
?.
let
{
withContext
(
CommonPool
+
strategy
.
jobs
)
{
manager
.
addRoomChannel
(
it
,
roomChangesChannel
)
chatRoomId
?.
let
{
for
(
room
in
roomChangesChannel
)
{
manager
.
addRoomChannel
(
it
,
roomChangesChannel
)
dbManager
.
getRoom
(
room
.
id
)
?.
let
{
for
(
room
in
roomChangesChannel
)
{
view
.
onRoomUpdated
(
roomMapper
.
map
(
chatRoom
=
it
,
showLastMessage
=
true
))
dbManager
.
getRoom
(
room
.
id
)
?.
let
{
view
.
onRoomUpdated
(
roomMapper
.
map
(
chatRoom
=
it
,
showLastMessage
=
true
))
}
}
}
}
}
}
}
}
}
private
fun
unsubscribeRoomChanges
()
{
private
fun
unsubscribeRoomChanges
()
{
chatRoomId
?.
let
{
manager
.
removeRoomChannel
(
it
)
}
chatRoomId
?.
let
{
manager
.
removeRoomChannel
(
it
)
}
}
}
private
fun
isOwnerOrMod
():
Boolean
{
private
fun
isOwnerOrMod
():
Boolean
{
...
@@ -939,32 +944,32 @@ class ChatRoomPresenter @Inject constructor(
...
@@ -939,32 +944,32 @@ class ChatRoomPresenter @Inject constructor(
dbManager
.
chatRoomDao
().
getSync
(
roomId
)
?.
let
{
dbManager
.
chatRoomDao
().
getSync
(
roomId
)
?.
let
{
with
(
it
.
chatRoom
)
{
with
(
it
.
chatRoom
)
{
ChatRoom
(
ChatRoom
(
id
=
id
,
id
=
id
,
subscriptionId
=
subscriptionId
,
subscriptionId
=
subscriptionId
,
type
=
roomTypeOf
(
type
),
type
=
roomTypeOf
(
type
),
unread
=
unread
,
unread
=
unread
,
broadcast
=
broadcast
?:
false
,
broadcast
=
broadcast
?:
false
,
alert
=
alert
,
alert
=
alert
,
fullName
=
fullname
,
fullName
=
fullname
,
name
=
name
,
name
=
name
,
favorite
=
favorite
?:
false
,
favorite
=
favorite
?:
false
,
default
=
isDefault
?:
false
,
default
=
isDefault
?:
false
,
readonly
=
readonly
,
readonly
=
readonly
,
open
=
open
,
open
=
open
,
lastMessage
=
null
,
lastMessage
=
null
,
archived
=
false
,
archived
=
false
,
status
=
null
,
status
=
null
,
user
=
null
,
user
=
null
,
userMentions
=
userMentions
,
userMentions
=
userMentions
,
client
=
client
,
client
=
client
,
announcement
=
null
,
announcement
=
null
,
description
=
null
,
description
=
null
,
groupMentions
=
groupMentions
,
groupMentions
=
groupMentions
,
roles
=
null
,
roles
=
null
,
topic
=
null
,
topic
=
null
,
lastSeen
=
this
.
lastSeen
,
lastSeen
=
this
.
lastSeen
,
timestamp
=
timestamp
,
timestamp
=
timestamp
,
updatedAt
=
updatedAt
updatedAt
=
updatedAt
)
)
}
}
}
}
...
@@ -982,32 +987,32 @@ class ChatRoomPresenter @Inject constructor(
...
@@ -982,32 +987,32 @@ class ChatRoomPresenter @Inject constructor(
}.
map
{
}.
map
{
with
(
it
.
chatRoom
)
{
with
(
it
.
chatRoom
)
{
ChatRoom
(
ChatRoom
(
id
=
id
,
id
=
id
,
subscriptionId
=
subscriptionId
,
subscriptionId
=
subscriptionId
,
type
=
roomTypeOf
(
type
),
type
=
roomTypeOf
(
type
),
unread
=
unread
,
unread
=
unread
,
broadcast
=
broadcast
?:
false
,
broadcast
=
broadcast
?:
false
,
alert
=
alert
,
alert
=
alert
,
fullName
=
fullname
,
fullName
=
fullname
,
name
=
name
?:
""
,
name
=
name
?:
""
,
favorite
=
favorite
?:
false
,
favorite
=
favorite
?:
false
,
default
=
isDefault
?:
false
,
default
=
isDefault
?:
false
,
readonly
=
readonly
,
readonly
=
readonly
,
open
=
open
,
open
=
open
,
lastMessage
=
null
,
lastMessage
=
null
,
archived
=
false
,
archived
=
false
,
status
=
null
,
status
=
null
,
user
=
null
,
user
=
null
,
userMentions
=
userMentions
,
userMentions
=
userMentions
,
client
=
client
,
client
=
client
,
announcement
=
null
,
announcement
=
null
,
description
=
null
,
description
=
null
,
groupMentions
=
groupMentions
,
groupMentions
=
groupMentions
,
roles
=
null
,
roles
=
null
,
topic
=
null
,
topic
=
null
,
lastSeen
=
this
.
lastSeen
,
lastSeen
=
this
.
lastSeen
,
timestamp
=
timestamp
,
timestamp
=
timestamp
,
updatedAt
=
updatedAt
updatedAt
=
updatedAt
)
)
}
}
}
}
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
0b5dce3a
...
@@ -19,7 +19,6 @@ import android.view.Menu
...
@@ -19,7 +19,6 @@ import android.view.Menu
import
android.view.MenuItem
import
android.view.MenuItem
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
android.widget.Button
import
android.widget.EditText
import
android.widget.EditText
import
android.widget.FrameLayout
import
android.widget.FrameLayout
import
android.widget.ImageView
import
android.widget.ImageView
...
@@ -70,7 +69,6 @@ import chat.rocket.android.helper.MessageParser
...
@@ -70,7 +69,6 @@ import chat.rocket.android.helper.MessageParser
import
chat.rocket.android.util.extension.asObservable
import
chat.rocket.android.util.extension.asObservable
import
chat.rocket.android.util.extension.createImageFile
import
chat.rocket.android.util.extension.createImageFile
import
chat.rocket.android.util.extensions.circularRevealOrUnreveal
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.fadeIn
import
chat.rocket.android.util.extensions.fadeOut
import
chat.rocket.android.util.extensions.fadeOut
import
chat.rocket.android.util.extensions.getBitmpap
import
chat.rocket.android.util.extensions.getBitmpap
...
...
app/src/main/java/chat/rocket/android/chatroom/uimodel/UiModelMapper.kt
View file @
0b5dce3a
...
@@ -168,7 +168,7 @@ class UiModelMapper @Inject constructor(
...
@@ -168,7 +168,7 @@ class UiModelMapper @Inject constructor(
// TODO: move this to new interactor or FetchChatRoomsInteractor?
// TODO: move this to new interactor or FetchChatRoomsInteractor?
private
suspend
fun
getChatRoomAsync
(
roomId
:
String
):
ChatRoom
?
=
withContext
(
CommonPool
)
{
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
)
{
with
(
it
.
chatRoom
)
{
ChatRoom
(
ChatRoom
(
id
=
id
,
id
=
id
,
...
...
app/src/main/java/chat/rocket/android/userdetails/presentation/UserDetailsPresenter.kt
View file @
0b5dce3a
...
@@ -2,6 +2,7 @@ package chat.rocket.android.userdetails.presentation
...
@@ -2,6 +2,7 @@ package chat.rocket.android.userdetails.presentation
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.db.DatabaseManager
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.domain.GetConnectingServerInteractor
import
chat.rocket.android.server.infraestructure.ConnectionManagerFactory
import
chat.rocket.android.server.infraestructure.ConnectionManagerFactory
import
chat.rocket.android.util.extension.launchUI
import
chat.rocket.android.util.extension.launchUI
...
@@ -97,43 +98,56 @@ class UserDetailsPresenter @Inject constructor(
...
@@ -97,43 +98,56 @@ class UserDetailsPresenter @Inject constructor(
}
}
if
(
userEntity
!=
null
)
{
if
(
userEntity
!=
null
)
{
view
.
toDirectMessage
(
val
chatRoom
=
ChatRoom
(
chatRoom
=
ChatRoom
(
id
=
result
.
id
,
id
=
result
.
id
,
type
=
roomTypeOf
(
RoomType
.
DIRECT_MESSAGE
),
type
=
roomTypeOf
(
RoomType
.
DIRECT_MESSAGE
),
name
=
userEntity
.
username
?:
userEntity
.
name
.
orEmpty
(),
name
=
userEntity
.
username
?:
userEntity
.
name
.
orEmpty
(),
fullName
=
userEntity
.
name
,
fullName
=
userEntity
.
name
,
favorite
=
false
,
favorite
=
false
,
open
=
false
,
open
=
false
,
alert
=
false
,
alert
=
false
,
status
=
userStatusOf
(
userEntity
.
status
),
status
=
userStatusOf
(
userEntity
.
status
),
client
=
client
,
client
=
client
,
broadcast
=
false
,
broadcast
=
false
,
archived
=
false
,
archived
=
false
,
default
=
false
,
default
=
false
,
description
=
null
,
description
=
null
,
groupMentions
=
null
,
groupMentions
=
null
,
userMentions
=
null
,
userMentions
=
null
,
lastMessage
=
null
,
lastMessage
=
null
,
lastSeen
=
null
,
lastSeen
=
null
,
topic
=
null
,
topic
=
null
,
announcement
=
null
,
announcement
=
null
,
roles
=
null
,
roles
=
null
,
unread
=
0
,
unread
=
0
,
readonly
=
false
,
readonly
=
false
,
muted
=
null
,
muted
=
null
,
subscriptionId
=
""
,
subscriptionId
=
""
,
timestamp
=
null
,
timestamp
=
null
,
updatedAt
=
result
.
updatedAt
,
updatedAt
=
result
.
updatedAt
,
user
=
null
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
)
{
}
catch
(
ex
:
Exception
)
{
Timber
.
e
(
ex
)
Timber
.
e
(
ex
)
view
.
onOpenDirectMessageError
()
view
.
onOpenDirectMessageError
()
}
}
}
}
private
suspend
fun
chatRoomByName
(
name
:
String
?
=
null
):
List
<
ChatRoom
>
=
withContext
(
CommonPool
)
{
private
suspend
fun
chatRoomByName
(
name
:
String
?
=
null
):
List
<
ChatRoom
>
=
withContext
(
CommonPool
)
{
return
@withContext
dbManager
.
chatRoomDao
().
getAllSync
().
filter
{
return
@withContext
dbManager
.
chatRoomDao
().
getAllSync
().
filter
{
if
(
name
==
null
)
{
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