Loading app/autodiscovery/providersxml/src/main/res/xml/providers.xml +0 −13 Original line number Diff line number Diff line Loading @@ -717,17 +717,4 @@ <incoming uri="imap+ssl+://mail.fairnatics.net" username="$email" /> <outgoing uri="smtp+tls+://mail.fairnatics.net:25" username="$email" /> </provider> <!-- eFoundation --> <provider id="e.foundation" label="/e/" domain="e.email"> <incoming uri="imap+ssl+://mail.ecloud.global" username="$email" /> <outgoing uri="smtp+tls+://mail.ecloud.global" username="$email" /> </provider> <!-- eeo --> <provider id="eeo.one" label="eeo" domain="eeo.one"> <incoming uri="imap+ssl+://mail.eeo.one" username="$email" /> <outgoing uri="smtp+tls+://mail.eeo.one" username="$email" /> </provider> </providers> app/k9mail/proguard-rules.pro +43 −0 Original line number Diff line number Diff line Loading @@ -49,3 +49,46 @@ # OkHttp platform used only on JVM and when Conscrypt dependency is available. -dontwarn okhttp3.internal.platform.ConscryptPlatform # Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and # EnclosingMethod is required to use InnerClasses. -keepattributes Signature, InnerClasses, EnclosingMethod # Retrofit does reflection on method and parameter annotations. -keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations # Keep annotation default values (e.g., retrofit2.http.Field.encoded). -keepattributes AnnotationDefault # Retain service method parameters when optimizing. -keepclassmembers,allowshrinking,allowobfuscation interface * { @retrofit2.http.* <methods>; } # Ignore annotation used for build tooling. -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement # Guarded by a NoClassDefFoundError try/catch and only used when on the classpath. -dontwarn kotlin.Unit # Top-level functions that can only be used by Kotlin. -dontwarn retrofit2.KotlinExtensions -dontwarn retrofit2.KotlinExtensions$* # With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy # and replaces all potential values with null. Explicitly keeping the interfaces prevents this. -if interface * { @retrofit2.http.* <methods>; } -keep,allowobfuscation interface <1> # Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items). -keep,allowobfuscation,allowshrinking interface retrofit2.Call -keep,allowobfuscation,allowshrinking class retrofit2.Response # With R8 full mode generic signatures are stripped for classes that are not # kept. Suspend functions are wrapped in continuations where the type argument # is used. -keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation -keep class org.simpleframework.xml.** { *; } -keep class com.fsck.k9.activity.setup.accountmanager.** { *; } No newline at end of file app/ui/legacy/build.gradle +2 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,8 @@ dependencies { implementation "com.squareup.retrofit2:retrofit:${versions.retrofit}" implementation "com.squareup.retrofit2:converter-simplexml:${versions.retrofit}" implementation "com.github.fahim44:FullScreenLoadingDialog:1.0.6" } android { Loading app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +63 −44 Original line number Diff line number Diff line /* * Copyright ECORP SAS 2022 * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package com.fsck.k9.activity import android.accounts.AccountManager Loading Loading @@ -28,6 +44,7 @@ import androidx.drawerlayout.widget.DrawerLayout.DrawerListener import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentTransaction import androidx.lifecycle.Observer import androidx.lifecycle.lifecycleScope import com.fsck.k9.Account import com.fsck.k9.Account.SortType import com.fsck.k9.K9 Loading Loading @@ -74,6 +91,8 @@ import com.fsck.k9.view.ViewSwitcher import com.fsck.k9.view.ViewSwitcher.OnSwitchCompleteListener import com.google.android.material.snackbar.Snackbar import com.mikepenz.materialdrawer.util.getOptimalDrawerWidth import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import org.koin.android.ext.android.inject import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.core.component.KoinComponent Loading Loading @@ -142,17 +161,17 @@ open class MessageList : public override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setLayout(R.layout.message_list_loading) var accounts = preferences.accounts val accounts = preferences.accounts deleteIncompleteAccounts(accounts) accountManager = AccountManager.get(this) // TODO remove old accounts automatically if (addNewAccountsAutomatically(accounts)) { accounts = preferences.accounts addNewAccountsAutomatically(accounts, savedInstanceState) } private fun onAccountConfigurationFinish(savedInstanceState: Bundle?) { val accounts = preferences.accounts val hasAccountSetup = accounts.any { it.isFinishedSetup } if (!hasAccountSetup) { AccountSetupBasics.actionNewAccount(this) Loading Loading @@ -1679,11 +1698,11 @@ open class MessageList : val messageViewOnly: Boolean = false ) private fun addNewAccountsAutomatically(accounts: List<Account>): Boolean { return try { private fun addNewAccountsAutomatically(accounts: List<Account>, savedInstanceState: Bundle?) { lifecycleScope.launch(Dispatchers.IO) { try { val eeloAccounts: Array<android.accounts.Account> = getEeloAccountsOnDevice() val googleAccounts: Array<android.accounts.Account> = getGoogleAccountsOnDevice() var accountWasAdded = false for (eeloAccount in eeloAccounts) { val emailId: String = accountManager.getUserData(eeloAccount, ACCOUNT_EMAIL_ADDRESS_KEY) if (!emailId.contains("@")) continue Loading @@ -1696,8 +1715,7 @@ open class MessageList : } if (!accountIsSignedIn) { val password: String = accountManager.getPassword(eeloAccount) EeloAccountCreator.createAccount(this, emailId, password, false) accountWasAdded = true EeloAccountCreator.createAccount(applicationContext, emailId, password, false) } } Loading @@ -1709,21 +1727,22 @@ open class MessageList : if (emailId == account.email) { if (account.name == null) { // we need to fix an old bug account.name = emailId Preferences.getPreferences(this).saveAccount(account) Preferences.getPreferences(applicationContext).saveAccount(account) } accountIsSignedIn = true break } } if (!accountIsSignedIn) { EeloAccountCreator.createAccount(this, emailId, "", true) accountWasAdded = true EeloAccountCreator.createAccount(applicationContext, emailId, "", true) } } return accountWasAdded } catch (e: SecurityException) { e.printStackTrace() false Timber.e(e) } lifecycleScope.launch(Dispatchers.Main) { onAccountConfigurationFinish(savedInstanceState) } } } Loading app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupBasics.java +37 −24 Original line number Diff line number Diff line /* * Copyright ECORP SAS 2022 * * this program is free software: you can redistribute it and/or modify * it under the terms of the gnu general public license as published by * the free software foundation, either version 3 of the license, or * Copyright ECORP SAS 2022d * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * this program is distributed in the hope that it will be useful, * but without any warranty; without even the implied warranty of * merchantability or fitness for a particular purpose. see the * gnu general public license for more details. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * you should have received a copy of the gnu general public license * along with this program. if not, see <https://www.gnu.org/licenses/>. * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package com.fsck.k9.activity.setup; Loading @@ -38,6 +37,7 @@ import com.fsck.k9.EmailAddressValidator; import com.fsck.k9.Preferences; import com.fsck.k9.account.AccountCreator; import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; import com.fsck.k9.activity.setup.accountmanager.MailAutoConfigDiscoveryHelper; import com.fsck.k9.autodiscovery.api.DiscoveredServerSettings; import com.fsck.k9.autodiscovery.api.DiscoveryResults; import com.fsck.k9.autodiscovery.api.DiscoveryTarget; Loading @@ -55,6 +55,7 @@ import com.fsck.k9.view.ClientCertificateSpinner; import com.fsck.k9.view.ClientCertificateSpinner.OnClientCertificateChangedListener; import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputLayout; import com.lamonjush.fullscreenloadingdialog.FullScreenLoadingDialog; import org.openintents.openpgp.util.OpenPgpProviderUtil; import timber.log.Timber; Loading Loading @@ -332,22 +333,34 @@ public class AccountSetupBasics extends K9Activity if(provider != null && provider.toString().trim().equals("GMAIL")){ Intent intent = new Intent(android.provider.Settings.ACTION_ADD_ACCOUNT); startActivity(intent); return; } else { ConnectionSettings extraConnectionSettings = ExtraAccountDiscovery.discover(email); if (extraConnectionSettings != null) { finishAutoSetup(extraConnectionSettings); return; } ConnectionSettings connectionSettings = providersXmlDiscoveryDiscover(email, DiscoveryTarget.INCOMING_AND_OUTGOING); ConnectionSettings connectionSettings = providersXmlDiscoveryDiscover(email, DiscoveryTarget.INCOMING_AND_OUTGOING); if (connectionSettings != null) { finishAutoSetup(connectionSettings); } else { // We don't have default settings for this account, start the manual setup process. onManualSetup(); return; } // We don't have predefine configuration, try to retrieve it by api call FullScreenLoadingDialog.getInstance() .setSpinKitColor(R.color.color_default_accent) .show(this); MailAutoConfigDiscoveryHelper.INSTANCE.retrieveConfiguration(email, this, config -> { FullScreenLoadingDialog.getInstance().dismiss(); if (config != null) { finishAutoSetup(config); return; } // We can't find default settings for this account, start the manual setup process. onManualSetup(); }); } @Override Loading Loading
app/autodiscovery/providersxml/src/main/res/xml/providers.xml +0 −13 Original line number Diff line number Diff line Loading @@ -717,17 +717,4 @@ <incoming uri="imap+ssl+://mail.fairnatics.net" username="$email" /> <outgoing uri="smtp+tls+://mail.fairnatics.net:25" username="$email" /> </provider> <!-- eFoundation --> <provider id="e.foundation" label="/e/" domain="e.email"> <incoming uri="imap+ssl+://mail.ecloud.global" username="$email" /> <outgoing uri="smtp+tls+://mail.ecloud.global" username="$email" /> </provider> <!-- eeo --> <provider id="eeo.one" label="eeo" domain="eeo.one"> <incoming uri="imap+ssl+://mail.eeo.one" username="$email" /> <outgoing uri="smtp+tls+://mail.eeo.one" username="$email" /> </provider> </providers>
app/k9mail/proguard-rules.pro +43 −0 Original line number Diff line number Diff line Loading @@ -49,3 +49,46 @@ # OkHttp platform used only on JVM and when Conscrypt dependency is available. -dontwarn okhttp3.internal.platform.ConscryptPlatform # Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and # EnclosingMethod is required to use InnerClasses. -keepattributes Signature, InnerClasses, EnclosingMethod # Retrofit does reflection on method and parameter annotations. -keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations # Keep annotation default values (e.g., retrofit2.http.Field.encoded). -keepattributes AnnotationDefault # Retain service method parameters when optimizing. -keepclassmembers,allowshrinking,allowobfuscation interface * { @retrofit2.http.* <methods>; } # Ignore annotation used for build tooling. -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement # Guarded by a NoClassDefFoundError try/catch and only used when on the classpath. -dontwarn kotlin.Unit # Top-level functions that can only be used by Kotlin. -dontwarn retrofit2.KotlinExtensions -dontwarn retrofit2.KotlinExtensions$* # With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy # and replaces all potential values with null. Explicitly keeping the interfaces prevents this. -if interface * { @retrofit2.http.* <methods>; } -keep,allowobfuscation interface <1> # Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items). -keep,allowobfuscation,allowshrinking interface retrofit2.Call -keep,allowobfuscation,allowshrinking class retrofit2.Response # With R8 full mode generic signatures are stripped for classes that are not # kept. Suspend functions are wrapped in continuations where the type argument # is used. -keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation -keep class org.simpleframework.xml.** { *; } -keep class com.fsck.k9.activity.setup.accountmanager.** { *; } No newline at end of file
app/ui/legacy/build.gradle +2 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,8 @@ dependencies { implementation "com.squareup.retrofit2:retrofit:${versions.retrofit}" implementation "com.squareup.retrofit2:converter-simplexml:${versions.retrofit}" implementation "com.github.fahim44:FullScreenLoadingDialog:1.0.6" } android { Loading
app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +63 −44 Original line number Diff line number Diff line /* * Copyright ECORP SAS 2022 * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package com.fsck.k9.activity import android.accounts.AccountManager Loading Loading @@ -28,6 +44,7 @@ import androidx.drawerlayout.widget.DrawerLayout.DrawerListener import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentTransaction import androidx.lifecycle.Observer import androidx.lifecycle.lifecycleScope import com.fsck.k9.Account import com.fsck.k9.Account.SortType import com.fsck.k9.K9 Loading Loading @@ -74,6 +91,8 @@ import com.fsck.k9.view.ViewSwitcher import com.fsck.k9.view.ViewSwitcher.OnSwitchCompleteListener import com.google.android.material.snackbar.Snackbar import com.mikepenz.materialdrawer.util.getOptimalDrawerWidth import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import org.koin.android.ext.android.inject import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.core.component.KoinComponent Loading Loading @@ -142,17 +161,17 @@ open class MessageList : public override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setLayout(R.layout.message_list_loading) var accounts = preferences.accounts val accounts = preferences.accounts deleteIncompleteAccounts(accounts) accountManager = AccountManager.get(this) // TODO remove old accounts automatically if (addNewAccountsAutomatically(accounts)) { accounts = preferences.accounts addNewAccountsAutomatically(accounts, savedInstanceState) } private fun onAccountConfigurationFinish(savedInstanceState: Bundle?) { val accounts = preferences.accounts val hasAccountSetup = accounts.any { it.isFinishedSetup } if (!hasAccountSetup) { AccountSetupBasics.actionNewAccount(this) Loading Loading @@ -1679,11 +1698,11 @@ open class MessageList : val messageViewOnly: Boolean = false ) private fun addNewAccountsAutomatically(accounts: List<Account>): Boolean { return try { private fun addNewAccountsAutomatically(accounts: List<Account>, savedInstanceState: Bundle?) { lifecycleScope.launch(Dispatchers.IO) { try { val eeloAccounts: Array<android.accounts.Account> = getEeloAccountsOnDevice() val googleAccounts: Array<android.accounts.Account> = getGoogleAccountsOnDevice() var accountWasAdded = false for (eeloAccount in eeloAccounts) { val emailId: String = accountManager.getUserData(eeloAccount, ACCOUNT_EMAIL_ADDRESS_KEY) if (!emailId.contains("@")) continue Loading @@ -1696,8 +1715,7 @@ open class MessageList : } if (!accountIsSignedIn) { val password: String = accountManager.getPassword(eeloAccount) EeloAccountCreator.createAccount(this, emailId, password, false) accountWasAdded = true EeloAccountCreator.createAccount(applicationContext, emailId, password, false) } } Loading @@ -1709,21 +1727,22 @@ open class MessageList : if (emailId == account.email) { if (account.name == null) { // we need to fix an old bug account.name = emailId Preferences.getPreferences(this).saveAccount(account) Preferences.getPreferences(applicationContext).saveAccount(account) } accountIsSignedIn = true break } } if (!accountIsSignedIn) { EeloAccountCreator.createAccount(this, emailId, "", true) accountWasAdded = true EeloAccountCreator.createAccount(applicationContext, emailId, "", true) } } return accountWasAdded } catch (e: SecurityException) { e.printStackTrace() false Timber.e(e) } lifecycleScope.launch(Dispatchers.Main) { onAccountConfigurationFinish(savedInstanceState) } } } Loading
app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupBasics.java +37 −24 Original line number Diff line number Diff line /* * Copyright ECORP SAS 2022 * * this program is free software: you can redistribute it and/or modify * it under the terms of the gnu general public license as published by * the free software foundation, either version 3 of the license, or * Copyright ECORP SAS 2022d * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * this program is distributed in the hope that it will be useful, * but without any warranty; without even the implied warranty of * merchantability or fitness for a particular purpose. see the * gnu general public license for more details. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * you should have received a copy of the gnu general public license * along with this program. if not, see <https://www.gnu.org/licenses/>. * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package com.fsck.k9.activity.setup; Loading @@ -38,6 +37,7 @@ import com.fsck.k9.EmailAddressValidator; import com.fsck.k9.Preferences; import com.fsck.k9.account.AccountCreator; import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; import com.fsck.k9.activity.setup.accountmanager.MailAutoConfigDiscoveryHelper; import com.fsck.k9.autodiscovery.api.DiscoveredServerSettings; import com.fsck.k9.autodiscovery.api.DiscoveryResults; import com.fsck.k9.autodiscovery.api.DiscoveryTarget; Loading @@ -55,6 +55,7 @@ import com.fsck.k9.view.ClientCertificateSpinner; import com.fsck.k9.view.ClientCertificateSpinner.OnClientCertificateChangedListener; import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputLayout; import com.lamonjush.fullscreenloadingdialog.FullScreenLoadingDialog; import org.openintents.openpgp.util.OpenPgpProviderUtil; import timber.log.Timber; Loading Loading @@ -332,22 +333,34 @@ public class AccountSetupBasics extends K9Activity if(provider != null && provider.toString().trim().equals("GMAIL")){ Intent intent = new Intent(android.provider.Settings.ACTION_ADD_ACCOUNT); startActivity(intent); return; } else { ConnectionSettings extraConnectionSettings = ExtraAccountDiscovery.discover(email); if (extraConnectionSettings != null) { finishAutoSetup(extraConnectionSettings); return; } ConnectionSettings connectionSettings = providersXmlDiscoveryDiscover(email, DiscoveryTarget.INCOMING_AND_OUTGOING); ConnectionSettings connectionSettings = providersXmlDiscoveryDiscover(email, DiscoveryTarget.INCOMING_AND_OUTGOING); if (connectionSettings != null) { finishAutoSetup(connectionSettings); } else { // We don't have default settings for this account, start the manual setup process. onManualSetup(); return; } // We don't have predefine configuration, try to retrieve it by api call FullScreenLoadingDialog.getInstance() .setSpinKitColor(R.color.color_default_accent) .show(this); MailAutoConfigDiscoveryHelper.INSTANCE.retrieveConfiguration(email, this, config -> { FullScreenLoadingDialog.getInstance().dismiss(); if (config != null) { finishAutoSetup(config); return; } // We can't find default settings for this account, start the manual setup process. onManualSetup(); }); } @Override Loading