Loading app-common/build.gradle.kts +2 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ dependencies { implementation(projects.core.featureflag) implementation(projects.core.ui.legacy.theme2.common) implementation(projects.feature.account.avatar.api) implementation(projects.feature.account.avatar.impl) implementation(projects.feature.account.setup) implementation(projects.feature.mail.account.api) implementation(projects.feature.migration.provider) Loading app-common/src/main/kotlin/net/thunderbird/app/common/account/AccountCreator.kt +13 −1 Original line number Diff line number Diff line Loading @@ -24,9 +24,13 @@ import kotlinx.coroutines.withContext import net.thunderbird.core.android.account.LegacyAccount import net.thunderbird.core.common.mail.Protocols import net.thunderbird.core.logging.legacy.Log import net.thunderbird.feature.account.avatar.AvatarMonogramCreator import net.thunderbird.feature.account.storage.profile.AvatarDto import net.thunderbird.feature.account.storage.profile.AvatarTypeDto import net.thunderbird.feature.mail.folder.api.SpecialFolderSelection // TODO Move to feature/account/setup @Suppress("LongParameterList") internal class AccountCreator( private val accountColorPicker: AccountColorPicker, private val localFoldersCreator: SpecialLocalFoldersCreator, Loading @@ -34,8 +38,9 @@ internal class AccountCreator( private val context: Context, private val messagingController: MessagingController, private val deletePolicyProvider: DeletePolicyProvider, private val coroutineDispatcher: CoroutineDispatcher = Dispatchers.IO, private val avatarMonogramCreator: AvatarMonogramCreator, private val unifiedInboxConfigurator: UnifiedInboxConfigurator, private val coroutineDispatcher: CoroutineDispatcher = Dispatchers.IO, ) : AccountSetupExternalContract.AccountCreator { @Suppress("TooGenericExceptionCaught") Loading @@ -54,6 +59,13 @@ internal class AccountCreator( newAccount.email = account.emailAddress newAccount.avatar = AvatarDto( avatarType = AvatarTypeDto.MONOGRAM, avatarMonogram = avatarMonogramCreator.create(account.options.accountName, account.emailAddress), avatarImageUri = null, avatarIconName = null, ) newAccount.setIncomingServerSettings(account.incomingServerSettings) newAccount.outgoingServerSettings = account.outgoingServerSettings Loading app-common/src/main/kotlin/net/thunderbird/app/common/account/AppCommonAccountModule.kt +7 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ import net.thunderbird.app.common.account.data.DefaultAccountProfileLocalDataSou import net.thunderbird.app.common.account.data.DefaultLegacyAccountWrapperManager import net.thunderbird.core.android.account.AccountDefaultsProvider import net.thunderbird.core.android.account.LegacyAccountWrapperManager import net.thunderbird.feature.account.avatar.AvatarMonogramCreator import net.thunderbird.feature.account.avatar.DefaultAvatarMonogramCreator import net.thunderbird.feature.account.core.AccountCoreExternalContract.AccountProfileLocalDataSource import net.thunderbird.feature.account.core.featureAccountCoreModule import net.thunderbird.feature.account.storage.legacy.featureAccountStorageLegacyModule Loading Loading @@ -45,6 +47,10 @@ internal val appCommonAccountModule = module { ) } factory<AvatarMonogramCreator> { DefaultAvatarMonogramCreator() } factory<AccountSetupExternalContract.AccountCreator> { AccountCreator( accountColorPicker = get(), Loading @@ -53,6 +59,7 @@ internal val appCommonAccountModule = module { context = androidApplication(), deletePolicyProvider = get(), messagingController = get(), avatarMonogramCreator = get(), unifiedInboxConfigurator = get(), ) } Loading feature/account/avatar/api/build.gradle.kts 0 → 100644 +7 −0 Original line number Diff line number Diff line plugins { id(ThunderbirdPlugins.Library.kmp) } android { namespace = "net.thunderbird.feature.account.avatar" } feature/account/avatar/api/src/commonMain/kotlin/net/thunderbird/feature/account/avatar/AvatarMonogramCreator.kt 0 → 100644 +18 −0 Original line number Diff line number Diff line package net.thunderbird.feature.account.avatar /** * Interface for creating a monogram based on a name or email address. * * This interface is used to generate a monogram, which is typically the initials of a person's name, * or a representation based on an email address. Implementations should handle null or empty inputs gracefully. */ fun interface AvatarMonogramCreator { /** * Creates a monogram for the given name or email. * * @param name The name to generate a monogram for. * @param email The email address to generate a monogram for. * @return A string representing the monogram, or an empty string if the name or email is null or empty. */ fun create(name: String?, email: String?): String } Loading
app-common/build.gradle.kts +2 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ dependencies { implementation(projects.core.featureflag) implementation(projects.core.ui.legacy.theme2.common) implementation(projects.feature.account.avatar.api) implementation(projects.feature.account.avatar.impl) implementation(projects.feature.account.setup) implementation(projects.feature.mail.account.api) implementation(projects.feature.migration.provider) Loading
app-common/src/main/kotlin/net/thunderbird/app/common/account/AccountCreator.kt +13 −1 Original line number Diff line number Diff line Loading @@ -24,9 +24,13 @@ import kotlinx.coroutines.withContext import net.thunderbird.core.android.account.LegacyAccount import net.thunderbird.core.common.mail.Protocols import net.thunderbird.core.logging.legacy.Log import net.thunderbird.feature.account.avatar.AvatarMonogramCreator import net.thunderbird.feature.account.storage.profile.AvatarDto import net.thunderbird.feature.account.storage.profile.AvatarTypeDto import net.thunderbird.feature.mail.folder.api.SpecialFolderSelection // TODO Move to feature/account/setup @Suppress("LongParameterList") internal class AccountCreator( private val accountColorPicker: AccountColorPicker, private val localFoldersCreator: SpecialLocalFoldersCreator, Loading @@ -34,8 +38,9 @@ internal class AccountCreator( private val context: Context, private val messagingController: MessagingController, private val deletePolicyProvider: DeletePolicyProvider, private val coroutineDispatcher: CoroutineDispatcher = Dispatchers.IO, private val avatarMonogramCreator: AvatarMonogramCreator, private val unifiedInboxConfigurator: UnifiedInboxConfigurator, private val coroutineDispatcher: CoroutineDispatcher = Dispatchers.IO, ) : AccountSetupExternalContract.AccountCreator { @Suppress("TooGenericExceptionCaught") Loading @@ -54,6 +59,13 @@ internal class AccountCreator( newAccount.email = account.emailAddress newAccount.avatar = AvatarDto( avatarType = AvatarTypeDto.MONOGRAM, avatarMonogram = avatarMonogramCreator.create(account.options.accountName, account.emailAddress), avatarImageUri = null, avatarIconName = null, ) newAccount.setIncomingServerSettings(account.incomingServerSettings) newAccount.outgoingServerSettings = account.outgoingServerSettings Loading
app-common/src/main/kotlin/net/thunderbird/app/common/account/AppCommonAccountModule.kt +7 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ import net.thunderbird.app.common.account.data.DefaultAccountProfileLocalDataSou import net.thunderbird.app.common.account.data.DefaultLegacyAccountWrapperManager import net.thunderbird.core.android.account.AccountDefaultsProvider import net.thunderbird.core.android.account.LegacyAccountWrapperManager import net.thunderbird.feature.account.avatar.AvatarMonogramCreator import net.thunderbird.feature.account.avatar.DefaultAvatarMonogramCreator import net.thunderbird.feature.account.core.AccountCoreExternalContract.AccountProfileLocalDataSource import net.thunderbird.feature.account.core.featureAccountCoreModule import net.thunderbird.feature.account.storage.legacy.featureAccountStorageLegacyModule Loading Loading @@ -45,6 +47,10 @@ internal val appCommonAccountModule = module { ) } factory<AvatarMonogramCreator> { DefaultAvatarMonogramCreator() } factory<AccountSetupExternalContract.AccountCreator> { AccountCreator( accountColorPicker = get(), Loading @@ -53,6 +59,7 @@ internal val appCommonAccountModule = module { context = androidApplication(), deletePolicyProvider = get(), messagingController = get(), avatarMonogramCreator = get(), unifiedInboxConfigurator = get(), ) } Loading
feature/account/avatar/api/build.gradle.kts 0 → 100644 +7 −0 Original line number Diff line number Diff line plugins { id(ThunderbirdPlugins.Library.kmp) } android { namespace = "net.thunderbird.feature.account.avatar" }
feature/account/avatar/api/src/commonMain/kotlin/net/thunderbird/feature/account/avatar/AvatarMonogramCreator.kt 0 → 100644 +18 −0 Original line number Diff line number Diff line package net.thunderbird.feature.account.avatar /** * Interface for creating a monogram based on a name or email address. * * This interface is used to generate a monogram, which is typically the initials of a person's name, * or a representation based on an email address. Implementations should handle null or empty inputs gracefully. */ fun interface AvatarMonogramCreator { /** * Creates a monogram for the given name or email. * * @param name The name to generate a monogram for. * @param email The email address to generate a monogram for. * @return A string representing the monogram, or an empty string if the name or email is null or empty. */ fun create(name: String?, email: String?): String }