diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/chat/ContactPreferences.kt b/apps/android/app/src/main/java/chat/simplex/app/views/chat/ContactPreferences.kt index 81fde876f..1f7a6e74d 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/chat/ContactPreferences.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/chat/ContactPreferences.kt @@ -1,8 +1,8 @@ package chat.simplex.app.views.chat +import InfoRow import SectionDivider import SectionItemView -import SectionItemWithValue import SectionSpacer import SectionTextFooter import SectionView @@ -74,13 +74,11 @@ private fun ContactPreferencesLayout( FeatureSection(Feature.FullDelete, user.fullPreferences.fullDelete.allow, contact.mergedPreferences.fullDelete, allowFullDeletion) { applyPrefs(featuresAllowed.copy(fullDelete = it)) } - SectionSpacer() val allowVoice: MutableState = remember(featuresAllowed) { mutableStateOf(featuresAllowed.voice) } FeatureSection(Feature.Voice, user.fullPreferences.voice.allow, contact.mergedPreferences.voice, allowVoice) { applyPrefs(featuresAllowed.copy(voice = it)) } - SectionSpacer() ResetSaveButtons( reset = reset, @@ -119,13 +117,9 @@ private fun FeatureSection( ) } SectionDivider() - SectionItemWithValue( + InfoRow( generalGetString(R.string.chat_preferences_contact_allows), - remember { mutableStateOf(pref.contactPreference.allow) }, - listOf(ValueTitleDesc(pref.contactPreference.allow, pref.contactPreference.allow.text, "")), - icon = null, - enabled = remember { mutableStateOf(true) }, - onSelected = {} + pref.contactPreference.allow.text ) } SectionTextFooter(feature.enabledDescription(enabled)) @@ -134,11 +128,11 @@ private fun FeatureSection( @Composable private fun ResetSaveButtons(reset: () -> Unit, save: () -> Unit, disabled: Boolean) { SectionView { - SectionItemView(reset) { + SectionItemView(reset, disabled = disabled) { Text(stringResource(R.string.reset_verb), color = if (disabled) HighOrLowlight else MaterialTheme.colors.primary) } SectionDivider() - SectionItemView(save) { + SectionItemView(save, disabled = disabled) { Text(stringResource(R.string.save_and_notify_contact), color = if (disabled) HighOrLowlight else MaterialTheme.colors.primary) } } diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/chat/group/GroupPreferences.kt b/apps/android/app/src/main/java/chat/simplex/app/views/chat/group/GroupPreferences.kt index cbcb2d1c4..963dd5df1 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/chat/group/GroupPreferences.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/chat/group/GroupPreferences.kt @@ -1,8 +1,8 @@ package chat.simplex.app.views.chat.group +import InfoRow import SectionDivider import SectionItemView -import SectionItemWithValue import SectionSpacer import SectionTextFooter import SectionView @@ -64,19 +64,19 @@ private fun GroupPreferencesLayout( FeatureSection(Feature.FullDelete, allowFullDeletion, groupInfo) { applyPrefs(preferences.copy(fullDelete = GroupPreference(enable = it))) } - SectionSpacer() val allowVoice = remember(preferences) { mutableStateOf(preferences.voice.enable) } FeatureSection(Feature.Voice, allowVoice, groupInfo) { applyPrefs(preferences.copy(voice = GroupPreference(enable = it))) } - - SectionSpacer() - ResetSaveButtons( - reset = reset, - save = savePrefs, - disabled = preferences == currentPreferences - ) + if (groupInfo.canEdit) { + SectionSpacer() + ResetSaveButtons( + reset = reset, + save = savePrefs, + disabled = preferences == currentPreferences + ) + } } } @@ -94,13 +94,9 @@ private fun FeatureSection(feature: Feature, enableFeature: State Unit, save: () -> Unit, disabled: Boolean) { SectionView { - SectionItemView(reset) { + SectionItemView(reset, disabled = disabled) { Text(stringResource(R.string.reset_verb), color = if (disabled) HighOrLowlight else MaterialTheme.colors.primary) } SectionDivider() - SectionItemView(save) { + SectionItemView(save, disabled = disabled) { Text(stringResource(R.string.save_and_notify_group_members), color = if (disabled) HighOrLowlight else MaterialTheme.colors.primary) } } diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/Preferences.kt b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/Preferences.kt index 7a57a22b5..c27a56e77 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/Preferences.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/Preferences.kt @@ -65,13 +65,11 @@ private fun PreferencesLayout( FeatureSection(Feature.FullDelete, allowFullDeletion) { applyPrefs(preferences.copy(fullDelete = ChatPreference(allow = it))) } - SectionSpacer() val allowVoice = remember(preferences) { mutableStateOf(preferences.voice.allow) } FeatureSection(Feature.Voice, allowVoice) { applyPrefs(preferences.copy(voice = ChatPreference(allow = it))) } - SectionSpacer() ResetSaveButtons( reset = reset, @@ -100,11 +98,11 @@ private fun FeatureSection(feature: Feature, allowFeature: State @Composable private fun ResetSaveButtons(reset: () -> Unit, save: () -> Unit, disabled: Boolean) { SectionView { - SectionItemView(reset) { + SectionItemView(reset, disabled = disabled) { Text(stringResource(R.string.reset_verb), color = if (disabled) HighOrLowlight else MaterialTheme.colors.primary) } SectionDivider() - SectionItemView(save) { + SectionItemView(save, disabled = disabled) { Text(stringResource(R.string.save_and_notify_contacts), color = if (disabled) HighOrLowlight else MaterialTheme.colors.primary) } }