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
692b65f3
Commit
692b65f3
authored
Feb 08, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some refactoring
parent
2f59e9e2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
21 deletions
+25
-21
MessageViewModel.kt
...hat/rocket/android/chatroom/viewmodel/MessageViewModel.kt
+25
-21
No files found.
app/src/main/java/chat/rocket/android/chatroom/viewmodel/MessageViewModel.kt
View file @
692b65f3
...
@@ -69,11 +69,11 @@ data class MessageViewModel(val context: Context,
...
@@ -69,11 +69,11 @@ data class MessageViewModel(val context: Context,
}
}
}
}
message
.
attachments
?.
let
{
message
.
attachments
?.
let
{
attachments
->
if
(
it
.
isEmpty
()
||
it
[
0
]
==
null
)
return
@let
val
attachment
=
attachments
.
firstOrNull
()
if
(
attachments
.
isEmpty
()
||
attachment
==
null
)
return
@let
if
(
it
[
0
]
is
FileA
ttachment
)
{
when
(
a
ttachment
)
{
val
attachment
=
it
[
0
]
as
FileAttachment
is
FileAttachment
->
{
baseUrl
?.
let
{
baseUrl
?.
let
{
attachmentUrl
=
attachmentUrl
(
"${baseUrl.value}${attachment.url}"
)
attachmentUrl
=
attachmentUrl
(
"${baseUrl.value}${attachment.url}"
)
attachmentTitle
=
attachment
.
title
attachmentTitle
=
attachment
.
title
...
@@ -85,8 +85,8 @@ data class MessageViewModel(val context: Context,
...
@@ -85,8 +85,8 @@ data class MessageViewModel(val context: Context,
else
->
null
else
->
null
}
}
}
}
}
else
if
(
it
[
0
]
is
MessageAttachment
)
{
}
val
attachment
=
it
[
0
]
as
MessageAttachment
is
MessageAttachment
->
{
attachmentType
=
AttachmentType
.
Message
attachmentType
=
AttachmentType
.
Message
attachmentMessageText
=
attachment
.
text
?:
""
attachmentMessageText
=
attachment
.
text
?:
""
attachmentMessageAuthor
=
attachment
.
author
?:
""
attachmentMessageAuthor
=
attachment
.
author
?:
""
...
@@ -94,6 +94,7 @@ data class MessageViewModel(val context: Context,
...
@@ -94,6 +94,7 @@ data class MessageViewModel(val context: Context,
attachmentTimestamp
=
attachment
.
timestamp
attachmentTimestamp
=
attachment
.
timestamp
}
}
}
}
}
content
=
getContent
(
context
)
content
=
getContent
(
context
)
}
}
...
@@ -114,6 +115,9 @@ data class MessageViewModel(val context: Context,
...
@@ -114,6 +115,9 @@ data class MessageViewModel(val context: Context,
}
}
}
}
/**
* Get the original message as a String.
*/
fun
getOriginalMessage
()
=
message
.
message
fun
getOriginalMessage
()
=
message
.
message
private
fun
getTime
(
timestamp
:
Long
)
=
DateTimeHelper
.
getTime
(
DateTimeHelper
.
getLocalDateTime
(
timestamp
))
private
fun
getTime
(
timestamp
:
Long
)
=
DateTimeHelper
.
getTime
(
DateTimeHelper
.
getLocalDateTime
(
timestamp
))
...
...
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