diff --git a/app/k9mail/src/main/java/com/fsck/k9/featureflag/InMemoryFeatureFlagFactory.kt b/app/k9mail/src/main/java/com/fsck/k9/featureflag/InMemoryFeatureFlagFactory.kt index 4d1a923cb..da37d4903 100644 --- a/app/k9mail/src/main/java/com/fsck/k9/featureflag/InMemoryFeatureFlagFactory.kt +++ b/app/k9mail/src/main/java/com/fsck/k9/featureflag/InMemoryFeatureFlagFactory.kt @@ -2,11 +2,12 @@ package com.fsck.k9.featureflag import app.k9mail.core.featureflag.FeatureFlag import app.k9mail.core.featureflag.FeatureFlagFactory +import app.k9mail.core.featureflag.FeatureFlagKey class InMemoryFeatureFlagFactory : FeatureFlagFactory { override fun createFeatureCatalog(): List { return listOf( - // empty + FeatureFlag(FeatureFlagKey("new_account_edit"), false), ) } } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsFragment.kt index fdc4d1ee5..dff2db9dc 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsFragment.kt @@ -13,6 +13,9 @@ import androidx.preference.ListPreference import androidx.preference.Preference import androidx.preference.PreferenceCategory import androidx.preference.SwitchPreference +import app.k9mail.core.featureflag.FeatureFlagProvider +import app.k9mail.core.featureflag.toFeatureFlagKey +import app.k9mail.feature.launcher.FeatureLauncherActivity import com.fsck.k9.Account import com.fsck.k9.account.BackgroundAccountRemover import com.fsck.k9.activity.ManageIdentities @@ -52,6 +55,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), ConfirmationDialogFr private val notificationChannelManager: NotificationChannelManager by inject() private val notificationSettingsUpdater: NotificationSettingsUpdater by inject() private val vibrator: Vibrator by inject() + private val featureFlagProvider: FeatureFlagProvider by inject() private lateinit var dataStore: AccountSettingsDataStore @@ -123,13 +127,16 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), ConfirmationDialogFr onDeleteAccount() true } + else -> super.onOptionsItemSelected(item) } } private fun initializeIncomingServer() { findPreference(PREFERENCE_INCOMING_SERVER)?.onClick { - AccountSetupIncoming.actionEditIncomingSettings(requireActivity(), accountUuid) + featureFlagProvider.provide("new_account_edit".toFeatureFlagKey()) + .onEnabled { FeatureLauncherActivity.launchEditIncomingSettings(requireActivity(), accountUuid) } + .onDisabled { AccountSetupIncoming.actionEditIncomingSettings(requireActivity(), accountUuid) } } } @@ -155,7 +162,9 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), ConfirmationDialogFr private fun initializeOutgoingServer() { findPreference(PREFERENCE_OUTGOING_SERVER)?.onClick { - AccountSetupOutgoing.actionEditOutgoingSettings(requireActivity(), accountUuid) + featureFlagProvider.provide("new_account_edit".toFeatureFlagKey()) + .onEnabled { FeatureLauncherActivity.launchEditOutgoingSettings(requireActivity(), accountUuid) } + .onDisabled { AccountSetupOutgoing.actionEditOutgoingSettings(requireActivity(), accountUuid) } } } diff --git a/core/featureflags/src/main/kotlin/app/k9mail/core/featureflag/FeatureFlagKey.kt b/core/featureflags/src/main/kotlin/app/k9mail/core/featureflag/FeatureFlagKey.kt index d7901d229..4e54b402d 100644 --- a/core/featureflags/src/main/kotlin/app/k9mail/core/featureflag/FeatureFlagKey.kt +++ b/core/featureflags/src/main/kotlin/app/k9mail/core/featureflag/FeatureFlagKey.kt @@ -2,3 +2,5 @@ package app.k9mail.core.featureflag @JvmInline value class FeatureFlagKey(val key: String) + +fun String.toFeatureFlagKey(): FeatureFlagKey = FeatureFlagKey(this)