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
caf38042
Commit
caf38042
authored
Jan 15, 2018
by
Lucio Maciel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Just ignore the response from sendMessage and use the message on the stream..
parent
9d59c945
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
4 deletions
+23
-4
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+7
-4
ChatRoomView.kt
...chat/rocket/android/chatroom/presentation/ChatRoomView.kt
+4
-0
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+12
-0
No files found.
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
caf38042
...
...
@@ -34,6 +34,7 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView,
}
view
.
showMessages
(
messages
,
serverInteractor
.
get
()
!!
)
}
catch
(
ex
:
Exception
)
{
ex
.
printStackTrace
()
ex
.
message
?.
let
{
view
.
showMessage
(
it
)
}.
ifNull
{
...
...
@@ -47,18 +48,20 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView,
fun
sendMessage
(
chatRoomId
:
String
,
text
:
String
)
{
launchUI
(
strategy
)
{
view
.
disableMessageInput
()
try
{
val
message
=
client
.
sendMessage
(
chatRoomId
,
text
)
synchronized
(
roomMessages
)
{
roomMessages
.
add
(
0
,
message
)
}
view
.
showNewMessage
(
message
)
// ignore message for now, will receive it on the stream
view
.
enableMessageInput
(
clear
=
true
)
}
catch
(
ex
:
Exception
)
{
ex
.
printStackTrace
()
ex
.
message
?.
let
{
view
.
showMessage
(
it
)
}.
ifNull
{
view
.
showGenericErrorMessage
()
}
view
.
enableMessageInput
()
}
}
}
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomView.kt
View file @
caf38042
...
...
@@ -34,4 +34,8 @@ interface ChatRoomView : LoadingView, MessageView {
* @param index The index of the changed message
*/
fun
dispatchUpdateMessage
(
index
:
Int
,
message
:
Message
)
fun
disableMessageInput
()
fun
enableMessageInput
(
clear
:
Boolean
=
false
)
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
caf38042
...
...
@@ -39,6 +39,7 @@ private const val BUNDLE_CHAT_ROOM_TYPE = "chat_room_type"
private
const
val
BUNDLE_IS_CHAT_ROOM_READ_ONLY
=
"is_chat_room_read_only"
class
ChatRoomFragment
:
Fragment
(),
ChatRoomView
{
@Inject
lateinit
var
presenter
:
ChatRoomPresenter
private
lateinit
var
chatRoomId
:
String
private
lateinit
var
chatRoomName
:
String
...
...
@@ -108,6 +109,17 @@ class ChatRoomFragment : Fragment(), ChatRoomView {
recycler_view
.
smoothScrollToPosition
(
0
)
}
override
fun
disableMessageInput
()
{
text_send
.
isEnabled
=
false
text_message
.
isEnabled
=
false
}
override
fun
enableMessageInput
(
clear
:
Boolean
)
{
text_send
.
isEnabled
=
true
text_message
.
isEnabled
=
true
if
(
clear
)
text_message
.
textContent
=
""
}
override
fun
dispatchUpdateMessage
(
index
:
Int
,
message
:
Message
)
{
adapter
.
updateItem
(
index
,
message
)
}
...
...
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