Refactoring
This commit is contained in:
@@ -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.analytics.AnalyticsSettingsNode
|
||||
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.libraries.architecture.BackstackNode
|
||||
import io.element.android.libraries.architecture.animation.rememberDefaultTransitionHandler
|
||||
@@ -65,6 +66,9 @@ class PreferencesFlowNode @AssistedInject constructor(
|
||||
|
||||
@Parcelize
|
||||
object About : NavTarget
|
||||
|
||||
@Parcelize
|
||||
object NotificationsSettings : NavTarget
|
||||
}
|
||||
|
||||
override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {
|
||||
@@ -91,8 +95,8 @@ class PreferencesFlowNode @AssistedInject constructor(
|
||||
backstack.push(NavTarget.DeveloperSettings)
|
||||
}
|
||||
|
||||
override fun onOpenNotificationSettings() {
|
||||
TODO("Not yet implemented")
|
||||
override fun onOpenNotificationsSettings() {
|
||||
backstack.push(NavTarget.NotificationsSettings)
|
||||
}
|
||||
}
|
||||
createNode<PreferencesRootNode>(buildContext, plugins = listOf(callback))
|
||||
@@ -106,6 +110,9 @@ class PreferencesFlowNode @AssistedInject constructor(
|
||||
NavTarget.AnalyticsSettings -> {
|
||||
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 onOpenAbout()
|
||||
fun onOpenDeveloperSettings()
|
||||
fun onOpenNotificationSettings()
|
||||
fun onOpenNotificationsSettings()
|
||||
}
|
||||
|
||||
private fun onOpenBugReport() {
|
||||
|
||||
@@ -97,7 +97,7 @@ fun PreferencesRootView(
|
||||
PreferenceText(
|
||||
title = stringResource(id = CommonStrings.screen_notification_settings_title),
|
||||
icon = Icons.Outlined.Notifications,
|
||||
onClick = onOpenNotificationSettings,
|
||||
onClick = onOpenNotificationsSettings,
|
||||
)
|
||||
PreferenceText(
|
||||
title = stringResource(id = CommonStrings.action_report_bug),
|
||||
|
||||
Reference in New Issue
Block a user