mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
mark conversation as important
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
62041d2581
commit
38482b8bb5
@ -1068,8 +1068,10 @@ class ConversationInfoActivity :
|
|||||||
|
|
||||||
binding.notificationSettingsView.importantConversationSwitch.isChecked = conversation!!.hasImportant
|
binding.notificationSettingsView.importantConversationSwitch.isChecked = conversation!!.hasImportant
|
||||||
|
|
||||||
binding.notificationSettingsView.importantConversationSwitch.setOnCheckedChangeListener { _, isChecked ->
|
binding.notificationSettingsView.notificationSettingsImportantConversation.setOnClickListener {
|
||||||
if (isChecked) {
|
val isChecked = binding.notificationSettingsView.importantConversationSwitch.isChecked
|
||||||
|
binding.notificationSettingsView.importantConversationSwitch.isChecked = !isChecked
|
||||||
|
if (!isChecked) {
|
||||||
viewModel.markConversationAsImportant(
|
viewModel.markConversationAsImportant(
|
||||||
credentials,
|
credentials,
|
||||||
conversationUser.baseUrl!!,
|
conversationUser.baseUrl!!,
|
||||||
@ -1820,13 +1822,6 @@ class ConversationInfoActivity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpNotificationSettings(module: DatabaseStorageModule) {
|
private fun setUpNotificationSettings(module: DatabaseStorageModule) {
|
||||||
// binding.notificationSettingsView.notificationSettingsImportantConversation.setOnClickListener {
|
|
||||||
// val isChecked = binding.notificationSettingsView.importantConversationSwitch.isChecked
|
|
||||||
// binding.notificationSettingsView.importantConversationSwitch.isChecked = !isChecked
|
|
||||||
// lifecycleScope.launch {
|
|
||||||
// module.saveBoolean("important_conversation_switch", !isChecked)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
binding.notificationSettingsView.notificationSettingsCallNotifications.setOnClickListener {
|
binding.notificationSettingsView.notificationSettingsCallNotifications.setOnClickListener {
|
||||||
val isChecked = binding.notificationSettingsView.callNotificationsSwitch.isChecked
|
val isChecked = binding.notificationSettingsView.callNotificationsSwitch.isChecked
|
||||||
binding.notificationSettingsView.callNotificationsSwitch.isChecked = !isChecked
|
binding.notificationSettingsView.callNotificationsSwitch.isChecked = !isChecked
|
||||||
@ -1844,9 +1839,6 @@ class ConversationInfoActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// binding.notificationSettingsView.importantConversationSwitch.isChecked = module
|
|
||||||
// .getBoolean("important_conversation_switch", false)
|
|
||||||
|
|
||||||
if (conversation!!.remoteServer.isNullOrEmpty()) {
|
if (conversation!!.remoteServer.isNullOrEmpty()) {
|
||||||
binding.notificationSettingsView.notificationSettingsCallNotifications.visibility = VISIBLE
|
binding.notificationSettingsView.notificationSettingsCallNotifications.visibility = VISIBLE
|
||||||
binding.notificationSettingsView.callNotificationsSwitch.isChecked = module
|
binding.notificationSettingsView.callNotificationsSwitch.isChecked = module
|
||||||
|
@ -384,7 +384,7 @@ class ConversationInfoViewModel @Inject constructor(
|
|||||||
fun markConversationAsUnimportant(credentials: String, baseUrl: String, roomToken: String) {
|
fun markConversationAsUnimportant(credentials: String, baseUrl: String, roomToken: String) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
try {
|
try {
|
||||||
val response = conversationsRepository.markConversationAsImportant(credentials, baseUrl, roomToken)
|
val response = conversationsRepository.markConversationAsUnImportant(credentials, baseUrl, roomToken)
|
||||||
_markConversationAsUnimportantResult.value =
|
_markConversationAsUnimportantResult.value =
|
||||||
MarkConversationAsUnimportantViewState.Success(response.ocs?.meta?.statusCode!!)
|
MarkConversationAsUnimportantViewState.Success(response.ocs?.meta?.statusCode!!)
|
||||||
} catch (exception: Exception) {
|
} catch (exception: Exception) {
|
||||||
|
@ -22,6 +22,7 @@ import com.nextcloud.talk.utils.ApiUtils
|
|||||||
import com.nextcloud.talk.utils.ApiUtils.getConversationApiVersion
|
import com.nextcloud.talk.utils.ApiUtils.getConversationApiVersion
|
||||||
import com.nextcloud.talk.utils.ApiUtils.getCredentials
|
import com.nextcloud.talk.utils.ApiUtils.getCredentials
|
||||||
import com.nextcloud.talk.utils.ApiUtils.getUrlForMessageExpiration
|
import com.nextcloud.talk.utils.ApiUtils.getUrlForMessageExpiration
|
||||||
|
import com.nextcloud.talk.utils.ApiUtils.getUrlForRoomNotificationCalls
|
||||||
import com.nextcloud.talk.utils.ApiUtils.getUrlForRoomNotificationLevel
|
import com.nextcloud.talk.utils.ApiUtils.getUrlForRoomNotificationLevel
|
||||||
import com.nextcloud.talk.utils.CapabilitiesUtil.hasSpreedFeatureCapability
|
import com.nextcloud.talk.utils.CapabilitiesUtil.hasSpreedFeatureCapability
|
||||||
import com.nextcloud.talk.utils.SpreedFeatures
|
import com.nextcloud.talk.utils.SpreedFeatures
|
||||||
@ -64,20 +65,20 @@ class DatabaseStorageModule(conversationUser: User, conversationToken: String) {
|
|||||||
|
|
||||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||||
suspend fun saveBoolean(key: String, value: Boolean) {
|
suspend fun saveBoolean(key: String, value: Boolean) {
|
||||||
// if ("call_notifications_switch" == key) {
|
if ("call_notifications_switch" == key) {
|
||||||
// val apiVersion = getConversationApiVersion(conversationUser, intArrayOf(ApiUtils.API_V4))
|
val apiVersion = getConversationApiVersion(conversationUser, intArrayOf(ApiUtils.API_V4))
|
||||||
// val url = getUrlForRoomNotificationCalls(apiVersion, conversationUser.baseUrl, conversationToken)
|
val url = getUrlForRoomNotificationCalls(apiVersion, conversationUser.baseUrl, conversationToken)
|
||||||
// val credentials = getCredentials(conversationUser.username, conversationUser.token)
|
val credentials = getCredentials(conversationUser.username, conversationUser.token)
|
||||||
// val notificationLevel = if (value) 1 else 0
|
val notificationLevel = if (value) 1 else 0
|
||||||
// withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
// try {
|
try {
|
||||||
// ncApiCoroutines!!.notificationCalls(credentials!!, url, notificationLevel)
|
ncApiCoroutines!!.notificationCalls(credentials!!, url, notificationLevel)
|
||||||
// Log.d(TAG, "Toggled notification calls")
|
Log.d(TAG, "Toggled notification calls")
|
||||||
// } catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
// Log.e(TAG, "Error when trying to toggle notification calls", e)
|
Log.e(TAG, "Error when trying to toggle notification calls", e)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
if ("lobby_switch" != key) {
|
if ("lobby_switch" != key) {
|
||||||
arbitraryStorageManager!!.storeStorageSetting(
|
arbitraryStorageManager!!.storeStorageSetting(
|
||||||
accountIdentifier,
|
accountIdentifier,
|
||||||
|
@ -46,7 +46,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/nc_important_conversation"
|
android:text="@string/nc_important_conversation"
|
||||||
android:textSize="@dimen/headline_text_size" />
|
android:textSize="@dimen/headline_text_size"
|
||||||
|
android:clickable="false"/>
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
Loading…
Reference in New Issue
Block a user