Add AccountOwnerNameProvider

This commit is contained in:
Wolf-Martell Montwé 2023-06-27 18:07:32 +02:00
parent dbdbb25cdb
commit 88a4b7913f
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
5 changed files with 32 additions and 0 deletions

View file

@ -2,6 +2,7 @@ package app.k9mail.feature.preview
import app.k9mail.core.common.oauth.OAuthConfigurationFactory
import app.k9mail.feature.account.setup.featureAccountSetupModule
import app.k9mail.feature.preview.account.AccountOwnerNameProvider
import app.k9mail.feature.preview.account.AccountSetupFinishedLauncher
import app.k9mail.feature.preview.auth.AndroidKeyStoreDirectoryProvider
import app.k9mail.feature.preview.auth.AppOAuthConfigurationFactory
@ -16,6 +17,7 @@ import org.koin.core.module.Module
import org.koin.dsl.module
val accountModule: Module = module {
factory { AccountOwnerNameProvider() }
factory {
AccountSetupFinishedLauncher(
context = androidContext(),

View file

@ -0,0 +1,9 @@
package app.k9mail.feature.preview.account
import app.k9mail.feature.account.setup.domain.ExternalContract
class AccountOwnerNameProvider: ExternalContract.AccountOwnerNameProvider {
override fun getOwnerName(): String? {
return null
}
}

View file

@ -4,6 +4,11 @@ import org.koin.android.ext.koin.androidContext
import org.koin.dsl.module
val newAccountModule = module {
factory {
AccountOwnerNameProvider(
preferences = get(),
)
}
factory {
AccountSetupFinishedLauncher(
context = androidContext(),

View file

@ -0,0 +1,12 @@
package com.fsck.k9.account
import app.k9mail.feature.account.setup.domain.ExternalContract
import com.fsck.k9.Preferences
class AccountOwnerNameProvider(
private val preferences: Preferences,
) : ExternalContract.AccountOwnerNameProvider {
override fun getOwnerName(): String? {
return preferences.defaultAccount?.senderName
}
}

View file

@ -1,6 +1,10 @@
package app.k9mail.feature.account.setup.domain
interface ExternalContract {
fun interface AccountOwnerNameProvider {
fun getOwnerName(): String?
}
fun interface AccountSetupFinishedLauncher {
fun launch(accountUuid: String)
}