Add Notifications section in app settings

This commit is contained in:
yostyle 2023-08-08 15:22:49 +02:00
parent b326ca28cc
commit e8b80b9a55
4 changed files with 19 additions and 0 deletions

1
changelog.d/510.misc Normal file
View file

@ -0,0 +1 @@
Add a sub-screen "Notifications" in the existing application Settings

View file

@ -90,6 +90,10 @@ class PreferencesFlowNode @AssistedInject constructor(
override fun onOpenDeveloperSettings() {
backstack.push(NavTarget.DeveloperSettings)
}
override fun onOpenNotificationSettings() {
TODO("Not yet implemented")
}
}
createNode<PreferencesRootNode>(buildContext, plugins = listOf(callback))
}

View file

@ -44,6 +44,7 @@ class PreferencesRootNode @AssistedInject constructor(
fun onOpenAnalytics()
fun onOpenAbout()
fun onOpenDeveloperSettings()
fun onOpenNotificationSettings()
}
private fun onOpenBugReport() {
@ -72,6 +73,10 @@ class PreferencesRootNode @AssistedInject constructor(
}
}
private fun onOpenNotificationSettings() {
plugins<Callback>().forEach { it.onOpenNotificationSettings() }
}
@Composable
override fun View(modifier: Modifier) {
val state = presenter.present()
@ -87,6 +92,7 @@ class PreferencesRootNode @AssistedInject constructor(
onOpenDeveloperSettings = this::onOpenDeveloperSettings,
onSuccessLogout = { onSuccessLogout(activity, it) },
onManageAccountClicked = { onManageAccountClicked(activity, state.accountManagementUrl) },
onOpenNotificationSettings = this::onOpenNotificationSettings
)
}

View file

@ -24,6 +24,7 @@ import androidx.compose.material.icons.outlined.DeveloperMode
import androidx.compose.material.icons.outlined.Help
import androidx.compose.material.icons.outlined.InsertChart
import androidx.compose.material.icons.outlined.ManageAccounts
import androidx.compose.material.icons.outlined.Notifications
import androidx.compose.material.icons.outlined.VerifiedUser
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
@ -58,6 +59,7 @@ fun PreferencesRootView(
onOpenAbout: () -> Unit,
onOpenDeveloperSettings: () -> Unit,
onSuccessLogout: (String?) -> Unit,
onOpenNotificationSettings: () -> Unit,
modifier: Modifier = Modifier,
) {
val snackbarHostState = rememberSnackbarHostState(snackbarMessage = state.snackbarMessage)
@ -92,6 +94,11 @@ fun PreferencesRootView(
onClick = onOpenAnalytics,
)
}
PreferenceText(
title = "Notifications",
icon = Icons.Outlined.Notifications,
onClick = onOpenNotificationSettings,
)
PreferenceText(
title = stringResource(id = CommonStrings.action_report_bug),
icon = Icons.Outlined.BugReport,
@ -153,5 +160,6 @@ private fun ContentToPreview(matrixUser: MatrixUser) {
onVerifyClicked = {},
onSuccessLogout = {},
onManageAccountClicked = {},
onOpenNotificationSettings = {},
)
}