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
0859ad08
Commit
0859ad08
authored
Feb 04, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement PermissionsInteractor
parent
11df887f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
AppModule.kt
.../main/java/chat/rocket/android/dagger/module/AppModule.kt
+6
-0
PermissionsInteractor.kt
...hat/rocket/android/server/domain/PermissionsInteractor.kt
+29
-0
No files found.
app/src/main/java/chat/rocket/android/dagger/module/AppModule.kt
View file @
0859ad08
...
@@ -223,4 +223,10 @@ class AppModule {
...
@@ -223,4 +223,10 @@ class AppModule {
fun
provideMessageParser
(
context
:
Application
,
configuration
:
SpannableConfiguration
):
MessageParser
{
fun
provideMessageParser
(
context
:
Application
,
configuration
:
SpannableConfiguration
):
MessageParser
{
return
MessageParser
(
context
,
configuration
)
return
MessageParser
(
context
,
configuration
)
}
}
@Provides
@Singleton
fun
providePermissionInteractor
(
settingsRepository
:
SettingsRepository
,
serverRepository
:
CurrentServerRepository
):
PermissionsInteractor
{
return
PermissionsInteractor
(
settingsRepository
,
serverRepository
)
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/server/domain/PermissionsInteractor.kt
0 → 100644
View file @
0859ad08
package
chat.rocket.android.server.domain
import
javax.inject.Inject
class
PermissionsInteractor
@Inject
constructor
(
private
val
settingsRepository
:
SettingsRepository
,
private
val
currentServerRepository
:
CurrentServerRepository
)
{
private
fun
publicSettings
():
PublicSettings
?
=
settingsRepository
.
get
(
currentServerRepository
.
get
()
!!
)
/**
* Check whether user is allowed to delete a message.
*/
fun
isMessageDeletingAllowed
()
=
publicSettings
()
?.
deleteMessageAllowed
()
?:
false
/**
* Checks whether user is allowed to edit a message.
*/
fun
isMessageEditingAllowed
()
=
publicSettings
()
?.
deleteMessageAllowed
()
?:
false
/**
* Checks whether should show deleted message status.
*/
fun
showDeletedStatus
()
=
publicSettings
()
?.
showDeletedStatus
()
?:
false
/**
* Checks whether should show edited message status.
*/
fun
showEditedStatus
()
=
publicSettings
()
?.
showEditedStatus
()
?:
false
}
\ No newline at end of file
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