Refactoring
This commit is contained in:
parent
175ccd95b2
commit
fdea1913cc
4 changed files with 46 additions and 4 deletions
|
|
@ -33,6 +33,7 @@ import io.element.android.features.preferences.api.PreferencesEntryPoint
|
||||||
import io.element.android.features.preferences.impl.about.AboutNode
|
import io.element.android.features.preferences.impl.about.AboutNode
|
||||||
import io.element.android.features.preferences.impl.analytics.AnalyticsSettingsNode
|
import io.element.android.features.preferences.impl.analytics.AnalyticsSettingsNode
|
||||||
import io.element.android.features.preferences.impl.developer.DeveloperSettingsNode
|
import io.element.android.features.preferences.impl.developer.DeveloperSettingsNode
|
||||||
|
import io.element.android.features.preferences.impl.notifications.NotificationsSettingsNode
|
||||||
import io.element.android.features.preferences.impl.root.PreferencesRootNode
|
import io.element.android.features.preferences.impl.root.PreferencesRootNode
|
||||||
import io.element.android.libraries.architecture.BackstackNode
|
import io.element.android.libraries.architecture.BackstackNode
|
||||||
import io.element.android.libraries.architecture.animation.rememberDefaultTransitionHandler
|
import io.element.android.libraries.architecture.animation.rememberDefaultTransitionHandler
|
||||||
|
|
@ -65,6 +66,9 @@ class PreferencesFlowNode @AssistedInject constructor(
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
object About : NavTarget
|
object About : NavTarget
|
||||||
|
|
||||||
|
@Parcelize
|
||||||
|
object NotificationsSettings : NavTarget
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {
|
override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {
|
||||||
|
|
@ -91,8 +95,8 @@ class PreferencesFlowNode @AssistedInject constructor(
|
||||||
backstack.push(NavTarget.DeveloperSettings)
|
backstack.push(NavTarget.DeveloperSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenNotificationSettings() {
|
override fun onOpenNotificationsSettings() {
|
||||||
TODO("Not yet implemented")
|
backstack.push(NavTarget.NotificationsSettings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
createNode<PreferencesRootNode>(buildContext, plugins = listOf(callback))
|
createNode<PreferencesRootNode>(buildContext, plugins = listOf(callback))
|
||||||
|
|
@ -106,6 +110,9 @@ class PreferencesFlowNode @AssistedInject constructor(
|
||||||
NavTarget.AnalyticsSettings -> {
|
NavTarget.AnalyticsSettings -> {
|
||||||
createNode<AnalyticsSettingsNode>(buildContext)
|
createNode<AnalyticsSettingsNode>(buildContext)
|
||||||
}
|
}
|
||||||
|
NavTarget.NotificationsSettings -> {
|
||||||
|
createNode<NotificationsSettingsNode>(buildContext)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.element.android.features.preferences.impl.notifications
|
||||||
|
|
||||||
|
import com.bumble.appyx.core.modality.BuildContext
|
||||||
|
import com.bumble.appyx.core.node.Node
|
||||||
|
import com.bumble.appyx.core.plugin.Plugin
|
||||||
|
import dagger.assisted.Assisted
|
||||||
|
import dagger.assisted.AssistedInject
|
||||||
|
import io.element.android.anvilannotations.ContributesNode
|
||||||
|
import io.element.android.features.preferences.impl.developer.DeveloperSettingsPresenter
|
||||||
|
import io.element.android.libraries.di.SessionScope
|
||||||
|
|
||||||
|
@ContributesNode(SessionScope::class)
|
||||||
|
class NotificationsSettingsNode @AssistedInject constructor(
|
||||||
|
@Assisted buildContext: BuildContext,
|
||||||
|
@Assisted plugins: List<Plugin>,
|
||||||
|
private val presenter: DeveloperSettingsPresenter,
|
||||||
|
) : Node(buildContext, plugins = plugins) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -44,7 +44,7 @@ class PreferencesRootNode @AssistedInject constructor(
|
||||||
fun onOpenAnalytics()
|
fun onOpenAnalytics()
|
||||||
fun onOpenAbout()
|
fun onOpenAbout()
|
||||||
fun onOpenDeveloperSettings()
|
fun onOpenDeveloperSettings()
|
||||||
fun onOpenNotificationSettings()
|
fun onOpenNotificationsSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOpenBugReport() {
|
private fun onOpenBugReport() {
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ fun PreferencesRootView(
|
||||||
PreferenceText(
|
PreferenceText(
|
||||||
title = stringResource(id = CommonStrings.screen_notification_settings_title),
|
title = stringResource(id = CommonStrings.screen_notification_settings_title),
|
||||||
icon = Icons.Outlined.Notifications,
|
icon = Icons.Outlined.Notifications,
|
||||||
onClick = onOpenNotificationSettings,
|
onClick = onOpenNotificationsSettings,
|
||||||
)
|
)
|
||||||
PreferenceText(
|
PreferenceText(
|
||||||
title = stringResource(id = CommonStrings.action_report_bug),
|
title = stringResource(id = CommonStrings.action_report_bug),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue