Add new_account_edit feature flag
This commit is contained in:
parent
bdce4ce5c0
commit
f980caa48f
3 changed files with 15 additions and 3 deletions
|
@ -2,11 +2,12 @@ package com.fsck.k9.featureflag
|
||||||
|
|
||||||
import app.k9mail.core.featureflag.FeatureFlag
|
import app.k9mail.core.featureflag.FeatureFlag
|
||||||
import app.k9mail.core.featureflag.FeatureFlagFactory
|
import app.k9mail.core.featureflag.FeatureFlagFactory
|
||||||
|
import app.k9mail.core.featureflag.FeatureFlagKey
|
||||||
|
|
||||||
class InMemoryFeatureFlagFactory : FeatureFlagFactory {
|
class InMemoryFeatureFlagFactory : FeatureFlagFactory {
|
||||||
override fun createFeatureCatalog(): List<FeatureFlag> {
|
override fun createFeatureCatalog(): List<FeatureFlag> {
|
||||||
return listOf(
|
return listOf(
|
||||||
// empty
|
FeatureFlag(FeatureFlagKey("new_account_edit"), false),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,9 @@ import androidx.preference.ListPreference
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceCategory
|
import androidx.preference.PreferenceCategory
|
||||||
import androidx.preference.SwitchPreference
|
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
|
||||||
import com.fsck.k9.account.BackgroundAccountRemover
|
import com.fsck.k9.account.BackgroundAccountRemover
|
||||||
import com.fsck.k9.activity.ManageIdentities
|
import com.fsck.k9.activity.ManageIdentities
|
||||||
|
@ -52,6 +55,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), ConfirmationDialogFr
|
||||||
private val notificationChannelManager: NotificationChannelManager by inject()
|
private val notificationChannelManager: NotificationChannelManager by inject()
|
||||||
private val notificationSettingsUpdater: NotificationSettingsUpdater by inject()
|
private val notificationSettingsUpdater: NotificationSettingsUpdater by inject()
|
||||||
private val vibrator: Vibrator by inject()
|
private val vibrator: Vibrator by inject()
|
||||||
|
private val featureFlagProvider: FeatureFlagProvider by inject()
|
||||||
|
|
||||||
private lateinit var dataStore: AccountSettingsDataStore
|
private lateinit var dataStore: AccountSettingsDataStore
|
||||||
|
|
||||||
|
@ -123,13 +127,16 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), ConfirmationDialogFr
|
||||||
onDeleteAccount()
|
onDeleteAccount()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> super.onOptionsItemSelected(item)
|
else -> super.onOptionsItemSelected(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initializeIncomingServer() {
|
private fun initializeIncomingServer() {
|
||||||
findPreference<Preference>(PREFERENCE_INCOMING_SERVER)?.onClick {
|
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() {
|
private fun initializeOutgoingServer() {
|
||||||
findPreference<Preference>(PREFERENCE_OUTGOING_SERVER)?.onClick {
|
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) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,3 +2,5 @@ package app.k9mail.core.featureflag
|
||||||
|
|
||||||
@JvmInline
|
@JvmInline
|
||||||
value class FeatureFlagKey(val key: String)
|
value class FeatureFlagKey(val key: String)
|
||||||
|
|
||||||
|
fun String.toFeatureFlagKey(): FeatureFlagKey = FeatureFlagKey(this)
|
||||||
|
|
Loading…
Reference in a new issue