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
b2d415bb
Commit
b2d415bb
authored
Feb 07, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set suspendable fun to use CommonPool
parent
eefea063
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
MessageViewModelMapper.kt
...cket/android/chatroom/viewmodel/MessageViewModelMapper.kt
+5
-2
No files found.
app/src/main/java/chat/rocket/android/chatroom/viewmodel/MessageViewModelMapper.kt
View file @
b2d415bb
...
...
@@ -6,6 +6,8 @@ import chat.rocket.android.server.domain.MessagesRepository
import
chat.rocket.core.TokenRepository
import
chat.rocket.core.model.Message
import
chat.rocket.core.model.Value
import
kotlinx.coroutines.experimental.CommonPool
import
kotlinx.coroutines.experimental.launch
import
javax.inject.Inject
class
MessageViewModelMapper
@Inject
constructor
(
private
val
context
:
Context
,
...
...
@@ -13,8 +15,9 @@ class MessageViewModelMapper @Inject constructor(private val context: Context,
private
val
messageParser
:
MessageParser
,
private
val
messagesRepository
:
MessagesRepository
)
{
suspend
fun
mapToViewModel
(
message
:
Message
,
settings
:
Map
<
String
,
Value
<
Any
>>?)
=
MessageViewModel
(
context
,
tokenRepository
.
get
(),
message
,
settings
,
messageParser
,
messagesRepository
)
suspend
fun
mapToViewModel
(
message
:
Message
,
settings
:
Map
<
String
,
Value
<
Any
>>?)
=
launch
(
CommonPool
)
{
MessageViewModel
(
this
@MessageViewModelMapper
.
context
,
tokenRepository
.
get
(),
message
,
settings
,
messageParser
,
messagesRepository
)
}
suspend
fun
mapToViewModelList
(
messageList
:
List
<
Message
>,
settings
:
Map
<
String
,
Value
<
Any
>>?):
List
<
MessageViewModel
>
{
return
messageList
.
map
{
MessageViewModel
(
context
,
tokenRepository
.
get
(),
it
,
settings
,
messageParser
,
messagesRepository
)
}
...
...
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