From 1a8c31f42982c45d3e9422582b8b8a742a868c5c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 11:37:35 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20missing=20verification=20for=20analytics?= =?UTF-8?q?=20toggle=20(WPB-10587)=20=F0=9F=8D=92=20(#3379)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: alexandreferris Co-authored-by: Alexandre Ferris --- .../ui/home/settings/privacy/PrivacySettingsScreen.kt | 6 ++++-- .../ui/home/settings/privacy/PrivacySettingsViewModel.kt | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsScreen.kt b/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsScreen.kt index 974812ddc5d..e1e791b2046 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsScreen.kt @@ -26,7 +26,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.hilt.navigation.compose.hiltViewModel import com.ramcosta.composedestinations.annotation.RootNavGraph -import com.wire.android.BuildConfig import com.wire.android.R import com.wire.android.navigation.Navigator import com.wire.android.ui.common.colorsScheme @@ -51,6 +50,7 @@ fun PrivacySettingsConfigScreen( with(viewModel) { PrivacySettingsScreenContent( isAnonymousUsageDataEnabled = state.isAnalyticsUsageEnabled, + shouldShowAnalyticsUsage = state.shouldShowAnalyticsUsage, areReadReceiptsEnabled = state.areReadReceiptsEnabled, setReadReceiptsState = ::setReadReceiptsState, isTypingIndicatorEnabled = state.isTypingIndicatorEnabled, @@ -66,6 +66,7 @@ fun PrivacySettingsConfigScreen( @Composable fun PrivacySettingsScreenContent( isAnonymousUsageDataEnabled: Boolean, + shouldShowAnalyticsUsage: Boolean, areReadReceiptsEnabled: Boolean, setReadReceiptsState: (Boolean) -> Unit, isTypingIndicatorEnabled: Boolean, @@ -91,7 +92,7 @@ fun PrivacySettingsScreenContent( .fillMaxSize() .padding(internalPadding) ) { - if (BuildConfig.ANALYTICS_ENABLED) { + if (shouldShowAnalyticsUsage) { GroupConversationOptionsItem( title = stringResource(id = R.string.settings_send_anonymous_usage_data_title), switchState = SwitchState.Enabled(value = isAnonymousUsageDataEnabled, onCheckedChange = setAnonymousUsageDataEnabled), @@ -143,6 +144,7 @@ fun PrivacySettingsScreenContent( fun PreviewSendReadReceipts() = WireTheme { PrivacySettingsScreenContent( isAnonymousUsageDataEnabled = true, + shouldShowAnalyticsUsage = true, areReadReceiptsEnabled = true, setReadReceiptsState = {}, isTypingIndicatorEnabled = true, diff --git a/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsViewModel.kt index 4c9b5abb94e..dca52c5c24e 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsViewModel.kt @@ -90,6 +90,7 @@ class PrivacySettingsViewModel @Inject constructor( } viewModelScope.launch { + // TODO(Analytics): To be changed with UseCase val isAnalyticsConfigurationEnabled = analyticsEnabled is AnalyticsConfiguration.Enabled val isValidBackend = when (val serverConfig = selfServerConfig()) { is SelfServerConfigUseCase.Result.Success ->