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
923020e2
Commit
923020e2
authored
Jan 29, 2018
by
Lucio Maciel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using sealed classes from the SDK instead of enums
parent
9b2a725c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
13 deletions
+14
-13
build.gradle
app/build.gradle
+2
-2
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+2
-2
MessageViewModel.kt
...hat/rocket/android/chatroom/viewmodel/MessageViewModel.kt
+6
-6
ChatRoomsPresenter.kt
...cket/android/chatrooms/presentation/ChatRoomsPresenter.kt
+2
-1
ChatRoomsAdapter.kt
...java/chat/rocket/android/chatrooms/ui/ChatRoomsAdapter.kt
+2
-2
No files found.
app/build.gradle
View file @
923020e2
...
...
@@ -12,8 +12,8 @@ android {
applicationId
"chat.rocket.android"
minSdkVersion
21
targetSdkVersion
versions
.
targetSdk
versionCode
100
5
versionName
"2.0.0-dev
4
"
versionCode
100
6
versionName
"2.0.0-dev
5
"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled
true
}
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
923020e2
...
...
@@ -6,7 +6,7 @@ import chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.GetSettingsInteractor
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.android.util.launchUI
import
chat.rocket.common.model.
BaseRoom
import
chat.rocket.common.model.
roomTypeOf
import
chat.rocket.common.util.ifNull
import
chat.rocket.core.internal.realtime.State
import
chat.rocket.core.internal.realtime.connect
...
...
@@ -43,7 +43,7 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView,
launchUI
(
strategy
)
{
view
.
showLoading
()
try
{
val
messages
=
client
.
messages
(
chatRoomId
,
BaseRoom
.
RoomType
.
valu
eOf
(
chatRoomType
),
offset
,
30
).
result
val
messages
=
client
.
messages
(
chatRoomId
,
roomTyp
eOf
(
chatRoomType
),
offset
,
30
).
result
synchronized
(
roomMessages
)
{
roomMessages
.
addAll
(
messages
)
}
...
...
app/src/main/java/chat/rocket/android/chatroom/viewmodel/MessageViewModel.kt
View file @
923020e2
...
...
@@ -76,14 +76,14 @@ data class MessageViewModel(val context: Context,
val
contentMessage
:
CharSequence
when
(
message
.
type
)
{
//TODO: Add implementation for Welcome type.
MESSAGE_REMOVED
->
contentMessage
=
getSystemMessage
(
context
.
getString
(
R
.
string
.
message_removed
))
USER_JOINED
->
contentMessage
=
getSystemMessage
(
context
.
getString
(
R
.
string
.
message_user_joined_channel
))
USER_LEFT
->
contentMessage
=
getSystemMessage
(
context
.
getString
(
R
.
string
.
message_user_left
))
USER_ADDED
->
contentMessage
=
getSystemMessage
(
is
MessageRemoved
->
contentMessage
=
getSystemMessage
(
context
.
getString
(
R
.
string
.
message_removed
))
is
UserJoined
->
contentMessage
=
getSystemMessage
(
context
.
getString
(
R
.
string
.
message_user_joined_channel
))
is
UserLeft
->
contentMessage
=
getSystemMessage
(
context
.
getString
(
R
.
string
.
message_user_left
))
is
UserAdded
->
contentMessage
=
getSystemMessage
(
context
.
getString
(
R
.
string
.
message_user_added_by
,
message
.
message
,
message
.
sender
?.
username
))
ROOM_NAME_CHANGED
->
contentMessage
=
getSystemMessage
(
is
RoomNameChanged
->
contentMessage
=
getSystemMessage
(
context
.
getString
(
R
.
string
.
message_room_name_changed
,
message
.
message
,
message
.
sender
?.
username
))
USER_REMOVED
->
contentMessage
=
getSystemMessage
(
is
UserRemoved
->
contentMessage
=
getSystemMessage
(
context
.
getString
(
R
.
string
.
message_user_removed_by
,
message
.
message
,
message
.
sender
?.
username
))
else
->
contentMessage
=
getNormalMessage
()
}
...
...
app/src/main/java/chat/rocket/android/chatrooms/presentation/ChatRoomsPresenter.kt
View file @
923020e2
...
...
@@ -39,7 +39,8 @@ class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView,
}
}
fun
loadChatRoom
(
chatRoom
:
ChatRoom
)
=
navigator
.
toChatRoom
(
chatRoom
.
id
,
chatRoom
.
name
,
chatRoom
.
type
.
name
,
chatRoom
.
readonly
?:
false
)
fun
loadChatRoom
(
chatRoom
:
ChatRoom
)
=
navigator
.
toChatRoom
(
chatRoom
.
id
,
chatRoom
.
name
,
chatRoom
.
type
.
toString
(),
chatRoom
.
readonly
?:
false
)
/**
* Gets a [ChatRoom] list from local repository.
...
...
app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsAdapter.kt
View file @
923020e2
...
...
@@ -13,7 +13,7 @@ import chat.rocket.android.helper.UrlHelper
import
chat.rocket.android.util.inflate
import
chat.rocket.android.util.setVisible
import
chat.rocket.android.util.textContent
import
chat.rocket.common.model.
BaseRoom.
RoomType
import
chat.rocket.common.model.RoomType
import
chat.rocket.core.model.ChatRoom
import
com.facebook.drawee.view.SimpleDraweeView
import
kotlinx.android.synthetic.main.avatar.view.*
...
...
@@ -50,7 +50,7 @@ class ChatRoomsAdapter(private val context: Context,
private
fun
bindAvatar
(
chatRoom
:
ChatRoom
,
avatarLayout
:
View
,
drawee
:
SimpleDraweeView
,
imageView
:
ImageView
)
{
val
chatRoomName
=
chatRoom
.
name
if
(
chatRoom
.
type
==
RoomType
.
ONE_TO_ONE
)
{
if
(
chatRoom
.
type
is
RoomType
.
OneToOne
)
{
drawee
.
setImageURI
(
UrlHelper
.
getAvatarUrl
(
chatRoom
.
client
.
url
,
chatRoomName
))
imageView
.
setVisible
(
false
)
avatarLayout
.
setVisible
(
true
)
...
...
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