|
@@ -257,6 +257,18 @@ class ConversationInfoActivity :
|
|
|
else -> {}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ viewModel.getConversationReadOnlyState.observe(this) { state ->
|
|
|
+ when (state) {
|
|
|
+ is ConversationInfoViewModel.SetConversationReadOnlySuccessState -> {
|
|
|
+ }
|
|
|
+ is ConversationInfoViewModel.SetConversationReadOnlyErrorState -> {
|
|
|
+ Snackbar.make(binding.root, R.string.conversation_read_only_failed, Snackbar.LENGTH_LONG).show()
|
|
|
+ }
|
|
|
+ else -> {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private fun setupActionBar() {
|
|
@@ -658,6 +670,7 @@ class ConversationInfoActivity :
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
|
|
startActivity(intent)
|
|
|
}
|
|
|
+
|
|
|
WorkInfo.State.FAILED -> {
|
|
|
val errorType = workInfo.outputData.getString("error_type")
|
|
|
if (errorType == LeaveConversationWorker.ERROR_NO_OTHER_MODERATORS_OR_OWNERS_LEFT) {
|
|
@@ -674,6 +687,7 @@ class ConversationInfoActivity :
|
|
|
).show()
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
else -> {
|
|
|
}
|
|
|
}
|
|
@@ -826,6 +840,20 @@ class ConversationInfoActivity :
|
|
|
binding.archiveConversationText.text = resources.getString(R.string.archive_conversation)
|
|
|
binding.archiveConversationTextHint.text = resources.getString(R.string.archive_hint)
|
|
|
}
|
|
|
+ if (ConversationUtils.isConversationReadOnlyAvailable(conversationCopy, spreedCapabilities)) {
|
|
|
+ binding.lockConversation.visibility = VISIBLE
|
|
|
+ binding.lockConversationSwitch.isChecked = databaseStorageModule!!.getBoolean("lock_switch", false)
|
|
|
+
|
|
|
+ binding.lockConversation.setOnClickListener {
|
|
|
+ val isLocked = binding.lockConversationSwitch.isChecked
|
|
|
+ binding.lockConversationSwitch.isChecked = !isLocked
|
|
|
+ databaseStorageModule!!.saveBoolean("lock_switch", !isLocked)
|
|
|
+ val state = if (isLocked) 0 else 1
|
|
|
+ makeConversationReadOnly(conversationUser, conversationToken, state)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ binding.lockConversation.visibility = GONE
|
|
|
+ }
|
|
|
|
|
|
if (!isDestroyed) {
|
|
|
binding.dangerZoneOptions.visibility = VISIBLE
|
|
@@ -899,6 +927,10 @@ class ConversationInfoActivity :
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private fun makeConversationReadOnly(conversationUser: User, roomToken: String, state: Int) {
|
|
|
+ viewModel.setConversationReadOnly(conversationUser, roomToken, state)
|
|
|
+ }
|
|
|
+
|
|
|
private fun initRecordingConsentOption() {
|
|
|
fun hide() {
|
|
|
binding.recordingConsentView.recordingConsentSettingsCategory.visibility = GONE
|
|
@@ -1296,7 +1328,7 @@ class ConversationInfoActivity :
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @SuppressLint("CheckResult")
|
|
|
+ @SuppressLint("CheckResult", "StringFormatInvalid")
|
|
|
override fun onItemClick(view: View?, position: Int): Boolean {
|
|
|
if (!ConversationUtils.canModerate(conversation!!, spreedCapabilities)) {
|
|
|
return true
|