|
@@ -274,6 +274,8 @@ class ChatController(args: Bundle) :
|
|
lateinit var mediaPlayerHandler: Handler
|
|
lateinit var mediaPlayerHandler: Handler
|
|
var currentlyPlayedVoiceMessage: ChatMessage? = null
|
|
var currentlyPlayedVoiceMessage: ChatMessage? = null
|
|
|
|
|
|
|
|
+ var hasChatPermission: Boolean = false
|
|
|
|
+
|
|
init {
|
|
init {
|
|
Log.d(TAG, "init ChatController: " + System.identityHashCode(this).toString())
|
|
Log.d(TAG, "init ChatController: " + System.identityHashCode(this).toString())
|
|
|
|
|
|
@@ -307,6 +309,9 @@ class ChatController(args: Bundle) :
|
|
}
|
|
}
|
|
|
|
|
|
this.voiceOnly = args.getBoolean(BundleKeys.KEY_CALL_VOICE_ONLY, false)
|
|
this.voiceOnly = args.getBoolean(BundleKeys.KEY_CALL_VOICE_ONLY, false)
|
|
|
|
+
|
|
|
|
+ hasChatPermission =
|
|
|
|
+ AttendeePermissionsUtil(currentConversation!!.permissions).hasChatPermission(conversationUser)
|
|
}
|
|
}
|
|
|
|
|
|
private fun getRoomInfo() {
|
|
private fun getRoomInfo() {
|
|
@@ -342,7 +347,8 @@ class ChatController(args: Bundle) :
|
|
setTitle()
|
|
setTitle()
|
|
try {
|
|
try {
|
|
setupMentionAutocomplete()
|
|
setupMentionAutocomplete()
|
|
- checkReadOnlyState()
|
|
|
|
|
|
+ checkShowCallButtons()
|
|
|
|
+ checkShowMessageInputView()
|
|
checkLobbyState()
|
|
checkLobbyState()
|
|
|
|
|
|
if (!inConversation) {
|
|
if (!inConversation) {
|
|
@@ -1159,13 +1165,24 @@ class ChatController(args: Bundle) :
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
|
|
- private fun checkReadOnlyState() {
|
|
|
|
|
|
+ private fun checkShowCallButtons() {
|
|
if (isAlive()) {
|
|
if (isAlive()) {
|
|
if (isReadOnlyConversation() || shouldShowLobby()) {
|
|
if (isReadOnlyConversation() || shouldShowLobby()) {
|
|
disableCallButtons()
|
|
disableCallButtons()
|
|
- binding.messageInputView.visibility = View.GONE
|
|
|
|
} else {
|
|
} else {
|
|
enableCallButtons()
|
|
enableCallButtons()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private fun checkShowMessageInputView() {
|
|
|
|
+ if (isAlive()) {
|
|
|
|
+ if (isReadOnlyConversation()
|
|
|
|
+ || shouldShowLobby()
|
|
|
|
+ || !hasChatPermission
|
|
|
|
+ ) {
|
|
|
|
+ binding.messageInputView.visibility = View.GONE
|
|
|
|
+ } else {
|
|
binding.messageInputView.visibility = View.VISIBLE
|
|
binding.messageInputView.visibility = View.VISIBLE
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -2350,7 +2367,7 @@ class ChatController(args: Bundle) :
|
|
super.onPrepareOptionsMenu(menu)
|
|
super.onPrepareOptionsMenu(menu)
|
|
conversationUser?.let {
|
|
conversationUser?.let {
|
|
if (CapabilitiesUtil.hasSpreedFeatureCapability(it, "read-only-rooms")) {
|
|
if (CapabilitiesUtil.hasSpreedFeatureCapability(it, "read-only-rooms")) {
|
|
- checkReadOnlyState()
|
|
|
|
|
|
+ checkShowCallButtons()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -2513,9 +2530,7 @@ class ChatController(args: Bundle) :
|
|
}
|
|
}
|
|
|
|
|
|
fun deleteMessage(message: IMessage?) {
|
|
fun deleteMessage(message: IMessage?) {
|
|
- if (!AttendeePermissionsUtil(currentConversation!!.permissions)
|
|
|
|
- .canPostChatShareItemsDoReaction(conversationUser!!)
|
|
|
|
- ) {
|
|
|
|
|
|
+ if (!hasChatPermission) {
|
|
Log.e(
|
|
Log.e(
|
|
TAG, "Deletion of message is skipped because of restrictions by permissions. " +
|
|
TAG, "Deletion of message is skipped because of restrictions by permissions. " +
|
|
"This method should not have been called!"
|
|
"This method should not have been called!"
|
|
@@ -2842,7 +2857,7 @@ class ChatController(args: Bundle) :
|
|
|
|
|
|
if (!CapabilitiesUtil.hasSpreedFeatureCapability(conversationUser, "delete-messages")) return false
|
|
if (!CapabilitiesUtil.hasSpreedFeatureCapability(conversationUser, "delete-messages")) return false
|
|
|
|
|
|
- if (AttendeePermissionsUtil(currentConversation!!.permissions).canPostChatShareItemsDoReaction(conversationUser)) return true
|
|
|
|
|
|
+ if (!hasChatPermission) return false
|
|
|
|
|
|
return true
|
|
return true
|
|
}
|
|
}
|