Skip to content

Commit

Permalink
fix: missing verification for analytics toggle (WPB-10587) (#3378)
Browse files Browse the repository at this point in the history
Signed-off-by: alexandreferris <[email protected]>
  • Loading branch information
alexandreferris authored and github-actions[bot] committed Aug 27, 2024
1 parent ea42d47 commit be5fe6f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -51,6 +50,7 @@ fun PrivacySettingsConfigScreen(
with(viewModel) {
PrivacySettingsScreenContent(
isAnonymousUsageDataEnabled = state.isAnalyticsUsageEnabled,
shouldShowAnalyticsUsage = state.shouldShowAnalyticsUsage,
areReadReceiptsEnabled = state.areReadReceiptsEnabled,
setReadReceiptsState = ::setReadReceiptsState,
isTypingIndicatorEnabled = state.isTypingIndicatorEnabled,
Expand All @@ -66,6 +66,7 @@ fun PrivacySettingsConfigScreen(
@Composable
fun PrivacySettingsScreenContent(
isAnonymousUsageDataEnabled: Boolean,
shouldShowAnalyticsUsage: Boolean,
areReadReceiptsEnabled: Boolean,
setReadReceiptsState: (Boolean) -> Unit,
isTypingIndicatorEnabled: Boolean,
Expand All @@ -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),
Expand Down Expand Up @@ -143,6 +144,7 @@ fun PrivacySettingsScreenContent(
fun PreviewSendReadReceipts() = WireTheme {
PrivacySettingsScreenContent(
isAnonymousUsageDataEnabled = true,
shouldShowAnalyticsUsage = true,
areReadReceiptsEnabled = true,
setReadReceiptsState = {},
isTypingIndicatorEnabled = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down

0 comments on commit be5fe6f

Please sign in to comment.