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
a1963cc2
Commit
a1963cc2
authored
May 10, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide members list on broadcast channel
parent
ff60cbf1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
14 deletions
+56
-14
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+34
-5
ChatRoomView.kt
...chat/rocket/android/chatroom/presentation/ChatRoomView.kt
+4
-1
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+6
-2
ChatRoomsPresenter.kt
...cket/android/chatrooms/presentation/ChatRoomsPresenter.kt
+12
-6
No files found.
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
a1963cc2
...
...
@@ -15,7 +15,18 @@ import chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.helper.UserHelper
import
chat.rocket.android.infrastructure.LocalRepository
import
chat.rocket.android.infrastructure.username
import
chat.rocket.android.server.domain.*
import
chat.rocket.android.server.domain.GetChatRoomsInteractor
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.GetSettingsInteractor
import
chat.rocket.android.server.domain.JobSchedulerInteractor
import
chat.rocket.android.server.domain.MessagesRepository
import
chat.rocket.android.server.domain.PermissionsInteractor
import
chat.rocket.android.server.domain.PublicSettings
import
chat.rocket.android.server.domain.RoomRepository
import
chat.rocket.android.server.domain.UsersRepository
import
chat.rocket.android.server.domain.uploadMaxFileSize
import
chat.rocket.android.server.domain.uploadMimeTypeFilter
import
chat.rocket.android.server.domain.useRealName
import
chat.rocket.android.server.infraestructure.ConnectionManagerFactory
import
chat.rocket.android.server.infraestructure.state
import
chat.rocket.android.util.extensions.avatarUrl
...
...
@@ -29,7 +40,22 @@ import chat.rocket.common.model.roomTypeOf
import
chat.rocket.common.util.ifNull
import
chat.rocket.core.internal.realtime.setTypingStatus
import
chat.rocket.core.internal.realtime.socket.model.State
import
chat.rocket.core.internal.rest.*
import
chat.rocket.core.internal.rest.commands
import
chat.rocket.core.internal.rest.deleteMessage
import
chat.rocket.core.internal.rest.getMembers
import
chat.rocket.core.internal.rest.history
import
chat.rocket.core.internal.rest.joinChat
import
chat.rocket.core.internal.rest.markAsRead
import
chat.rocket.core.internal.rest.me
import
chat.rocket.core.internal.rest.messages
import
chat.rocket.core.internal.rest.pinMessage
import
chat.rocket.core.internal.rest.runCommand
import
chat.rocket.core.internal.rest.sendMessage
import
chat.rocket.core.internal.rest.spotlight
import
chat.rocket.core.internal.rest.toggleReaction
import
chat.rocket.core.internal.rest.unpinMessage
import
chat.rocket.core.internal.rest.updateMessage
import
chat.rocket.core.internal.rest.uploadFile
import
chat.rocket.core.model.Command
import
chat.rocket.core.model.Message
import
chat.rocket.core.model.Myself
...
...
@@ -73,10 +99,13 @@ class ChatRoomPresenter @Inject constructor(
private
val
stateChannel
=
Channel
<
State
>()
private
var
lastState
=
manager
.
state
fun
setupChatRoom
()
{
fun
setupChatRoom
(
roomId
:
String
)
{
launchUI
(
strategy
)
{
val
canPost
=
permissions
.
canPostToReadOnlyChannels
()
view
.
onRoomChanged
(
canPost
)
val
broadcastChannel
=
getChatRoomsInteractor
.
getById
(
currentServer
,
roomId
)
?.
run
{
broadcast
}
?:
false
view
.
onRoomUpdated
(
canPost
,
broadcastChannel
)
}
}
...
...
@@ -543,7 +572,7 @@ class ChatRoomPresenter @Inject constructor(
fun
toMembersList
(
chatRoomId
:
String
,
chatRoomType
:
String
)
=
navigator
.
toMembersList
(
chatRoomId
,
chatRoomType
)
fun
toPinnedMessageList
(
chatRoomId
:
String
,
chatRoomType
:
String
)
=
navigator
.
toPinnedMessageList
(
chatRoomId
,
chatRoomType
)
fun
toPinnedMessageList
(
chatRoomId
:
String
,
chatRoomType
:
String
)
=
navigator
.
toPinnedMessageList
(
chatRoomId
,
chatRoomType
)
fun
loadChatRooms
()
{
launchUI
(
strategy
)
{
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomView.kt
View file @
a1963cc2
...
...
@@ -123,5 +123,8 @@ interface ChatRoomView : LoadingView, MessageView {
*/
fun
populateCommandSuggestions
(
commands
:
List
<
CommandSuggestionViewModel
>)
fun
onRoomChanged
(
canPost
:
Boolean
)
/**
* Communicate whether it's a broadcast channel and if current user can post to it.
*/
fun
onRoomUpdated
(
canPost
:
Boolean
,
broadcastChannel
:
Boolean
)
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
a1963cc2
...
...
@@ -113,6 +113,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
private
var
isSubscribed
:
Boolean
=
true
private
var
isChatRoomReadOnly
:
Boolean
=
false
private
var
isChatRoomOwner
:
Boolean
=
false
private
var
isBroadcastChannel
:
Boolean
=
false
private
lateinit
var
emojiKeyboardPopup
:
EmojiKeyboardPopup
private
var
chatRoomLastSeen
:
Long
=
-
1
private
lateinit
var
actionSnackbar
:
ActionSnackbar
...
...
@@ -162,7 +163,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
super
.
onViewCreated
(
view
,
savedInstanceState
)
setupToolbar
(
chatRoomName
)
presenter
.
setupChatRoom
()
presenter
.
setupChatRoom
(
chatRoomId
)
presenter
.
loadMessages
(
chatRoomId
,
chatRoomType
)
presenter
.
loadChatRooms
()
setupRecyclerView
()
...
...
@@ -206,6 +207,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override
fun
onCreateOptionsMenu
(
menu
:
Menu
,
inflater
:
MenuInflater
)
{
super
.
onCreateOptionsMenu
(
menu
,
inflater
)
inflater
.
inflate
(
R
.
menu
.
chatroom_actions
,
menu
)
menu
.
findItem
(
R
.
id
.
action_members_list
)
?.
isVisible
=
!
isBroadcastChannel
}
override
fun
onOptionsItemSelected
(
item
:
MenuItem
):
Boolean
{
...
...
@@ -265,8 +267,10 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
}
override
fun
onRoom
Changed
(
canPost
:
Boolean
)
{
override
fun
onRoom
Updated
(
canPost
:
Boolean
,
broadcastChannel
:
Boolean
)
{
setupMessageComposer
(
isChatRoomOwner
||
canPost
)
isBroadcastChannel
=
broadcastChannel
if
(
isBroadcastChannel
)
activity
?.
invalidateOptionsMenu
()
}
private
fun
toggleNoChatView
(
size
:
Int
)
{
...
...
app/src/main/java/chat/rocket/android/chatrooms/presentation/ChatRoomsPresenter.kt
View file @
a1963cc2
...
...
@@ -211,7 +211,8 @@ class ChatRoomsPresenter @Inject constructor(
userMentions
=
null
,
groupMentions
=
0L
,
lastMessage
=
null
,
client
=
client
client
=
client
,
broadcast
=
false
)
}
}
...
...
@@ -244,7 +245,8 @@ class ChatRoomsPresenter @Inject constructor(
userMentions
=
null
,
groupMentions
=
0L
,
lastMessage
=
it
.
lastMessage
,
client
=
client
client
=
client
,
broadcast
=
it
.
broadcast
)
}
}
...
...
@@ -335,7 +337,8 @@ class ChatRoomsPresenter @Inject constructor(
userMentions
=
it
.
userMentions
,
groupMentions
=
it
.
groupMentions
,
lastMessage
=
it
.
lastMessage
,
client
=
client
client
=
client
,
broadcast
=
it
.
broadcast
)
chatRoomsList
.
add
(
newRoom
)
}
...
...
@@ -478,7 +481,8 @@ class ChatRoomsPresenter @Inject constructor(
userMentions
=
userMentions
,
groupMentions
=
groupMentions
,
lastMessage
=
room
.
lastMessage
,
client
=
client
client
=
client
,
broadcast
=
broadcast
)
removeRoom
(
room
.
id
,
chatRooms
)
chatRooms
.
add
(
newRoom
)
...
...
@@ -517,7 +521,8 @@ class ChatRoomsPresenter @Inject constructor(
userMentions
=
subscription
.
userMentions
,
groupMentions
=
subscription
.
groupMentions
,
lastMessage
=
lastMessage
,
client
=
client
client
=
client
,
broadcast
=
broadcast
)
removeRoom
(
subscription
.
roomId
,
chatRooms
)
chatRooms
.
add
(
newRoom
)
...
...
@@ -591,7 +596,8 @@ class ChatRoomsPresenter @Inject constructor(
userMentions
=
it
.
userMentions
,
groupMentions
=
it
.
groupMentions
,
lastMessage
=
it
.
lastMessage
,
client
=
client
client
=
client
,
broadcast
=
it
.
broadcast
)
getChatRoomsInteractor
.
remove
(
currentServer
,
it
)
...
...
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