Add new_account_edit feature flag

This commit is contained in:
Wolf-Martell Montwé 2023-09-13 17:55:12 +02:00
parent bdce4ce5c0
commit f980caa48f
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
3 changed files with 15 additions and 3 deletions

View file

@ -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<FeatureFlag> {
return listOf(
// empty
FeatureFlag(FeatureFlagKey("new_account_edit"), false),
)
}
}

View file

@ -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>(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>(PREFERENCE_OUTGOING_SERVER)?.onClick {
AccountSetupOutgoing.actionEditOutgoingSettings(requireActivity(), accountUuid)
featureFlagProvider.provide("new_account_edit".toFeatureFlagKey())
.onEnabled { FeatureLauncherActivity.launchEditOutgoingSettings(requireActivity(), accountUuid) }
.onDisabled { AccountSetupOutgoing.actionEditOutgoingSettings(requireActivity(), accountUuid) }
}
}

View file

@ -2,3 +2,5 @@ package app.k9mail.core.featureflag
@JvmInline
value class FeatureFlagKey(val key: String)
fun String.toFeatureFlagKey(): FeatureFlagKey = FeatureFlagKey(this)