Add Notifications section in app settings
This commit is contained in:
parent
7f50671a45
commit
25824ca614
4 changed files with 19 additions and 0 deletions
1
changelog.d/510.misc
Normal file
1
changelog.d/510.misc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Add a sub-screen "Notifications" in the existing application Settings
|
||||||
|
|
@ -90,6 +90,10 @@ class PreferencesFlowNode @AssistedInject constructor(
|
||||||
override fun onOpenDeveloperSettings() {
|
override fun onOpenDeveloperSettings() {
|
||||||
backstack.push(NavTarget.DeveloperSettings)
|
backstack.push(NavTarget.DeveloperSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onOpenNotificationSettings() {
|
||||||
|
TODO("Not yet implemented")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
createNode<PreferencesRootNode>(buildContext, plugins = listOf(callback))
|
createNode<PreferencesRootNode>(buildContext, plugins = listOf(callback))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ class PreferencesRootNode @AssistedInject constructor(
|
||||||
fun onOpenAnalytics()
|
fun onOpenAnalytics()
|
||||||
fun onOpenAbout()
|
fun onOpenAbout()
|
||||||
fun onOpenDeveloperSettings()
|
fun onOpenDeveloperSettings()
|
||||||
|
fun onOpenNotificationSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOpenBugReport() {
|
private fun onOpenBugReport() {
|
||||||
|
|
@ -72,6 +73,10 @@ class PreferencesRootNode @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun onOpenNotificationSettings() {
|
||||||
|
plugins<Callback>().forEach { it.onOpenNotificationSettings() }
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun View(modifier: Modifier) {
|
override fun View(modifier: Modifier) {
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
|
|
@ -87,6 +92,7 @@ class PreferencesRootNode @AssistedInject constructor(
|
||||||
onOpenDeveloperSettings = this::onOpenDeveloperSettings,
|
onOpenDeveloperSettings = this::onOpenDeveloperSettings,
|
||||||
onSuccessLogout = { onSuccessLogout(activity, it) },
|
onSuccessLogout = { onSuccessLogout(activity, it) },
|
||||||
onManageAccountClicked = { onManageAccountClicked(activity, state.accountManagementUrl) },
|
onManageAccountClicked = { onManageAccountClicked(activity, state.accountManagementUrl) },
|
||||||
|
onOpenNotificationSettings = this::onOpenNotificationSettings
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import androidx.compose.material.icons.outlined.DeveloperMode
|
||||||
import androidx.compose.material.icons.outlined.Help
|
import androidx.compose.material.icons.outlined.Help
|
||||||
import androidx.compose.material.icons.outlined.InsertChart
|
import androidx.compose.material.icons.outlined.InsertChart
|
||||||
import androidx.compose.material.icons.outlined.ManageAccounts
|
import androidx.compose.material.icons.outlined.ManageAccounts
|
||||||
|
import androidx.compose.material.icons.outlined.Notifications
|
||||||
import androidx.compose.material.icons.outlined.VerifiedUser
|
import androidx.compose.material.icons.outlined.VerifiedUser
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
|
@ -58,6 +59,7 @@ fun PreferencesRootView(
|
||||||
onOpenAbout: () -> Unit,
|
onOpenAbout: () -> Unit,
|
||||||
onOpenDeveloperSettings: () -> Unit,
|
onOpenDeveloperSettings: () -> Unit,
|
||||||
onSuccessLogout: (String?) -> Unit,
|
onSuccessLogout: (String?) -> Unit,
|
||||||
|
onOpenNotificationSettings: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val snackbarHostState = rememberSnackbarHostState(snackbarMessage = state.snackbarMessage)
|
val snackbarHostState = rememberSnackbarHostState(snackbarMessage = state.snackbarMessage)
|
||||||
|
|
@ -92,6 +94,11 @@ fun PreferencesRootView(
|
||||||
onClick = onOpenAnalytics,
|
onClick = onOpenAnalytics,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
PreferenceText(
|
||||||
|
title = "Notifications",
|
||||||
|
icon = Icons.Outlined.Notifications,
|
||||||
|
onClick = onOpenNotificationSettings,
|
||||||
|
)
|
||||||
PreferenceText(
|
PreferenceText(
|
||||||
title = stringResource(id = CommonStrings.action_report_bug),
|
title = stringResource(id = CommonStrings.action_report_bug),
|
||||||
icon = Icons.Outlined.BugReport,
|
icon = Icons.Outlined.BugReport,
|
||||||
|
|
@ -153,5 +160,6 @@ private fun ContentToPreview(matrixUser: MatrixUser) {
|
||||||
onVerifyClicked = {},
|
onVerifyClicked = {},
|
||||||
onSuccessLogout = {},
|
onSuccessLogout = {},
|
||||||
onManageAccountClicked = {},
|
onManageAccountClicked = {},
|
||||||
|
onOpenNotificationSettings = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue