Hide Notification Settings with feature flag and lint
- Hide Notification Settings with feature flag - lint
This commit is contained in:
parent
5e2ec8b504
commit
171f6db338
6 changed files with 22 additions and 12 deletions
|
|
@ -69,7 +69,7 @@ class PreferencesFlowNode @AssistedInject constructor(
|
|||
data object About : NavTarget
|
||||
|
||||
@Parcelize
|
||||
object NotificationSettings : NavTarget
|
||||
data object NotificationSettings : NavTarget
|
||||
}
|
||||
|
||||
override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {
|
||||
|
|
|
|||
|
|
@ -55,10 +55,9 @@ fun NotificationSettingsView(
|
|||
}
|
||||
|
||||
PreferenceSwitch(
|
||||
modifier = modifier,
|
||||
modifier = Modifier,
|
||||
title = stringResource(id = CommonStrings.screen_notification_settings_enable_notifications),
|
||||
isChecked = state.isEnabled,
|
||||
// onCheckedChange = ::onEnabledChanged,
|
||||
switchAlignment = Alignment.Top,
|
||||
)
|
||||
|
||||
|
|
@ -77,20 +76,18 @@ fun NotificationSettingsView(
|
|||
|
||||
PreferenceCategory(title = stringResource(id = CommonStrings.screen_notification_settings_mode_mentions)) {
|
||||
PreferenceSwitch(
|
||||
modifier = modifier,
|
||||
modifier = Modifier,
|
||||
title = stringResource(id = CommonStrings.screen_notification_settings_room_mention_label),
|
||||
isChecked = state.notifyMeOnRoom,
|
||||
// onCheckedChange = ::onEnabledChanged,
|
||||
switchAlignment = Alignment.Top,
|
||||
)
|
||||
}
|
||||
|
||||
PreferenceCategory(title = stringResource(id = CommonStrings.screen_notification_settings_additional_settings_section_title)) {
|
||||
PreferenceSwitch(
|
||||
modifier = modifier,
|
||||
modifier = Modifier,
|
||||
title = stringResource(id = CommonStrings.screen_notification_settings_calls_label),
|
||||
isChecked = state.acceptCalls,
|
||||
// onCheckedChange = ::onEnabledChanged,
|
||||
switchAlignment = Alignment.Top,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ import io.element.android.libraries.architecture.Presenter
|
|||
import io.element.android.libraries.core.meta.BuildType
|
||||
import io.element.android.libraries.designsystem.utils.SnackbarDispatcher
|
||||
import io.element.android.libraries.designsystem.utils.collectSnackbarMessageAsState
|
||||
import io.element.android.libraries.featureflag.api.FeatureFlagService
|
||||
import io.element.android.libraries.featureflag.api.FeatureFlags
|
||||
import io.element.android.libraries.matrix.api.MatrixClient
|
||||
import io.element.android.libraries.matrix.api.user.MatrixUser
|
||||
import io.element.android.libraries.matrix.api.user.getCurrentUser
|
||||
|
|
@ -46,6 +48,7 @@ class PreferencesRootPresenter @Inject constructor(
|
|||
private val buildType: BuildType,
|
||||
private val versionFormatter: VersionFormatter,
|
||||
private val snackbarDispatcher: SnackbarDispatcher,
|
||||
private val featureFlagService: FeatureFlagService,
|
||||
) : Presenter<PreferencesRootState> {
|
||||
|
||||
@Composable
|
||||
|
|
@ -60,6 +63,11 @@ class PreferencesRootPresenter @Inject constructor(
|
|||
val snackbarMessage by snackbarDispatcher.collectSnackbarMessageAsState()
|
||||
val hasAnalyticsProviders = remember { analyticsService.getAvailableAnalyticsProviders().isNotEmpty() }
|
||||
|
||||
val showNotificationSettings = remember { mutableStateOf(false) }
|
||||
LaunchedEffect(Unit) {
|
||||
showNotificationSettings.value = featureFlagService.isFeatureEnabled(FeatureFlags.NotificationSettings)
|
||||
}
|
||||
|
||||
// We should display the 'complete verification' option if the current session can be verified
|
||||
val showCompleteVerification by sessionVerificationService.canVerifySessionFlow.collectAsState(false)
|
||||
|
||||
|
|
@ -81,6 +89,7 @@ class PreferencesRootPresenter @Inject constructor(
|
|||
accountManagementUrl = accountManagementUrl.value,
|
||||
showAnalyticsSettings = hasAnalyticsProviders,
|
||||
showDeveloperSettings = showDeveloperSettings,
|
||||
showNotificationSettings = showNotificationSettings.value,
|
||||
snackbarMessage = snackbarMessage,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,5 +28,6 @@ data class PreferencesRootState(
|
|||
val accountManagementUrl: String?,
|
||||
val showAnalyticsSettings: Boolean,
|
||||
val showDeveloperSettings: Boolean,
|
||||
val showNotificationSettings: Boolean,
|
||||
val snackbarMessage: SnackbarMessage?,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -28,5 +28,6 @@ fun aPreferencesRootState() = PreferencesRootState(
|
|||
accountManagementUrl = "aUrl",
|
||||
showAnalyticsSettings = true,
|
||||
showDeveloperSettings = true,
|
||||
showNotificationSettings = true,
|
||||
snackbarMessage = SnackbarMessage(CommonStrings.common_verification_complete),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -94,11 +94,13 @@ fun PreferencesRootView(
|
|||
onClick = onOpenAnalytics,
|
||||
)
|
||||
}
|
||||
PreferenceText(
|
||||
title = stringResource(id = CommonStrings.screen_notification_settings_title),
|
||||
icon = Icons.Outlined.Notifications,
|
||||
onClick = onOpenNotificationSettings,
|
||||
)
|
||||
if(state.showNotificationSettings) {
|
||||
PreferenceText(
|
||||
title = stringResource(id = CommonStrings.screen_notification_settings_title),
|
||||
icon = Icons.Outlined.Notifications,
|
||||
onClick = onOpenNotificationSettings,
|
||||
)
|
||||
}
|
||||
PreferenceText(
|
||||
title = stringResource(id = CommonStrings.action_report_bug),
|
||||
icon = Icons.Outlined.BugReport,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue