Move push history entry point from notification settings to developer settings.
Closes #5159
This commit is contained in:
parent
12ea2064c7
commit
a4373aeea4
5 changed files with 33 additions and 21 deletions
|
|
@ -167,7 +167,12 @@ class PreferencesFlowNode @AssistedInject constructor(
|
||||||
createNode<PreferencesRootNode>(buildContext, plugins = listOf(callback))
|
createNode<PreferencesRootNode>(buildContext, plugins = listOf(callback))
|
||||||
}
|
}
|
||||||
NavTarget.DeveloperSettings -> {
|
NavTarget.DeveloperSettings -> {
|
||||||
createNode<DeveloperSettingsNode>(buildContext)
|
val developerSettingsCallback = object : DeveloperSettingsNode.Callback {
|
||||||
|
override fun onPushHistoryClick() {
|
||||||
|
backstack.push(NavTarget.PushHistory)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
createNode<DeveloperSettingsNode>(buildContext, listOf(developerSettingsCallback))
|
||||||
}
|
}
|
||||||
NavTarget.About -> {
|
NavTarget.About -> {
|
||||||
val callback = object : AboutNode.Callback {
|
val callback = object : AboutNode.Callback {
|
||||||
|
|
@ -189,10 +194,6 @@ class PreferencesFlowNode @AssistedInject constructor(
|
||||||
override fun onTroubleshootNotificationsClick() {
|
override fun onTroubleshootNotificationsClick() {
|
||||||
backstack.push(NavTarget.TroubleshootNotifications)
|
backstack.push(NavTarget.TroubleshootNotifications)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPushHistoryClick() {
|
|
||||||
backstack.push(NavTarget.PushHistory)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
createNode<NotificationSettingsNode>(buildContext, listOf(notificationSettingsCallback))
|
createNode<NotificationSettingsNode>(buildContext, listOf(notificationSettingsCallback))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import com.airbnb.android.showkase.models.Showkase
|
||||||
import com.bumble.appyx.core.modality.BuildContext
|
import com.bumble.appyx.core.modality.BuildContext
|
||||||
import com.bumble.appyx.core.node.Node
|
import com.bumble.appyx.core.node.Node
|
||||||
import com.bumble.appyx.core.plugin.Plugin
|
import com.bumble.appyx.core.plugin.Plugin
|
||||||
|
import com.bumble.appyx.core.plugin.plugins
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedInject
|
import dagger.assisted.AssistedInject
|
||||||
import io.element.android.anvilannotations.ContributesNode
|
import io.element.android.anvilannotations.ContributesNode
|
||||||
|
|
@ -26,6 +27,16 @@ class DeveloperSettingsNode @AssistedInject constructor(
|
||||||
@Assisted plugins: List<Plugin>,
|
@Assisted plugins: List<Plugin>,
|
||||||
private val presenter: DeveloperSettingsPresenter,
|
private val presenter: DeveloperSettingsPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
|
interface Callback : Plugin {
|
||||||
|
fun onPushHistoryClick()
|
||||||
|
}
|
||||||
|
|
||||||
|
private val callbacks = plugins<Callback>()
|
||||||
|
|
||||||
|
private fun onPushHistoryClick() {
|
||||||
|
callbacks.forEach { it.onPushHistoryClick() }
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun View(modifier: Modifier) {
|
override fun View(modifier: Modifier) {
|
||||||
val activity = requireNotNull(LocalActivity.current)
|
val activity = requireNotNull(LocalActivity.current)
|
||||||
|
|
@ -39,6 +50,7 @@ class DeveloperSettingsNode @AssistedInject constructor(
|
||||||
state = state,
|
state = state,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
onOpenShowkase = ::openShowkase,
|
onOpenShowkase = ::openShowkase,
|
||||||
|
onPushHistoryClick = ::onPushHistoryClick,
|
||||||
onBackClick = ::navigateUp
|
onBackClick = ::navigateUp
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ import kotlinx.collections.immutable.toPersistentList
|
||||||
fun DeveloperSettingsView(
|
fun DeveloperSettingsView(
|
||||||
state: DeveloperSettingsState,
|
state: DeveloperSettingsState,
|
||||||
onOpenShowkase: () -> Unit,
|
onOpenShowkase: () -> Unit,
|
||||||
|
onPushHistoryClick: () -> Unit,
|
||||||
onBackClick: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
|
@ -57,6 +58,7 @@ fun DeveloperSettingsView(
|
||||||
) {
|
) {
|
||||||
FeatureListContent(state)
|
FeatureListContent(state)
|
||||||
}
|
}
|
||||||
|
NotificationCategory(onPushHistoryClick)
|
||||||
ElementCallCategory(state = state)
|
ElementCallCategory(state = state)
|
||||||
|
|
||||||
PreferenceCategory(title = "Rust SDK") {
|
PreferenceCategory(title = "Rust SDK") {
|
||||||
|
|
@ -159,6 +161,18 @@ private fun ElementCallCategory(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun NotificationCategory(onPushHistoryClick: () -> Unit) {
|
||||||
|
PreferenceCategory(title = stringResource(id = R.string.screen_notification_settings_title)) {
|
||||||
|
ListItem(
|
||||||
|
headlineContent = {
|
||||||
|
Text(stringResource(R.string.troubleshoot_notifications_entry_point_push_history_title))
|
||||||
|
},
|
||||||
|
onClick = onPushHistoryClick,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun FeatureListContent(
|
private fun FeatureListContent(
|
||||||
state: DeveloperSettingsState,
|
state: DeveloperSettingsState,
|
||||||
|
|
@ -179,6 +193,7 @@ internal fun DeveloperSettingsViewPreview(@PreviewParameter(DeveloperSettingsSta
|
||||||
DeveloperSettingsView(
|
DeveloperSettingsView(
|
||||||
state = state,
|
state = state,
|
||||||
onOpenShowkase = {},
|
onOpenShowkase = {},
|
||||||
|
onPushHistoryClick = {},
|
||||||
onBackClick = {}
|
onBackClick = {}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ class NotificationSettingsNode @AssistedInject constructor(
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun editDefaultNotificationMode(isOneToOne: Boolean)
|
fun editDefaultNotificationMode(isOneToOne: Boolean)
|
||||||
fun onTroubleshootNotificationsClick()
|
fun onTroubleshootNotificationsClick()
|
||||||
fun onPushHistoryClick()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val callbacks = plugins<Callback>()
|
private val callbacks = plugins<Callback>()
|
||||||
|
|
@ -40,10 +39,6 @@ class NotificationSettingsNode @AssistedInject constructor(
|
||||||
callbacks.forEach { it.onTroubleshootNotificationsClick() }
|
callbacks.forEach { it.onTroubleshootNotificationsClick() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onPushHistoryClick() {
|
|
||||||
callbacks.forEach { it.onPushHistoryClick() }
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun View(modifier: Modifier) {
|
override fun View(modifier: Modifier) {
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
|
|
@ -52,7 +47,6 @@ class NotificationSettingsNode @AssistedInject constructor(
|
||||||
onOpenEditDefault = { openEditDefault(isOneToOne = it) },
|
onOpenEditDefault = { openEditDefault(isOneToOne = it) },
|
||||||
onBackClick = ::navigateUp,
|
onBackClick = ::navigateUp,
|
||||||
onTroubleshootNotificationsClick = ::onTroubleshootNotificationsClick,
|
onTroubleshootNotificationsClick = ::onTroubleshootNotificationsClick,
|
||||||
onPushHistoryClick = ::onPushHistoryClick,
|
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@ fun NotificationSettingsView(
|
||||||
state: NotificationSettingsState,
|
state: NotificationSettingsState,
|
||||||
onOpenEditDefault: (isOneToOne: Boolean) -> Unit,
|
onOpenEditDefault: (isOneToOne: Boolean) -> Unit,
|
||||||
onTroubleshootNotificationsClick: () -> Unit,
|
onTroubleshootNotificationsClick: () -> Unit,
|
||||||
onPushHistoryClick: () -> Unit,
|
|
||||||
onBackClick: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
|
@ -84,7 +83,6 @@ fun NotificationSettingsView(
|
||||||
// onCallsNotificationsChanged = { state.eventSink(NotificationSettingsEvents.SetCallNotificationsEnabled(it)) },
|
// onCallsNotificationsChanged = { state.eventSink(NotificationSettingsEvents.SetCallNotificationsEnabled(it)) },
|
||||||
onInviteForMeNotificationsChange = { state.eventSink(NotificationSettingsEvents.SetInviteForMeNotificationsEnabled(it)) },
|
onInviteForMeNotificationsChange = { state.eventSink(NotificationSettingsEvents.SetInviteForMeNotificationsEnabled(it)) },
|
||||||
onTroubleshootNotificationsClick = onTroubleshootNotificationsClick,
|
onTroubleshootNotificationsClick = onTroubleshootNotificationsClick,
|
||||||
onPushHistoryClick = onPushHistoryClick,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
AsyncActionView(
|
AsyncActionView(
|
||||||
|
|
@ -108,7 +106,6 @@ private fun NotificationSettingsContentView(
|
||||||
// onCallsNotificationsChanged: (Boolean) -> Unit,
|
// onCallsNotificationsChanged: (Boolean) -> Unit,
|
||||||
onInviteForMeNotificationsChange: (Boolean) -> Unit,
|
onInviteForMeNotificationsChange: (Boolean) -> Unit,
|
||||||
onTroubleshootNotificationsClick: () -> Unit,
|
onTroubleshootNotificationsClick: () -> Unit,
|
||||||
onPushHistoryClick: () -> Unit,
|
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val systemSettings: NotificationSettingsState.AppSettings = state.appSettings
|
val systemSettings: NotificationSettingsState.AppSettings = state.appSettings
|
||||||
|
|
@ -207,12 +204,6 @@ private fun NotificationSettingsContentView(
|
||||||
},
|
},
|
||||||
onClick = onTroubleshootNotificationsClick
|
onClick = onTroubleshootNotificationsClick
|
||||||
)
|
)
|
||||||
ListItem(
|
|
||||||
headlineContent = {
|
|
||||||
Text(stringResource(R.string.troubleshoot_notifications_entry_point_push_history_title))
|
|
||||||
},
|
|
||||||
onClick = onPushHistoryClick
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
if (state.showAdvancedSettings) {
|
if (state.showAdvancedSettings) {
|
||||||
PreferenceCategory(title = stringResource(id = CommonStrings.common_advanced_settings)) {
|
PreferenceCategory(title = stringResource(id = CommonStrings.common_advanced_settings)) {
|
||||||
|
|
@ -313,6 +304,5 @@ internal fun NotificationSettingsViewPreview(@PreviewParameter(NotificationSetti
|
||||||
onBackClick = {},
|
onBackClick = {},
|
||||||
onOpenEditDefault = {},
|
onOpenEditDefault = {},
|
||||||
onTroubleshootNotificationsClick = {},
|
onTroubleshootNotificationsClick = {},
|
||||||
onPushHistoryClick = {},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue