From bbfc2329754341e9ec4dfcd2e226d0e896c1d413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolf-Martell=20Montwe=CC=81?= Date: Thu, 22 Jun 2023 17:21:50 +0200 Subject: [PATCH] Add `feature:account:oauth` module and move ServerNameSuggester there --- app/core/build.gradle.kts | 1 + .../src/main/java/com/fsck/k9/KoinModule.kt | 2 +- app/ui/legacy/build.gradle.kts | 1 + .../activity/setup/AccountSetupAccountType.kt | 2 +- .../activity/setup/AccountSetupIncoming.java | 2 +- feature/account/oauth/build.gradle.kts | 24 +++++++++++++++++++ .../domain/usecase}/ServerNameSuggester.kt | 2 +- .../usecase}/ServerNameSuggesterTest.java | 3 +-- feature/account/setup/build.gradle.kts | 1 + settings.gradle.kts | 1 + 10 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 feature/account/oauth/build.gradle.kts rename {app/core/src/main/java/com/fsck/k9/setup => feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/domain/usecase}/ServerNameSuggester.kt (87%) rename {app/core/src/test/java/com/fsck/k9/setup => feature/account/oauth/src/test/java/app/k9mail/feature/account/oauth/domain/usecase}/ServerNameSuggesterTest.java (95%) diff --git a/app/core/build.gradle.kts b/app/core/build.gradle.kts index 7ba0b6816..6bdf78a30 100644 --- a/app/core/build.gradle.kts +++ b/app/core/build.gradle.kts @@ -10,6 +10,7 @@ dependencies { api(projects.core.android.common) implementation(projects.plugins.openpgpApiLib.openpgpApi) + implementation(projects.feature.account.oauth) api(libs.koin.android) diff --git a/app/core/src/main/java/com/fsck/k9/KoinModule.kt b/app/core/src/main/java/com/fsck/k9/KoinModule.kt index 3c4389380..e147151dd 100644 --- a/app/core/src/main/java/com/fsck/k9/KoinModule.kt +++ b/app/core/src/main/java/com/fsck/k9/KoinModule.kt @@ -2,13 +2,13 @@ package com.fsck.k9 import android.content.Context import app.k9mail.core.android.common.coreCommonAndroidModule +import app.k9mail.feature.account.oauth.domain.usecase.ServerNameSuggester import com.fsck.k9.helper.Contacts import com.fsck.k9.helper.DefaultTrustedSocketFactory import com.fsck.k9.mail.ssl.LocalKeyStore import com.fsck.k9.mail.ssl.TrustManagerFactory import com.fsck.k9.mail.ssl.TrustedSocketFactory import com.fsck.k9.mailstore.LocalStoreProvider -import com.fsck.k9.setup.ServerNameSuggester import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.GlobalScope import kotlinx.datetime.Clock diff --git a/app/ui/legacy/build.gradle.kts b/app/ui/legacy/build.gradle.kts index ff333cfb1..0aaedebda 100644 --- a/app/ui/legacy/build.gradle.kts +++ b/app/ui/legacy/build.gradle.kts @@ -10,6 +10,7 @@ dependencies { implementation(projects.feature.autodiscovery.providersxml) implementation(projects.mail.common) implementation(projects.uiUtils.toolbarBottomSheet) + implementation(projects.feature.account.oauth) // Remove AccountSetupIncoming's dependency on these compileOnly(projects.mail.protocols.imap) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupAccountType.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupAccountType.kt index 03996b0c4..cc71b11e4 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupAccountType.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupAccountType.kt @@ -5,13 +5,13 @@ import android.content.Intent import android.os.Bundle import android.view.View import app.k9mail.core.common.mail.Protocols +import app.k9mail.feature.account.oauth.domain.usecase.ServerNameSuggester import com.fsck.k9.Account import com.fsck.k9.Preferences import com.fsck.k9.helper.EmailHelper.getDomainFromEmailAddress import com.fsck.k9.mail.ConnectionSecurity import com.fsck.k9.mail.ServerSettings import com.fsck.k9.mailstore.SpecialLocalFoldersCreator -import com.fsck.k9.setup.ServerNameSuggester import com.fsck.k9.ui.R import com.fsck.k9.ui.base.K9Activity import org.koin.android.ext.android.inject diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupIncoming.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupIncoming.java index 64791c0df..79e360e44 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupIncoming.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupIncoming.java @@ -29,7 +29,7 @@ import com.fsck.k9.LocalKeyStoreManager; import com.fsck.k9.Preferences; import com.fsck.k9.account.AccountCreator; import com.fsck.k9.helper.EmailHelper; -import com.fsck.k9.setup.ServerNameSuggester; +import app.k9mail.feature.account.oauth.domain.usecase.ServerNameSuggester; import com.fsck.k9.ui.base.K9Activity; import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; import com.fsck.k9.helper.Utility; diff --git a/feature/account/oauth/build.gradle.kts b/feature/account/oauth/build.gradle.kts new file mode 100644 index 000000000..eaa21306a --- /dev/null +++ b/feature/account/oauth/build.gradle.kts @@ -0,0 +1,24 @@ +plugins { + id(ThunderbirdPlugins.Library.androidCompose) +} + +android { + namespace = "app.k9mail.feature.account.oauth" + resourcePrefix = "account_oauth_" + + buildTypes { + debug { + manifestPlaceholders["appAuthRedirectScheme"] = "FIXME: override this in your app project" + } + release { + manifestPlaceholders["appAuthRedirectScheme"] = "FIXME: override this in your app project" + } + } +} + +dependencies { + implementation(projects.core.ui.compose.designsystem) + implementation(projects.core.common) + + testImplementation(projects.core.ui.compose.testing) +} diff --git a/app/core/src/main/java/com/fsck/k9/setup/ServerNameSuggester.kt b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/domain/usecase/ServerNameSuggester.kt similarity index 87% rename from app/core/src/main/java/com/fsck/k9/setup/ServerNameSuggester.kt rename to feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/domain/usecase/ServerNameSuggester.kt index 6b5aec69e..410ee6d9c 100644 --- a/app/core/src/main/java/com/fsck/k9/setup/ServerNameSuggester.kt +++ b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/domain/usecase/ServerNameSuggester.kt @@ -1,4 +1,4 @@ -package com.fsck.k9.setup +package app.k9mail.feature.account.oauth.domain.usecase import app.k9mail.core.common.mail.Protocols diff --git a/app/core/src/test/java/com/fsck/k9/setup/ServerNameSuggesterTest.java b/feature/account/oauth/src/test/java/app/k9mail/feature/account/oauth/domain/usecase/ServerNameSuggesterTest.java similarity index 95% rename from app/core/src/test/java/com/fsck/k9/setup/ServerNameSuggesterTest.java rename to feature/account/oauth/src/test/java/app/k9mail/feature/account/oauth/domain/usecase/ServerNameSuggesterTest.java index 117b82eb2..d2f393734 100644 --- a/app/core/src/test/java/com/fsck/k9/setup/ServerNameSuggesterTest.java +++ b/feature/account/oauth/src/test/java/app/k9mail/feature/account/oauth/domain/usecase/ServerNameSuggesterTest.java @@ -1,4 +1,4 @@ -package com.fsck.k9.setup; +package app.k9mail.feature.account.oauth.domain.usecase; import app.k9mail.core.common.mail.Protocols; @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; public class ServerNameSuggesterTest { private ServerNameSuggester serverNameSuggester; - @Before public void setUp() throws Exception { serverNameSuggester = new ServerNameSuggester(); diff --git a/feature/account/setup/build.gradle.kts b/feature/account/setup/build.gradle.kts index e946434e5..9e7e8c3fa 100644 --- a/feature/account/setup/build.gradle.kts +++ b/feature/account/setup/build.gradle.kts @@ -12,6 +12,7 @@ dependencies { implementation(projects.core.common) implementation(projects.feature.autodiscovery.service) + implementation(projects.feature.account.oauth) testImplementation(projects.core.ui.compose.testing) } diff --git a/settings.gradle.kts b/settings.gradle.kts index 2a69a8090..978f562b1 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -40,6 +40,7 @@ include( include( ":feature:account:setup", + ":feature:account:oauth", ":feature:onboarding", ":feature:autodiscovery:api", ":feature:autodiscovery:providersxml",