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
45ea3824
Unverified
Commit
45ea3824
authored
Mar 23, 2018
by
Filipe de Lima Brito
Committed by
GitHub
Mar 23, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #949 from TheGamer007/mark_as_read
[FIX] Properly mark a room as read
parents
9670e641
1673b61e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+6
-3
item_message.xml
app/src/main/res/layout/item_message.xml
+8
-1
No files found.
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
45ea3824
...
@@ -71,13 +71,13 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView,
...
@@ -71,13 +71,13 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView,
client
.
messages
(
chatRoomId
,
roomTypeOf
(
chatRoomType
),
offset
,
30
).
result
client
.
messages
(
chatRoomId
,
roomTypeOf
(
chatRoomType
),
offset
,
30
).
result
messagesRepository
.
saveAll
(
messages
)
messagesRepository
.
saveAll
(
messages
)
val
messagesViewModels
=
mapper
.
map
(
messages
)
view
.
showMessages
(
messagesViewModels
)
// TODO: For now we are marking the room as read if we can get the messages (I mean, no exception occurs)
// TODO: For now we are marking the room as read if we can get the messages (I mean, no exception occurs)
// but should mark only when the user see the first unread message.
// but should mark only when the user see the first unread message.
markRoomAsRead
(
chatRoomId
)
markRoomAsRead
(
chatRoomId
)
val
messagesViewModels
=
mapper
.
map
(
messages
)
view
.
showMessages
(
messagesViewModels
)
subscribeMessages
(
chatRoomId
)
subscribeMessages
(
chatRoomId
)
}
catch
(
ex
:
Exception
)
{
}
catch
(
ex
:
Exception
)
{
ex
.
printStackTrace
()
ex
.
printStackTrace
()
...
@@ -230,6 +230,9 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView,
...
@@ -230,6 +230,9 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView,
fun
unsubscribeMessages
(
chatRoomId
:
String
)
{
fun
unsubscribeMessages
(
chatRoomId
:
String
)
{
manager
.
removeStatusChannel
(
stateChannel
)
manager
.
removeStatusChannel
(
stateChannel
)
manager
.
unsubscribeRoomMessages
(
chatRoomId
)
manager
.
unsubscribeRoomMessages
(
chatRoomId
)
// All messages during the subscribed period are assumed to be read,
// and lastSeen is updated as the time when the user leaves the room
markRoomAsRead
(
chatRoomId
)
}
}
/**
/**
...
...
app/src/main/res/layout/item_message.xml
View file @
45ea3824
...
@@ -35,13 +35,20 @@
...
@@ -35,13 +35,20 @@
android:layout_height=
"1dp"
android:layout_height=
"1dp"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:layout_margin
Right
=
"4dp"
android:layout_margin
End
=
"4dp"
android:background=
"@color/red"
/>
android:background=
"@color/red"
/>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:text=
"@string/msg_unread_messages"
android:text=
"@string/msg_unread_messages"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/red"
/>
android:textColor=
"@color/red"
/>
<View
android:layout_gravity=
"center"
android:layout_height=
"1dp"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_marginStart=
"4dp"
android:background=
"@color/red"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
<LinearLayout
...
...
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