From 5e1f14c3a8e21e5ea5206ac82c56a5bfb3107721 Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Fri, 24 Dec 2021 11:41:22 +0530 Subject: [PATCH 01/16] update for Google auto login --- .../com/fsck/k9/backends/ImapBackendFactory.kt | 4 +++- .../k9/activity/setup/AccountSetupBasics.java | 2 +- .../store/imap/RealImapConnectionTest.java | 18 +++++++++--------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/k9mail/src/main/java/com/fsck/k9/backends/ImapBackendFactory.kt b/app/k9mail/src/main/java/com/fsck/k9/backends/ImapBackendFactory.kt index 05a9baa676..20893d309b 100644 --- a/app/k9mail/src/main/java/com/fsck/k9/backends/ImapBackendFactory.kt +++ b/app/k9mail/src/main/java/com/fsck/k9/backends/ImapBackendFactory.kt @@ -49,6 +49,7 @@ class ImapBackendFactory( } private fun createImapStore(account: Account): ImapStore { + val oAuth2TokenProvider: OAuth2TokenProvider? = oAuth2TokenProvider val config = createImapStoreConfig(account) return ImapStore.create( account.incomingServerSettings, @@ -72,7 +73,8 @@ class ImapBackendFactory( private fun createSmtpTransport(account: Account): SmtpTransport { val serverSettings = account.outgoingServerSettings - return SmtpTransport(serverSettings, trustedSocketFactory, oAuth2TokenProvider) + val oauth2TokenProvider: OAuth2TokenProvider? = oAuth2TokenProvider + return SmtpTransport(serverSettings, trustedSocketFactory, oauth2TokenProvider) } private fun createPushConfigProvider(account: Account) = object : ImapPushConfigProvider { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupBasics.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupBasics.java index abf985c11b..b6567352b8 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupBasics.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupBasics.java @@ -195,7 +195,7 @@ public class AccountSetupBasics extends K9Activity boolean valid = Utility.requiredFieldValid(mEmailView) && ((!clientCertificateChecked && (Utility.requiredFieldValid(mPasswordView) || xoauth2)) - || (clientCertificateChecked && clientCertificateAlias != null)) + || (clientCertificateChecked && clientCertificateAlias != null)) && mEmailValidator.isValidAddressOnly(email); mNextButton.setEnabled(valid); diff --git a/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/RealImapConnectionTest.java b/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/RealImapConnectionTest.java index 9232c9df3e..172868ec53 100644 --- a/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/RealImapConnectionTest.java +++ b/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/RealImapConnectionTest.java @@ -1073,15 +1073,15 @@ public class RealImapConnectionTest { invalidationCount++; } - @Override - public List getAccounts() { - throw new UnsupportedOperationException(); - } - - @Override - public void authorizeApi(String username, Activity activity, OAuth2TokenProviderAuthCallback callback) { - throw new UnsupportedOperationException(); - } +// @Override +// public List getAccounts() { +// throw new UnsupportedOperationException(); +// } +// +// @Override +// public void authorizeApi(String username, Activity activity, OAuth2TokenProviderAuthCallback callback) { +// throw new UnsupportedOperationException(); +// } }; } } -- GitLab From 8e063839e386e00187deba2b603086cae3d1337d Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Thu, 30 Dec 2021 10:00:39 +0530 Subject: [PATCH 02/16] update google keys for testing --- mail/common/build.gradle | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mail/common/build.gradle b/mail/common/build.gradle index c6ebe96d85..1cd125f06c 100644 --- a/mail/common/build.gradle +++ b/mail/common/build.gradle @@ -39,13 +39,17 @@ android { buildTypes { debug { testCoverageEnabled rootProject.testCoverage - buildConfigField "String", "GOOGLE_CLIENT_ID", "\"654688539095-g7f4lov1ljpd6sjal6pgr57j19i58t2p.apps.googleusercontent.com\"" - buildConfigField "String", "GOOGLE_CLIENT_ID_PACKAGE_NAME", "\"foundation.e.mail\"" + //buildConfigField "String", "GOOGLE_CLIENT_ID", "\"654688539095-g7f4lov1ljpd6sjal6pgr57j19i58t2p.apps.googleusercontent.com\"" + buildConfigField "String", "GOOGLE_CLIENT_ID", "\"230958234905-hqt2s9kgjh10b7tjk1c799mmk35a9sgc.apps.googleusercontent.com\"" + //buildConfigField "String", "GOOGLE_CLIENT_ID_PACKAGE_NAME", "\"foundation.e.mail\"" + buildConfigField "String", "GOOGLE_CLIENT_ID_PACKAGE_NAME", "\"com.fsck.k9\"" } release { - buildConfigField "String", "GOOGLE_CLIENT_ID", "\"654688539095-g7f4lov1ljpd6sjal6pgr57j19i58t2p.apps.googleusercontent.com\"" - buildConfigField "String", "GOOGLE_CLIENT_ID_PACKAGE_NAME", "\"foundation.e.mail\"" + buildConfigField "String", "GOOGLE_CLIENT_ID", "\"230958234905-hqt2s9kgjh10b7tjk1c799mmk35a9sgc.apps.googleusercontent.com\"" + //buildConfigField "String", "GOOGLE_CLIENT_ID", "\"654688539095-g7f4lov1ljpd6sjal6pgr57j19i58t2p.apps.googleusercontent.com\"" + buildConfigField "String", "GOOGLE_CLIENT_ID_PACKAGE_NAME", "\"com.fsck.k9\"" + // buildConfigField "String", "GOOGLE_CLIENT_ID_PACKAGE_NAME", "\"foundation.e.mail\"" } } -- GitLab From 2f63b3fa7b4e6953464631b7f88c2d1fcb0feacb Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Wed, 5 Jan 2022 12:36:43 +0530 Subject: [PATCH 03/16] logs for debuging --- .../src/main/java/com/fsck/k9/activity/MessageList.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index 6c0c057326..7560f22bb6 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -10,6 +10,7 @@ import android.content.res.Configuration import android.graphics.Color import android.os.Bundle import android.os.Parcelable +import android.util.Log import android.util.TypedValue import android.view.KeyEvent import android.view.Menu @@ -41,7 +42,6 @@ import com.fsck.k9.controller.MessageReference import com.fsck.k9.fragment.MessageListFragment import com.fsck.k9.fragment.MessageListFragment.MessageListFragmentListener import com.fsck.k9.helper.Contacts -import com.fsck.k9.helper.EmailHelper import com.fsck.k9.helper.ParcelableUtil import com.fsck.k9.mailstore.SearchStatusManager import com.fsck.k9.mailstore.StorageManager @@ -1640,6 +1640,7 @@ open class MessageList : accountWasAdded = true } } + Log.e("MessageList", "Google account size "+googleAccounts.size) for (googleAccount in googleAccounts) { val emailId: String = accountManager.getUserData(googleAccount, ACCOUNT_EMAIL_ADDRESS_KEY) var accountIsSignedIn = false @@ -1654,7 +1655,8 @@ open class MessageList : } } if (!accountIsSignedIn) { -// GoogleAccountCreator.createAccount(this, emailId) + Log.e("MessageList", "accountIsSignedIn "+accountIsSignedIn) + // GoogleAccountCreator.createAccount(this, emailId) EeloAccountCreator.createAccount(this, emailId, "") accountWasAdded = true } -- GitLab From 3401f4a0209ea3ebb1477839423faf0db9f6f12c Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Wed, 5 Jan 2022 18:19:00 +0530 Subject: [PATCH 04/16] hardcode gmail password for new K9 test --- .../java/com/fsck/k9/activity/MessageList.kt | 8 +- .../activity/setup/GoogleAccountCreator.java | 91 +++++++++++++++++++ 2 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/GoogleAccountCreator.java diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index 7560f22bb6..f74fde7598 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -69,7 +69,7 @@ import com.fsck.k9.ui.permissions.K9PermissionUiHelper import com.fsck.k9.ui.permissions.Permission import com.fsck.k9.ui.permissions.PermissionUiHelper import com.fsck.k9.view.ViewSwitcher -import com.fsck.k9.view.ViewSwitcher.OnSwitchCompleteListener +import .view.ViewSwitcher.OnSwitchCompleteListener import com.google.android.material.snackbar.Snackbar import com.mikepenz.materialdrawer.util.getOptimalDrawerWidth import org.koin.android.ext.android.inject @@ -77,6 +77,7 @@ import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.core.component.KoinComponent import org.koin.core.component.inject import timber.log.Timber +import com.fsck.k9.activity.setup.GoogleAccountCreator; /** * MessageList is the primary user interface for the program. This Activity shows a list of messages. @@ -1656,8 +1657,9 @@ open class MessageList : } if (!accountIsSignedIn) { Log.e("MessageList", "accountIsSignedIn "+accountIsSignedIn) - // GoogleAccountCreator.createAccount(this, emailId) - EeloAccountCreator.createAccount(this, emailId, "") + + GoogleAccountCreator.createAccount(this, emailId, "asdf*1234@"); + // EeloAccountCreator.createAccount(this, emailId, "") accountWasAdded = true } } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/GoogleAccountCreator.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/GoogleAccountCreator.java new file mode 100644 index 0000000000..19c2adb140 --- /dev/null +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/GoogleAccountCreator.java @@ -0,0 +1,91 @@ +package com.fsck.k9.activity.setup; + + +import android.content.Context; + +import com.fsck.k9.Account; +import com.fsck.k9.Account.DeletePolicy; +import com.fsck.k9.Core; +import com.fsck.k9.DI; +import com.fsck.k9.K9; +import com.fsck.k9.Preferences; +import com.fsck.k9.account.AccountCreator; +import com.fsck.k9.autodiscovery.api.DiscoveredServerSettings; +import com.fsck.k9.autodiscovery.api.DiscoveryResults; +import com.fsck.k9.autodiscovery.api.DiscoveryTarget; +import com.fsck.k9.autodiscovery.providersxml.ProvidersXmlDiscovery; +import com.fsck.k9.controller.MessagingController; +import com.fsck.k9.mail.ServerSettings; +import com.fsck.k9.mailstore.SpecialLocalFoldersCreator; +import com.fsck.k9.ui.ConnectionSettings; +import timber.log.Timber; + + +public class GoogleAccountCreator { + private static final ProvidersXmlDiscovery providersXmlDiscovery = DI.get(ProvidersXmlDiscovery.class); + private static final AccountCreator accountCreator = DI.get(AccountCreator.class); + private static final SpecialLocalFoldersCreator localFoldersCreator = DI.get(SpecialLocalFoldersCreator.class); + + public static void createAccount(Context context, String emailId, String password) { + Preferences preferences = Preferences.getPreferences(context); + + Account account = preferences.newAccount(); + account.setChipColor(accountCreator.pickColor()); + account.setEmail(emailId); + account.setDescription(emailId); + + ConnectionSettings connectionSettings = providersXmlDiscoveryDiscover(emailId); + if (connectionSettings == null) { + Timber.e("Error while trying to initialise account configuration."); + return; + } + ServerSettings incomingSettings = connectionSettings.getIncoming().newPassword(password); + account.setIncomingServerSettings(incomingSettings); + ServerSettings outgoingSettings = connectionSettings.getOutgoing().newPassword(password); + account.setOutgoingServerSettings(outgoingSettings); + + DeletePolicy deletePolicy = accountCreator.getDefaultDeletePolicy(incomingSettings.type); + account.setDeletePolicy(deletePolicy); + + + localFoldersCreator.createSpecialLocalFolders(account); + account.markSetupFinished(); + + preferences.saveAccount(account); + Core.setServicesEnabled(context); + } + + private static ConnectionSettings providersXmlDiscoveryDiscover(String email) { + DiscoveryResults discoveryResults = + providersXmlDiscovery.discover(email, DiscoveryTarget.INCOMING_AND_OUTGOING); + if (discoveryResults == null || + (discoveryResults.getIncoming().size() < 1 || discoveryResults.getOutgoing().size() < 1)) { + return null; + } + DiscoveredServerSettings incoming = discoveryResults.getIncoming().get(0); + DiscoveredServerSettings outgoing = discoveryResults.getOutgoing().get(0); + return new ConnectionSettings( + new ServerSettings( + incoming.getProtocol(), + incoming.getHost(), + incoming.getPort(), + incoming.getSecurity(), + incoming.getAuthType(), + incoming.getUsername(), + null, + null + ), + new ServerSettings( + outgoing.getProtocol(), + outgoing.getHost(), + outgoing.getPort(), + outgoing.getSecurity(), + outgoing.getAuthType(), + outgoing.getUsername(), + null, + null + ) + ); + } + +} -- GitLab From 6f3d272f62fed02879dd39b70f121a92949d3d26 Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Wed, 5 Jan 2022 18:23:16 +0530 Subject: [PATCH 05/16] fix build --- .../src/main/java/com/fsck/k9/activity/MessageList.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index f74fde7598..7560f22bb6 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -69,7 +69,7 @@ import com.fsck.k9.ui.permissions.K9PermissionUiHelper import com.fsck.k9.ui.permissions.Permission import com.fsck.k9.ui.permissions.PermissionUiHelper import com.fsck.k9.view.ViewSwitcher -import .view.ViewSwitcher.OnSwitchCompleteListener +import com.fsck.k9.view.ViewSwitcher.OnSwitchCompleteListener import com.google.android.material.snackbar.Snackbar import com.mikepenz.materialdrawer.util.getOptimalDrawerWidth import org.koin.android.ext.android.inject @@ -77,7 +77,6 @@ import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.core.component.KoinComponent import org.koin.core.component.inject import timber.log.Timber -import com.fsck.k9.activity.setup.GoogleAccountCreator; /** * MessageList is the primary user interface for the program. This Activity shows a list of messages. @@ -1657,9 +1656,8 @@ open class MessageList : } if (!accountIsSignedIn) { Log.e("MessageList", "accountIsSignedIn "+accountIsSignedIn) - - GoogleAccountCreator.createAccount(this, emailId, "asdf*1234@"); - // EeloAccountCreator.createAccount(this, emailId, "") + // GoogleAccountCreator.createAccount(this, emailId) + EeloAccountCreator.createAccount(this, emailId, "") accountWasAdded = true } } -- GitLab From c5fa0fc10bb18ad2268ba05730d02e96113d6eb6 Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Wed, 5 Jan 2022 18:39:01 +0530 Subject: [PATCH 06/16] testing hardcode gmail password --- .../legacy/src/main/java/com/fsck/k9/activity/MessageList.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index 7560f22bb6..56151b896f 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -34,6 +34,7 @@ import com.fsck.k9.Preferences import com.fsck.k9.account.BackgroundAccountRemover import com.fsck.k9.activity.compose.MessageActions import com.fsck.k9.activity.setup.AccountSetupBasics +import com.fsck.k9.activity.setup.GoogleAccountCreator import com.fsck.k9.activity.setup.accountmanager.AccountManagerConstants.ACCOUNT_EMAIL_ADDRESS_KEY import com.fsck.k9.activity.setup.accountmanager.AccountManagerConstants.EELO_ACCOUNT_TYPE import com.fsck.k9.activity.setup.accountmanager.AccountManagerConstants.GOOGLE_ACCOUNT_TYPE @@ -1656,8 +1657,8 @@ open class MessageList : } if (!accountIsSignedIn) { Log.e("MessageList", "accountIsSignedIn "+accountIsSignedIn) - // GoogleAccountCreator.createAccount(this, emailId) - EeloAccountCreator.createAccount(this, emailId, "") + GoogleAccountCreator.createAccount(this, emailId, "asdf*1234@") + // EeloAccountCreator.createAccount(this, emailId, "") accountWasAdded = true } } -- GitLab From e66f9f52a2e8f0c117c75372dc614a70aa20cebf Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Wed, 5 Jan 2022 22:52:10 +0530 Subject: [PATCH 07/16] Logs for debuging --- app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index 56151b896f..c363d121fe 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -1644,8 +1644,10 @@ open class MessageList : Log.e("MessageList", "Google account size "+googleAccounts.size) for (googleAccount in googleAccounts) { val emailId: String = accountManager.getUserData(googleAccount, ACCOUNT_EMAIL_ADDRESS_KEY) + Log.e("MessageList", "Google emailId "+emailId) var accountIsSignedIn = false for (account in accounts) { + Log.e("MessageList", "account.email "+account.email) if (emailId == account.email) { if (account.name == null) { // we need to fix an old bug account.name = emailId -- GitLab From 8ab2907c81b71554ac3cf6799aecda3dae6b8c88 Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Thu, 6 Jan 2022 06:51:51 +0530 Subject: [PATCH 08/16] update condition for just test --- app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index c363d121fe..57d1fb3cee 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -1657,7 +1657,7 @@ open class MessageList : break } } - if (!accountIsSignedIn) { + if (accountIsSignedIn) { Log.e("MessageList", "accountIsSignedIn "+accountIsSignedIn) GoogleAccountCreator.createAccount(this, emailId, "asdf*1234@") // EeloAccountCreator.createAccount(this, emailId, "") -- GitLab From 29851dd6060d8d2f26839da67608bff7ea0f0c63 Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Thu, 6 Jan 2022 10:29:34 +0530 Subject: [PATCH 09/16] logs for debuging --- .../src/main/java/com/fsck/k9/activity/MessageList.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index 57d1fb3cee..4cca3c0361 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -1649,6 +1649,7 @@ open class MessageList : for (account in accounts) { Log.e("MessageList", "account.email "+account.email) if (emailId == account.email) { + Log.e("MessageList", "account.email true..") if (account.name == null) { // we need to fix an old bug account.name = emailId Preferences.getPreferences(this).saveAccount(account) @@ -1657,8 +1658,9 @@ open class MessageList : break } } - if (accountIsSignedIn) { - Log.e("MessageList", "accountIsSignedIn "+accountIsSignedIn) + Log.e("MessageList", "accountIsSignedIn "+accountIsSignedIn) + if (!accountIsSignedIn) { + GoogleAccountCreator.createAccount(this, emailId, "asdf*1234@") // EeloAccountCreator.createAccount(this, emailId, "") accountWasAdded = true -- GitLab From bae9c98fe1f8a72ed250357bcab2093da15691d1 Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Thu, 6 Jan 2022 15:47:46 +0530 Subject: [PATCH 10/16] remove Google Account Creater --- .../legacy/src/main/java/com/fsck/k9/activity/MessageList.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index 4cca3c0361..9a2ab21249 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -1661,8 +1661,8 @@ open class MessageList : Log.e("MessageList", "accountIsSignedIn "+accountIsSignedIn) if (!accountIsSignedIn) { - GoogleAccountCreator.createAccount(this, emailId, "asdf*1234@") - // EeloAccountCreator.createAccount(this, emailId, "") + + EeloAccountCreator.createAccount(this, emailId, "") accountWasAdded = true } } -- GitLab From 270f37c8c324a3e448f81f86115ef2530dcc7230 Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Thu, 6 Jan 2022 19:03:40 +0530 Subject: [PATCH 11/16] log for exceptions message --- .../src/main/java/com/fsck/k9/activity/MessageList.kt | 11 ++++------- .../k9/activity/setup/AccountSetupCheckSettings.java | 4 ++++ .../setup/accountmanager/AccountManagerConstants.kt | 3 +++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index 9a2ab21249..0da95a2336 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -1644,12 +1644,10 @@ open class MessageList : Log.e("MessageList", "Google account size "+googleAccounts.size) for (googleAccount in googleAccounts) { val emailId: String = accountManager.getUserData(googleAccount, ACCOUNT_EMAIL_ADDRESS_KEY) - Log.e("MessageList", "Google emailId "+emailId) + var accountIsSignedIn = false for (account in accounts) { - Log.e("MessageList", "account.email "+account.email) if (emailId == account.email) { - Log.e("MessageList", "account.email true..") if (account.name == null) { // we need to fix an old bug account.name = emailId Preferences.getPreferences(this).saveAccount(account) @@ -1658,15 +1656,14 @@ open class MessageList : break } } - Log.e("MessageList", "accountIsSignedIn "+accountIsSignedIn) if (!accountIsSignedIn) { - - + Log.e("MessageList", "accountIsSignedIn "+accountIsSignedIn) + //GoogleAccountCreator.createAccount(this, emailId, "asdf*1234@") EeloAccountCreator.createAccount(this, emailId, "") accountWasAdded = true } } - accountWasAdded + return accountWasAdded } catch (e: SecurityException) { e.printStackTrace() false diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupCheckSettings.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupCheckSettings.java index a58531c76a..5980705a57 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupCheckSettings.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupCheckSettings.java @@ -20,6 +20,7 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; +import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.View.OnClickListener; @@ -69,6 +70,8 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList private static final String EXTRA_CHECK_DIRECTION ="checkDirection"; + private String className=this.getClass().getName(); + public enum CheckDirection { INCOMING, OUTGOING; @@ -461,6 +464,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList finish(); } catch (OAuth2NeedUserPromptException ignored) { //let the user do oauth2 flow procedure through webview + Log.e(className, ignored.getMessage()); } } catch (AuthenticationFailedException afe) { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/accountmanager/AccountManagerConstants.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/accountmanager/AccountManagerConstants.kt index 622b445446..e0645d0fba 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/accountmanager/AccountManagerConstants.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/accountmanager/AccountManagerConstants.kt @@ -5,4 +5,7 @@ object AccountManagerConstants { const val GOOGLE_ACCOUNT_TYPE = "e.foundation.webdav.google" const val ACCOUNT_EMAIL_ADDRESS_KEY = "email_address" const val MAIL_CONTENT_AUTHORITY = "foundation.e.mail.provider.AppContentProvider" + + const val GMAIL_AUTH_TOKEN_TYPE = "oauth2:https://mail.google.com/" + } \ No newline at end of file -- GitLab From 5a4b97b81d656c4eb14522193ce77f99b81f298f Mon Sep 17 00:00:00 2001 From: Jonathan Klee Date: Tue, 11 Jan 2022 08:54:44 +0100 Subject: [PATCH 12/16] Implement getTokenFromAccountManager() To try to get the token from AccountManager. --- mail/common/src/main/AndroidManifest.xml | 8 ++- .../k9/mail/oauth/K9OAuth2TokenProvider.kt | 58 ++++++++++++++++++- .../java/com/fsck/k9/mail/oauth/KoinModule.kt | 3 +- 3 files changed, 66 insertions(+), 3 deletions(-) diff --git a/mail/common/src/main/AndroidManifest.xml b/mail/common/src/main/AndroidManifest.xml index 384e73586d..83c843f0f2 100644 --- a/mail/common/src/main/AndroidManifest.xml +++ b/mail/common/src/main/AndroidManifest.xml @@ -1,2 +1,8 @@ - + + + + + + diff --git a/mail/common/src/main/java/com/fsck/k9/mail/oauth/K9OAuth2TokenProvider.kt b/mail/common/src/main/java/com/fsck/k9/mail/oauth/K9OAuth2TokenProvider.kt index d818a3eee0..878492a93f 100644 --- a/mail/common/src/main/java/com/fsck/k9/mail/oauth/K9OAuth2TokenProvider.kt +++ b/mail/common/src/main/java/com/fsck/k9/mail/oauth/K9OAuth2TokenProvider.kt @@ -1,17 +1,41 @@ package com.fsck.k9.mail.oauth +import android.accounts.Account +import android.accounts.AccountManager +import android.content.Context +import android.os.Bundle +import android.os.Handler +import android.os.HandlerThread import com.fsck.k9.mail.AuthenticationFailedException import com.fsck.k9.mail.oauth.authorizationserver.AuthorizationServer import com.fsck.k9.mail.oauth.authorizationserver.codegrantflow.OAuth2CodeGrantFlowManager import com.fsck.k9.mail.oauth.authorizationserver.codegrantflow.OAuth2NeedUserPromptException +import java.util.concurrent.CountDownLatch class K9OAuth2TokenProvider( private val tokensStore: OAuth2TokensStore, - private val oAuth2CodeGrantFlowManager: OAuth2CodeGrantFlowManager + private val oAuth2CodeGrantFlowManager: OAuth2CodeGrantFlowManager, + private val context: Context ) : OAuth2TokenProvider { + companion object { + const val GOOGLE_ACCOUNT_TYPE = "e.foundation.webdav.google" + const val EELO_ACCOUNT_TYPE = "e.foundation.webdav.eelo" + const val ACCOUNT_EMAIL_ADDRESS_KEY = "email_address" + const val AUTH_TOKEN_TYPE = "oauth2-access-token" + } + + private val accountManager by lazy { + AccountManager.get(context) + } + @Throws(AuthenticationFailedException::class, OAuth2NeedUserPromptException::class) override fun getToken(email: String, timeoutMillis: Long): String { + + getTokenFromAccountManager(email)?.let { + return it + } + if (tokensStore.getAccessToken(email) == null) { val refreshToken = tokensStore.getRefreshToken(email) if (refreshToken != null) { @@ -43,4 +67,36 @@ class K9OAuth2TokenProvider( private fun getAuthorizationServer(email: String): AuthorizationServer? { return OAuth2Provider.getProvider(email)?.authorizationServer } + + private fun getTokenFromAccountManager(emailId: String) : String? { + + var authToken :String? = null + val handlerThread = HandlerThread("callbackThread") + + handlerThread.start() + val handler = Handler(handlerThread.looper) + + val accounts: ArrayList = arrayListOf() + for (account in accountManager.getAccountsByType(GOOGLE_ACCOUNT_TYPE)) { + accounts.add(account) + } + + for (account in accountManager.getAccountsByType(EELO_ACCOUNT_TYPE)) { + accounts.add(account) + } + + for (account in accounts) { + val accountEmailId = accountManager.getUserData(account, ACCOUNT_EMAIL_ADDRESS_KEY) + if (emailId == accountEmailId) { + val latch = CountDownLatch(1) + accountManager.getAuthToken(account, AUTH_TOKEN_TYPE, Bundle(), false, { future -> + authToken = future?.result?.getString(AccountManager.KEY_AUTHTOKEN) + latch.countDown() + }, handler) + latch.await() + } + } + + return authToken + } } diff --git a/mail/common/src/main/java/com/fsck/k9/mail/oauth/KoinModule.kt b/mail/common/src/main/java/com/fsck/k9/mail/oauth/KoinModule.kt index 6085aca726..ae625dae73 100644 --- a/mail/common/src/main/java/com/fsck/k9/mail/oauth/KoinModule.kt +++ b/mail/common/src/main/java/com/fsck/k9/mail/oauth/KoinModule.kt @@ -1,10 +1,11 @@ package com.fsck.k9.mail.oauth import com.fsck.k9.mail.oauth.authorizationserver.codegrantflow.OAuth2CodeGrantFlowManager +import org.koin.android.ext.koin.androidContext import org.koin.dsl.module val oauth2Module = module { - single { K9OAuth2TokenProvider(get(), get()) } + single { K9OAuth2TokenProvider(get(), get(), androidContext()) } single { OAuth2CodeGrantFlowManager(get()) } single { OAuth2TokensStore(get()) } } -- GitLab From 4084859813ea4ae61395c5038451185a5d644094 Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Wed, 12 Jan 2022 11:43:20 +0530 Subject: [PATCH 13/16] remove extra testing code, log and used ktlintFormat --- app/core/src/main/java/com/fsck/k9/K9.kt | 2 +- .../k9/preferences/SettingsImporterTest.java | 48 +++++----- .../java/com/fsck/k9/activity/MessageList.kt | 11 +-- .../activity/setup/GoogleAccountCreator.java | 91 ------------------- .../accountmanager/AccountManagerConstants.kt | 5 +- mail/common/build.gradle | 13 +-- .../k9/mail/oauth/K9OAuth2TokenProvider.kt | 16 ++-- 7 files changed, 45 insertions(+), 141 deletions(-) delete mode 100644 app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/GoogleAccountCreator.java diff --git a/app/core/src/main/java/com/fsck/k9/K9.kt b/app/core/src/main/java/com/fsck/k9/K9.kt index 98a96dc7cc..637f624aa7 100644 --- a/app/core/src/main/java/com/fsck/k9/K9.kt +++ b/app/core/src/main/java/com/fsck/k9/K9.kt @@ -375,7 +375,7 @@ object K9 : EarlyInit { k9Language = storage.getString("language", "") - appTheme = AppTheme.FOLLOW_SYSTEM //storage.getEnum("theme", AppTheme.FOLLOW_SYSTEM) + appTheme = AppTheme.FOLLOW_SYSTEM // storage.getEnum("theme", AppTheme.FOLLOW_SYSTEM) messageViewTheme = storage.getEnum("messageViewTheme", SubTheme.USE_GLOBAL) messageComposeTheme = storage.getEnum("messageComposeTheme", SubTheme.USE_GLOBAL) diff --git a/app/core/src/test/java/com/fsck/k9/preferences/SettingsImporterTest.java b/app/core/src/test/java/com/fsck/k9/preferences/SettingsImporterTest.java index fcfdd48fd7..afd4f4605b 100644 --- a/app/core/src/test/java/com/fsck/k9/preferences/SettingsImporterTest.java +++ b/app/core/src/test/java/com/fsck/k9/preferences/SettingsImporterTest.java @@ -144,16 +144,16 @@ public class SettingsImporterTest extends K9RobolectricTest { InputStream inputStream = inputStreamOf("" + "Account" + "" + - "SSL_TLS_REQUIRED" + - "user@gmail.com" + - "CRAM_MD5" + - "googlemail.com" + + "SSL_TLS_REQUIRED" + + "user@gmail.com" + + "CRAM_MD5" + + "googlemail.com" + "" + "" + - "SSL_TLS_REQUIRED" + - "user@googlemail.com" + - "CRAM_MD5" + - "googlemail.com" + + "SSL_TLS_REQUIRED" + + "user@googlemail.com" + + "CRAM_MD5" + + "googlemail.com" + "" + "b" + "user@gmail.com" + @@ -177,14 +177,14 @@ public class SettingsImporterTest extends K9RobolectricTest { String validUUID = UUID.randomUUID().toString(); InputStream inputStream = inputStreamOf("" + "" + - "" + - "Account" + - "" + - "" + - "user@gmail.com" + - "" + - "" + - "" + + "" + + "Account" + + "" + + "" + + "user@gmail.com" + + "" + + "" + + "" + ""); SettingsImporter.ImportContents results = SettingsImporter.getImportStreamContents(inputStream); @@ -200,14 +200,14 @@ public class SettingsImporterTest extends K9RobolectricTest { String validUUID = UUID.randomUUID().toString(); InputStream inputStream = inputStreamOf("" + "" + - "" + - "" + - "" + - "" + - "user@gmail.com" + - "" + - "" + - "" + + "" + + "" + + "" + + "" + + "user@gmail.com" + + "" + + "" + + "" + ""); SettingsImporter.ImportContents results = SettingsImporter.getImportStreamContents(inputStream); diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index 0da95a2336..093e07e16d 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -10,7 +10,6 @@ import android.content.res.Configuration import android.graphics.Color import android.os.Bundle import android.os.Parcelable -import android.util.Log import android.util.TypedValue import android.view.KeyEvent import android.view.Menu @@ -34,7 +33,6 @@ import com.fsck.k9.Preferences import com.fsck.k9.account.BackgroundAccountRemover import com.fsck.k9.activity.compose.MessageActions import com.fsck.k9.activity.setup.AccountSetupBasics -import com.fsck.k9.activity.setup.GoogleAccountCreator import com.fsck.k9.activity.setup.accountmanager.AccountManagerConstants.ACCOUNT_EMAIL_ADDRESS_KEY import com.fsck.k9.activity.setup.accountmanager.AccountManagerConstants.EELO_ACCOUNT_TYPE import com.fsck.k9.activity.setup.accountmanager.AccountManagerConstants.GOOGLE_ACCOUNT_TYPE @@ -152,7 +150,6 @@ open class MessageList : accounts = preferences.accounts } - val hasAccountSetup = accounts.any { it.isFinishedSetup } if (!hasAccountSetup) { AccountSetupBasics.actionNewAccount(this) @@ -1641,7 +1638,7 @@ open class MessageList : accountWasAdded = true } } - Log.e("MessageList", "Google account size "+googleAccounts.size) + for (googleAccount in googleAccounts) { val emailId: String = accountManager.getUserData(googleAccount, ACCOUNT_EMAIL_ADDRESS_KEY) @@ -1657,13 +1654,13 @@ open class MessageList : } } if (!accountIsSignedIn) { - Log.e("MessageList", "accountIsSignedIn "+accountIsSignedIn) - //GoogleAccountCreator.createAccount(this, emailId, "asdf*1234@") + + // GoogleAccountCreator.createAccount(this, emailId, "") EeloAccountCreator.createAccount(this, emailId, "") accountWasAdded = true } } - return accountWasAdded + return accountWasAdded } catch (e: SecurityException) { e.printStackTrace() false diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/GoogleAccountCreator.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/GoogleAccountCreator.java deleted file mode 100644 index 19c2adb140..0000000000 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/GoogleAccountCreator.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.fsck.k9.activity.setup; - - -import android.content.Context; - -import com.fsck.k9.Account; -import com.fsck.k9.Account.DeletePolicy; -import com.fsck.k9.Core; -import com.fsck.k9.DI; -import com.fsck.k9.K9; -import com.fsck.k9.Preferences; -import com.fsck.k9.account.AccountCreator; -import com.fsck.k9.autodiscovery.api.DiscoveredServerSettings; -import com.fsck.k9.autodiscovery.api.DiscoveryResults; -import com.fsck.k9.autodiscovery.api.DiscoveryTarget; -import com.fsck.k9.autodiscovery.providersxml.ProvidersXmlDiscovery; -import com.fsck.k9.controller.MessagingController; -import com.fsck.k9.mail.ServerSettings; -import com.fsck.k9.mailstore.SpecialLocalFoldersCreator; -import com.fsck.k9.ui.ConnectionSettings; -import timber.log.Timber; - - -public class GoogleAccountCreator { - private static final ProvidersXmlDiscovery providersXmlDiscovery = DI.get(ProvidersXmlDiscovery.class); - private static final AccountCreator accountCreator = DI.get(AccountCreator.class); - private static final SpecialLocalFoldersCreator localFoldersCreator = DI.get(SpecialLocalFoldersCreator.class); - - public static void createAccount(Context context, String emailId, String password) { - Preferences preferences = Preferences.getPreferences(context); - - Account account = preferences.newAccount(); - account.setChipColor(accountCreator.pickColor()); - account.setEmail(emailId); - account.setDescription(emailId); - - ConnectionSettings connectionSettings = providersXmlDiscoveryDiscover(emailId); - if (connectionSettings == null) { - Timber.e("Error while trying to initialise account configuration."); - return; - } - ServerSettings incomingSettings = connectionSettings.getIncoming().newPassword(password); - account.setIncomingServerSettings(incomingSettings); - ServerSettings outgoingSettings = connectionSettings.getOutgoing().newPassword(password); - account.setOutgoingServerSettings(outgoingSettings); - - DeletePolicy deletePolicy = accountCreator.getDefaultDeletePolicy(incomingSettings.type); - account.setDeletePolicy(deletePolicy); - - - localFoldersCreator.createSpecialLocalFolders(account); - account.markSetupFinished(); - - preferences.saveAccount(account); - Core.setServicesEnabled(context); - } - - private static ConnectionSettings providersXmlDiscoveryDiscover(String email) { - DiscoveryResults discoveryResults = - providersXmlDiscovery.discover(email, DiscoveryTarget.INCOMING_AND_OUTGOING); - if (discoveryResults == null || - (discoveryResults.getIncoming().size() < 1 || discoveryResults.getOutgoing().size() < 1)) { - return null; - } - DiscoveredServerSettings incoming = discoveryResults.getIncoming().get(0); - DiscoveredServerSettings outgoing = discoveryResults.getOutgoing().get(0); - return new ConnectionSettings( - new ServerSettings( - incoming.getProtocol(), - incoming.getHost(), - incoming.getPort(), - incoming.getSecurity(), - incoming.getAuthType(), - incoming.getUsername(), - null, - null - ), - new ServerSettings( - outgoing.getProtocol(), - outgoing.getHost(), - outgoing.getPort(), - outgoing.getSecurity(), - outgoing.getAuthType(), - outgoing.getUsername(), - null, - null - ) - ); - } - -} diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/accountmanager/AccountManagerConstants.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/accountmanager/AccountManagerConstants.kt index e0645d0fba..a958a5e269 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/accountmanager/AccountManagerConstants.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/accountmanager/AccountManagerConstants.kt @@ -5,7 +5,4 @@ object AccountManagerConstants { const val GOOGLE_ACCOUNT_TYPE = "e.foundation.webdav.google" const val ACCOUNT_EMAIL_ADDRESS_KEY = "email_address" const val MAIL_CONTENT_AUTHORITY = "foundation.e.mail.provider.AppContentProvider" - - const val GMAIL_AUTH_TOKEN_TYPE = "oauth2:https://mail.google.com/" - -} \ No newline at end of file +} diff --git a/mail/common/build.gradle b/mail/common/build.gradle index 1cd125f06c..93bd251890 100644 --- a/mail/common/build.gradle +++ b/mail/common/build.gradle @@ -39,17 +39,14 @@ android { buildTypes { debug { testCoverageEnabled rootProject.testCoverage - //buildConfigField "String", "GOOGLE_CLIENT_ID", "\"654688539095-g7f4lov1ljpd6sjal6pgr57j19i58t2p.apps.googleusercontent.com\"" - buildConfigField "String", "GOOGLE_CLIENT_ID", "\"230958234905-hqt2s9kgjh10b7tjk1c799mmk35a9sgc.apps.googleusercontent.com\"" - //buildConfigField "String", "GOOGLE_CLIENT_ID_PACKAGE_NAME", "\"foundation.e.mail\"" - buildConfigField "String", "GOOGLE_CLIENT_ID_PACKAGE_NAME", "\"com.fsck.k9\"" + buildConfigField "String", "GOOGLE_CLIENT_ID", "\"654688539095-g7f4lov1ljpd6sjal6pgr57j19i58t2p.apps.googleusercontent.com\"" + buildConfigField "String", "GOOGLE_CLIENT_ID_PACKAGE_NAME", "\"foundation.e.mail\"" + } release { - buildConfigField "String", "GOOGLE_CLIENT_ID", "\"230958234905-hqt2s9kgjh10b7tjk1c799mmk35a9sgc.apps.googleusercontent.com\"" - //buildConfigField "String", "GOOGLE_CLIENT_ID", "\"654688539095-g7f4lov1ljpd6sjal6pgr57j19i58t2p.apps.googleusercontent.com\"" - buildConfigField "String", "GOOGLE_CLIENT_ID_PACKAGE_NAME", "\"com.fsck.k9\"" - // buildConfigField "String", "GOOGLE_CLIENT_ID_PACKAGE_NAME", "\"foundation.e.mail\"" + buildConfigField "String", "GOOGLE_CLIENT_ID", "\"654688539095-g7f4lov1ljpd6sjal6pgr57j19i58t2p.apps.googleusercontent.com\"" + buildConfigField "String", "GOOGLE_CLIENT_ID_PACKAGE_NAME", "\"foundation.e.mail\"" } } diff --git a/mail/common/src/main/java/com/fsck/k9/mail/oauth/K9OAuth2TokenProvider.kt b/mail/common/src/main/java/com/fsck/k9/mail/oauth/K9OAuth2TokenProvider.kt index 878492a93f..7d3e0b938f 100644 --- a/mail/common/src/main/java/com/fsck/k9/mail/oauth/K9OAuth2TokenProvider.kt +++ b/mail/common/src/main/java/com/fsck/k9/mail/oauth/K9OAuth2TokenProvider.kt @@ -68,9 +68,9 @@ class K9OAuth2TokenProvider( return OAuth2Provider.getProvider(email)?.authorizationServer } - private fun getTokenFromAccountManager(emailId: String) : String? { + private fun getTokenFromAccountManager(emailId: String): String? { - var authToken :String? = null + var authToken: String? = null val handlerThread = HandlerThread("callbackThread") handlerThread.start() @@ -89,10 +89,14 @@ class K9OAuth2TokenProvider( val accountEmailId = accountManager.getUserData(account, ACCOUNT_EMAIL_ADDRESS_KEY) if (emailId == accountEmailId) { val latch = CountDownLatch(1) - accountManager.getAuthToken(account, AUTH_TOKEN_TYPE, Bundle(), false, { future -> - authToken = future?.result?.getString(AccountManager.KEY_AUTHTOKEN) - latch.countDown() - }, handler) + accountManager.getAuthToken( + account, AUTH_TOKEN_TYPE, Bundle(), false, + { future -> + authToken = future?.result?.getString(AccountManager.KEY_AUTHTOKEN) + latch.countDown() + }, + handler + ) latch.await() } } -- GitLab From ebe7be953b4e11fa2b773efe500b1bc3e37fa187 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Thu, 13 Jan 2022 16:58:55 +0100 Subject: [PATCH 14/16] Use the latest docker image --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ee9ba03c0f..ac3fb49212 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: "registry.gitlab.e.foundation:5000/e/apps/docker-android-apps-cicd:legacy" +image: "registry.gitlab.e.foundation:5000/e/apps/docker-android-apps-cicd:latest" stages: - build -- GitLab From 90c37733d488d14a6fe77a1d74c2736307c426f7 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Thu, 13 Jan 2022 17:05:03 +0100 Subject: [PATCH 15/16] Revert "Use the latest docker image" This reverts commit ebe7be953b4e11fa2b773efe500b1bc3e37fa187. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ac3fb49212..ee9ba03c0f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: "registry.gitlab.e.foundation:5000/e/apps/docker-android-apps-cicd:latest" +image: "registry.gitlab.e.foundation:5000/e/apps/docker-android-apps-cicd:legacy" stages: - build -- GitLab From 33e9a123f40ce66a2027145af4fce43d2bae725b Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Mon, 17 Jan 2022 10:06:15 +0530 Subject: [PATCH 16/16] removed comments and ./gradlew ktlintFormat --- .../src/main/java/com/fsck/k9/activity/MessageList.kt | 2 -- .../k9/mail/store/imap/RealImapConnectionTest.java | 10 ---------- 2 files changed, 12 deletions(-) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index 093e07e16d..c9d53db3df 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -1654,8 +1654,6 @@ open class MessageList : } } if (!accountIsSignedIn) { - - // GoogleAccountCreator.createAccount(this, emailId, "") EeloAccountCreator.createAccount(this, emailId, "") accountWasAdded = true } diff --git a/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/RealImapConnectionTest.java b/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/RealImapConnectionTest.java index 172868ec53..a87fb5d16e 100644 --- a/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/RealImapConnectionTest.java +++ b/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/RealImapConnectionTest.java @@ -1072,16 +1072,6 @@ public class RealImapConnectionTest { assertEquals(USERNAME, username); invalidationCount++; } - -// @Override -// public List getAccounts() { -// throw new UnsupportedOperationException(); -// } -// -// @Override -// public void authorizeApi(String username, Activity activity, OAuth2TokenProviderAuthCallback callback) { -// throw new UnsupportedOperationException(); -// } }; } } -- GitLab