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
407a7248
Commit
407a7248
authored
Apr 26, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove redundant 'suspend' modifiers and unused construtor params
parent
de2270bb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
41 deletions
+41
-41
ViewModelMapper.kt
...chat/rocket/android/chatroom/viewmodel/ViewModelMapper.kt
+41
-41
No files found.
app/src/main/java/chat/rocket/android/chatroom/viewmodel/ViewModelMapper.kt
View file @
407a7248
...
@@ -31,14 +31,14 @@ import okhttp3.HttpUrl
...
@@ -31,14 +31,14 @@ import okhttp3.HttpUrl
import
java.security.InvalidParameterException
import
java.security.InvalidParameterException
import
javax.inject.Inject
import
javax.inject.Inject
class
ViewModelMapper
@Inject
constructor
(
private
val
context
:
Context
,
class
ViewModelMapper
@Inject
constructor
(
private
val
context
:
Context
,
private
val
parser
:
MessageParser
,
private
val
parser
:
MessageParser
,
private
val
messagesRepository
:
MessagesRepository
,
private
val
getAccountInteractor
:
GetAccountInteractor
,
tokenRepository
:
TokenRepository
,
tokenRepository
:
TokenRepository
,
serverInteractor
:
GetCurrentServerInteractor
,
serverInteractor
:
GetCurrentServerInteractor
,
getSettingsInteractor
:
GetSettingsInteractor
,
getSettingsInteractor
:
GetSettingsInteractor
,
localRepository
:
LocalRepository
)
{
localRepository
:
LocalRepository
)
{
private
val
currentServer
=
serverInteractor
.
get
()
!!
private
val
currentServer
=
serverInteractor
.
get
()
!!
private
val
settings
:
Map
<
String
,
Value
<
Any
>>
=
getSettingsInteractor
.
get
(
currentServer
)
private
val
settings
:
Map
<
String
,
Value
<
Any
>>
=
getSettingsInteractor
.
get
(
currentServer
)
...
@@ -101,7 +101,7 @@ class ViewModelMapper @Inject constructor(private val context: Context,
...
@@ -101,7 +101,7 @@ class ViewModelMapper @Inject constructor(private val context: Context,
getReactions
(
message
),
preview
=
message
.
copy
(
message
=
url
.
url
))
getReactions
(
message
),
preview
=
message
.
copy
(
message
=
url
.
url
))
}
}
private
suspend
fun
mapAttachment
(
message
:
Message
,
attachment
:
Attachment
):
BaseViewModel
<
*
>?
{
private
fun
mapAttachment
(
message
:
Message
,
attachment
:
Attachment
):
BaseViewModel
<
*
>?
{
return
when
(
attachment
)
{
return
when
(
attachment
)
{
is
FileAttachment
->
mapFileAttachment
(
message
,
attachment
)
is
FileAttachment
->
mapFileAttachment
(
message
,
attachment
)
is
MessageAttachment
->
mapMessageAttachment
(
message
,
attachment
)
is
MessageAttachment
->
mapMessageAttachment
(
message
,
attachment
)
...
@@ -111,7 +111,7 @@ class ViewModelMapper @Inject constructor(private val context: Context,
...
@@ -111,7 +111,7 @@ class ViewModelMapper @Inject constructor(private val context: Context,
}
}
}
}
private
suspend
fun
mapColorAttachment
(
message
:
Message
,
attachment
:
ColorAttachment
):
BaseViewModel
<
*
>?
{
private
fun
mapColorAttachment
(
message
:
Message
,
attachment
:
ColorAttachment
):
BaseViewModel
<
*
>?
{
return
with
(
attachment
)
{
return
with
(
attachment
)
{
val
content
=
stripMessageQuotes
(
message
)
val
content
=
stripMessageQuotes
(
message
)
val
id
=
attachmentId
(
message
,
attachment
)
val
id
=
attachmentId
(
message
,
attachment
)
...
@@ -123,7 +123,7 @@ class ViewModelMapper @Inject constructor(private val context: Context,
...
@@ -123,7 +123,7 @@ class ViewModelMapper @Inject constructor(private val context: Context,
}
}
}
}
private
suspend
fun
mapAuthorAttachment
(
message
:
Message
,
attachment
:
AuthorAttachment
):
AuthorAttachmentViewModel
{
private
fun
mapAuthorAttachment
(
message
:
Message
,
attachment
:
AuthorAttachment
):
AuthorAttachmentViewModel
{
return
with
(
attachment
)
{
return
with
(
attachment
)
{
val
content
=
stripMessageQuotes
(
message
)
val
content
=
stripMessageQuotes
(
message
)
...
@@ -151,7 +151,7 @@ class ViewModelMapper @Inject constructor(private val context: Context,
...
@@ -151,7 +151,7 @@ class ViewModelMapper @Inject constructor(private val context: Context,
}
}
}
}
private
suspend
fun
mapMessageAttachment
(
message
:
Message
,
attachment
:
MessageAttachment
):
MessageAttachmentViewModel
{
private
fun
mapMessageAttachment
(
message
:
Message
,
attachment
:
MessageAttachment
):
MessageAttachmentViewModel
{
val
attachmentAuthor
=
attachment
.
author
val
attachmentAuthor
=
attachment
.
author
val
time
=
attachment
.
timestamp
?.
let
{
getTime
(
it
)
}
val
time
=
attachment
.
timestamp
?.
let
{
getTime
(
it
)
}
val
attachmentText
=
when
(
attachment
.
attachments
.
orEmpty
().
firstOrNull
())
{
val
attachmentText
=
when
(
attachment
.
attachments
.
orEmpty
().
firstOrNull
())
{
...
@@ -234,7 +234,7 @@ class ViewModelMapper @Inject constructor(private val context: Context,
...
@@ -234,7 +234,7 @@ class ViewModelMapper @Inject constructor(private val context: Context,
isFirstUnread
=
false
,
preview
=
preview
,
isTemporary
=
isTemp
)
isFirstUnread
=
false
,
preview
=
preview
,
isTemporary
=
isTemp
)
}
}
private
suspend
fun
mapMessagePreview
(
message
:
Message
):
Message
{
private
fun
mapMessagePreview
(
message
:
Message
):
Message
{
return
when
(
message
.
isSystemMessage
())
{
return
when
(
message
.
isSystemMessage
())
{
false
->
stripMessageQuotes
(
message
)
false
->
stripMessageQuotes
(
message
)
true
->
message
.
copy
(
message
=
getSystemMessage
(
message
).
toString
())
true
->
message
.
copy
(
message
=
getSystemMessage
(
message
).
toString
())
...
@@ -301,7 +301,7 @@ class ViewModelMapper @Inject constructor(private val context: Context,
...
@@ -301,7 +301,7 @@ class ViewModelMapper @Inject constructor(private val context: Context,
private
fun
getTime
(
timestamp
:
Long
)
=
DateTimeHelper
.
getTime
(
DateTimeHelper
.
getLocalDateTime
(
timestamp
))
private
fun
getTime
(
timestamp
:
Long
)
=
DateTimeHelper
.
getTime
(
DateTimeHelper
.
getLocalDateTime
(
timestamp
))
private
suspend
fun
getContent
(
message
:
Message
):
CharSequence
{
private
fun
getContent
(
message
:
Message
):
CharSequence
{
return
when
(
message
.
isSystemMessage
())
{
return
when
(
message
.
isSystemMessage
())
{
true
->
getSystemMessage
(
message
)
true
->
getSystemMessage
(
message
)
false
->
parser
.
renderMarkdown
(
message
,
currentUsername
)
false
->
parser
.
renderMarkdown
(
message
,
currentUsername
)
...
...
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