Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import net.thunderbird.core.featureflag.FeatureFlag
import net.thunderbird.core.featureflag.FeatureFlagFactory
import net.thunderbird.core.featureflag.FeatureFlagKey
import net.thunderbird.core.featureflag.toFeatureFlagKey
import net.thunderbird.feature.account.settings.AccountSettingsFeatureFlags

class K9FeatureFlagFactory : FeatureFlagFactory {
override fun createFeatureCatalog(): List<FeatureFlag> {
Expand All @@ -20,6 +21,7 @@ class K9FeatureFlagFactory : FeatureFlagFactory {
FeatureFlag(FeatureFlagKey.UseNotificationSenderForSystemNotifications, enabled = false),
FeatureFlag(MessageListFeatureFlags.UseComposeForMessageListItems, enabled = false),
FeatureFlag(MessageViewFeatureFlags.ActionExportEml, enabled = true),
FeatureFlag(AccountSettingsFeatureFlags.EnableAvatarCustomization, enabled = false),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import net.thunderbird.core.featureflag.FeatureFlag
import net.thunderbird.core.featureflag.FeatureFlagFactory
import net.thunderbird.core.featureflag.FeatureFlagKey
import net.thunderbird.core.featureflag.toFeatureFlagKey
import net.thunderbird.feature.account.settings.AccountSettingsFeatureFlags

/**
* Feature flags for K-9 Mail (release)
*/

class K9FeatureFlagFactory : FeatureFlagFactory {
override fun createFeatureCatalog(): List<FeatureFlag> {
return listOf(
Expand All @@ -24,6 +24,7 @@ class K9FeatureFlagFactory : FeatureFlagFactory {
FeatureFlag(FeatureFlagKey.UseNotificationSenderForSystemNotifications, enabled = false),
FeatureFlag(MessageListFeatureFlags.UseComposeForMessageListItems, enabled = false),
FeatureFlag(MessageViewFeatureFlags.ActionExportEml, enabled = false),
FeatureFlag(AccountSettingsFeatureFlags.EnableAvatarCustomization, enabled = false),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import net.thunderbird.core.featureflag.FeatureFlag
import net.thunderbird.core.featureflag.FeatureFlagFactory
import net.thunderbird.core.featureflag.FeatureFlagKey
import net.thunderbird.core.featureflag.toFeatureFlagKey
import net.thunderbird.feature.account.settings.AccountSettingsFeatureFlags

/**
* Feature flags for Thunderbird Beta
Expand All @@ -23,6 +24,7 @@ class TbFeatureFlagFactory : FeatureFlagFactory {
FeatureFlag(FeatureFlagKey.UseNotificationSenderForSystemNotifications, enabled = false),
FeatureFlag(MessageListFeatureFlags.UseComposeForMessageListItems, enabled = false),
FeatureFlag(MessageViewFeatureFlags.ActionExportEml, enabled = false),
FeatureFlag(AccountSettingsFeatureFlags.EnableAvatarCustomization, enabled = false),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import net.thunderbird.core.featureflag.FeatureFlag
import net.thunderbird.core.featureflag.FeatureFlagFactory
import net.thunderbird.core.featureflag.FeatureFlagKey
import net.thunderbird.core.featureflag.toFeatureFlagKey
import net.thunderbird.feature.account.settings.AccountSettingsFeatureFlags

/**
* Feature flags for Thunderbird Daily
Expand All @@ -23,6 +24,7 @@ class TbFeatureFlagFactory : FeatureFlagFactory {
FeatureFlag(FeatureFlagKey.UseNotificationSenderForSystemNotifications, enabled = false),
FeatureFlag(MessageListFeatureFlags.UseComposeForMessageListItems, enabled = false),
FeatureFlag(MessageViewFeatureFlags.ActionExportEml, enabled = true),
FeatureFlag(AccountSettingsFeatureFlags.EnableAvatarCustomization, enabled = false),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import net.thunderbird.core.featureflag.FeatureFlag
import net.thunderbird.core.featureflag.FeatureFlagFactory
import net.thunderbird.core.featureflag.FeatureFlagKey
import net.thunderbird.core.featureflag.toFeatureFlagKey
import net.thunderbird.feature.account.settings.AccountSettingsFeatureFlags

/**
* Feature flags for Thunderbird Debug
Expand All @@ -23,6 +24,7 @@ class TbFeatureFlagFactory : FeatureFlagFactory {
FeatureFlag(FeatureFlagKey.UseNotificationSenderForSystemNotifications, enabled = true),
FeatureFlag(MessageListFeatureFlags.UseComposeForMessageListItems, enabled = false),
FeatureFlag(MessageViewFeatureFlags.ActionExportEml, enabled = true),
FeatureFlag(AccountSettingsFeatureFlags.EnableAvatarCustomization, enabled = false),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import net.thunderbird.core.featureflag.FeatureFlag
import net.thunderbird.core.featureflag.FeatureFlagFactory
import net.thunderbird.core.featureflag.FeatureFlagKey
import net.thunderbird.core.featureflag.toFeatureFlagKey
import net.thunderbird.feature.account.settings.AccountSettingsFeatureFlags

/**
* Feature flags for Thunderbird (release)
Expand All @@ -23,6 +24,7 @@ class TbFeatureFlagFactory : FeatureFlagFactory {
FeatureFlag(FeatureFlagKey.UseNotificationSenderForSystemNotifications, enabled = false),
FeatureFlag(MessageListFeatureFlags.UseComposeForMessageListItems, enabled = false),
FeatureFlag(MessageViewFeatureFlags.ActionExportEml, enabled = false),
FeatureFlag(AccountSettingsFeatureFlags.EnableAvatarCustomization, enabled = false),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,24 @@ sealed interface SettingValue<T> : Setting {
* @param value The currently selected option.
* @param options The list of available options to choose from.
*/
data class CompactSelectSingleOption(
data class CompactSelectSingleOption<T>(
override val id: String,
val title: () -> String,
val description: () -> String? = { null },
override val value: CompactOption,
val options: ImmutableList<CompactOption>,
) : SettingValue<CompactOption> {
override val value: CompactOption<T>,
val options: ImmutableList<CompactOption<T>>,
) : SettingValue<CompactOption<T>> {
override val requiresEditView: Boolean = false

init {
require(options.size >= 2) { "There must be at least two options." }
require(options.size <= 4) { "There can be at most four options." }
}

data class CompactOption(
data class CompactOption<T>(
val id: String,
val title: () -> String,
val value: T,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ internal object FakeSettingData {
)

private val compactOptions = persistentListOf(
CompactOption("1") { "Choice 1" },
CompactOption("2") { "Choice 2" },
CompactOption("3") { "Choice 3" },
CompactOption(id = "1", title = { "Option 1" }, value = "1"),
CompactOption(id = "2", title = { "Option 2" }, value = "2"),
CompactOption(id = "3", title = { "Option 3" }, value = "3"),
)

val compactSelectSingleOption = SettingValue.CompactSelectSingleOption(
Expand All @@ -44,12 +44,12 @@ internal object FakeSettingData {
)

private val options = persistentListOf(
Option("1") { "Compact Choice 1" },
Option("2") { "Compact Choice 2" },
Option("3") { "Compact Choice 3" },
Option("1") { "Compact Choice 4" },
Option("2") { "Compact Choice 5" },
Option("3") { "Compact Choice 6" },
Option("1") { "Option 1" },
Option("2") { "Option 2" },
Option("3") { "Option 3" },
Option("4") { "Option 4" },
Option("5") { "Option 5" },
Option("6") { "Option 6" },
)

val selectSingleOption = SettingValue.SelectSingleOption(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ internal fun SettingDialog(
}

// No dialog needed
is SettingValue.CompactSelectSingleOption, is SettingValue.Switch -> Unit
is SettingValue.CompactSelectSingleOption<*>, is SettingValue.Switch -> Unit
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private fun RenderSettingValue(
)
}

is SettingValue.CompactSelectSingleOption -> {
is SettingValue.CompactSelectSingleOption<*> -> {
CompactSelectSingleOptionItem(
setting = setting,
onSettingValueChange = onSettingValueChange,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import app.k9mail.core.ui.compose.theme2.MainTheme
import net.thunderbird.core.ui.setting.SettingValue

@Composable
internal fun CompactSelectSingleOptionItem(
setting: SettingValue.CompactSelectSingleOption,
internal fun <T> CompactSelectSingleOptionItem(
setting: SettingValue.CompactSelectSingleOption<T>,
onSettingValueChange: (SettingValue<*>) -> Unit,
modifier: Modifier = Modifier,
) {
Expand Down
1 change: 1 addition & 0 deletions feature/account/settings/api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ android {

dependencies {
implementation(projects.core.ui.compose.navigation)
implementation(projects.core.featureflag)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package net.thunderbird.feature.account.settings

import net.thunderbird.core.featureflag.FeatureFlagKey

object AccountSettingsFeatureFlags {

/**
* Feature flag to enable avatar customization in account settings.
*/
val EnableAvatarCustomization = FeatureFlagKey("enable_avatar_customization")
}
3 changes: 3 additions & 0 deletions feature/account/settings/impl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ android {
}

dependencies {
api(projects.feature.account.api)
api(projects.feature.account.settings.api)
implementation(projects.feature.account.core)
implementation(projects.feature.account.avatar.api)
implementation(projects.feature.account.avatar.impl)

implementation(projects.core.featureflag)
implementation(projects.core.outcome)

implementation(projects.core.ui.setting.api)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ val featureAccountSettingsModule = module {
GetGeneralSettings(
repository = get(),
resourceProvider = get(),
monogramCreator = get(),
featureFlagProvider = get(),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ internal interface AccountSettingsDomainContract {
color: Int,
): @Composable (Modifier) -> Unit

val profileIndicatorTitle: () -> String
val profileIndicatorMonogram: () -> String
val profileIndicatorImage: () -> String
val profileIndicatorIcon: () -> String

val nameTitle: () -> String
val nameDescription: () -> String?
val nameIcon: () -> ImageVector?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ package net.thunderbird.feature.account.settings.impl.domain.entity

import net.thunderbird.feature.account.AccountId

/**
* General preferences that can be set for an account.
*/
internal enum class GeneralPreference {
PROFILE,
PROFILE_INDICATOR,
NAME,
COLOR,
}
Expand Down
Loading
Loading