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
11d9eea4
Commit
11d9eea4
authored
Jun 22, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No need to specify the room type to get the mentions.
parent
f780d4ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
23 deletions
+4
-23
MentionsFragmentModule.kt
...chat/rocket/android/mentions/di/MentionsFragmentModule.kt
+0
-11
MentionsPresenter.kt
...ocket/android/mentions/presentention/MentionsPresenter.kt
+4
-12
No files found.
app/src/main/java/chat/rocket/android/mentions/di/MentionsFragmentModule.kt
View file @
11d9eea4
...
@@ -3,8 +3,6 @@ package chat.rocket.android.mentions.di
...
@@ -3,8 +3,6 @@ package chat.rocket.android.mentions.di
import
androidx.lifecycle.LifecycleOwner
import
androidx.lifecycle.LifecycleOwner
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.dagger.scope.PerFragment
import
chat.rocket.android.dagger.scope.PerFragment
import
chat.rocket.android.db.DatabaseManager
import
chat.rocket.android.db.DatabaseManagerFactory
import
chat.rocket.android.mentions.presentention.MentionsView
import
chat.rocket.android.mentions.presentention.MentionsView
import
chat.rocket.android.mentions.ui.MentionsFragment
import
chat.rocket.android.mentions.ui.MentionsFragment
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
...
@@ -29,15 +27,6 @@ class MentionsFragmentModule {
...
@@ -29,15 +27,6 @@ class MentionsFragmentModule {
return
currentServerInteractor
.
get
()
!!
return
currentServerInteractor
.
get
()
!!
}
}
@Provides
@PerFragment
fun
provideDatabaseManager
(
factory
:
DatabaseManagerFactory
,
@Named
(
"currentServer"
)
currentServer
:
String
):
DatabaseManager
{
return
factory
.
create
(
currentServer
)
}
@Provides
@Provides
@PerFragment
@PerFragment
fun
provideJob
()
=
Job
()
fun
provideJob
()
=
Job
()
...
...
app/src/main/java/chat/rocket/android/mentions/presentention/MentionsPresenter.kt
View file @
11d9eea4
...
@@ -2,11 +2,9 @@ package chat.rocket.android.mentions.presentention
...
@@ -2,11 +2,9 @@ package chat.rocket.android.mentions.presentention
import
chat.rocket.android.chatroom.uimodel.UiModelMapper
import
chat.rocket.android.chatroom.uimodel.UiModelMapper
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.db.DatabaseManager
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.android.util.extensions.launchUI
import
chat.rocket.android.util.extensions.launchUI
import
chat.rocket.common.RocketChatException
import
chat.rocket.common.RocketChatException
import
chat.rocket.common.model.roomTypeOf
import
chat.rocket.common.util.ifNull
import
chat.rocket.common.util.ifNull
import
chat.rocket.core.internal.rest.getMentions
import
chat.rocket.core.internal.rest.getMentions
import
timber.log.Timber
import
timber.log.Timber
...
@@ -15,7 +13,6 @@ import javax.inject.Named
...
@@ -15,7 +13,6 @@ import javax.inject.Named
class
MentionsPresenter
@Inject
constructor
(
class
MentionsPresenter
@Inject
constructor
(
private
val
view
:
MentionsView
,
private
val
view
:
MentionsView
,
private
val
dbManager
:
DatabaseManager
,
@Named
(
"currentServer"
)
private
val
currentServer
:
String
,
@Named
(
"currentServer"
)
private
val
currentServer
:
String
,
private
val
strategy
:
CancelStrategy
,
private
val
strategy
:
CancelStrategy
,
private
val
mapper
:
UiModelMapper
,
private
val
mapper
:
UiModelMapper
,
...
@@ -33,15 +30,10 @@ class MentionsPresenter @Inject constructor(
...
@@ -33,15 +30,10 @@ class MentionsPresenter @Inject constructor(
launchUI
(
strategy
)
{
launchUI
(
strategy
)
{
try
{
try
{
view
.
showLoading
()
view
.
showLoading
()
dbManager
.
getRoom
(
roomId
)
?.
let
{
val
mentions
=
client
.
getMentions
(
roomId
,
offset
,
30
)
val
mentions
=
val
mentionsList
=
mapper
.
map
(
mentions
.
result
,
asNotReversed
=
true
)
client
.
getMentions
(
roomId
,
roomTypeOf
(
it
.
chatRoom
.
type
),
offset
,
30
)
view
.
showMentions
(
mentionsList
)
val
mentionsList
=
mapper
.
map
(
mentions
.
result
,
asNotReversed
=
true
)
offset
+=
1
*
30
view
.
showMentions
(
mentionsList
)
offset
+=
1
*
30
}.
ifNull
{
Timber
.
e
(
"Couldn't find a room with id: $roomId at current server."
)
}
}
catch
(
exception
:
RocketChatException
)
{
}
catch
(
exception
:
RocketChatException
)
{
Timber
.
e
(
exception
)
Timber
.
e
(
exception
)
exception
.
message
?.
let
{
exception
.
message
?.
let
{
...
...
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