Loading k9mail-library/src/main/java/com/fsck/k9/mail/oauth/OAuth2TokenProvider.java +1 −30 Original line number Diff line number Diff line Loading @@ -3,8 +3,6 @@ package com.fsck.k9.mail.oauth; import java.util.List; import android.app.Activity; import com.fsck.k9.mail.AuthenticationFailedException; import com.fsck.k9.mail.OAuth2NeedUserPromptException; Loading @@ -16,34 +14,7 @@ public interface OAuth2TokenProvider { int OAUTH2_TIMEOUT = 30000; /** * @return Accounts suitable for OAuth 2.0 token provision. */ List<String> getAccounts(); /** * Provides an asynchronous response to an * {@link OAuth2TokenProvider#authorizeAPI(String, Activity, OAuth2TokenProviderAuthCallback)} request */ interface OAuth2TokenProviderAuthCallback { void success(); void failure(AuthorizationException e); } /** * Request API authorization. This is a foreground action that may produce a dialog to interact with. * * @param username * Username * @param activity * The responsible activity * @param callback * A callback to process the asynchronous response */ void authorizeAPI(String username, Activity activity, OAuth2TokenProviderAuthCallback callback); boolean exchangeCode(String username, String code); /** * Fetch a token. No guarantees are provided for validity. Loading k9mail-library/src/test/java/com/fsck/k9/mail/store/imap/ImapConnectionTest.java +1 −5 Original line number Diff line number Diff line Loading @@ -1037,14 +1037,10 @@ public class ImapConnectionTest { } @Override public List<String> getAccounts() { public boolean exchangeCode(String username, String code) { throw new UnsupportedOperationException(); } @Override public void authorizeAPI(String username, Activity activity, OAuth2TokenProviderAuthCallback callback) { throw new UnsupportedOperationException(); } }; } } k9mail/build.gradle +2 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ dependencies { compile "com.jakewharton.timber:timber:${timberVersion}" compile 'net.jcip:jcip-annotations:1.0' compile 'com.squareup.retrofit2:retrofit:2.3.0' compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta3' compile 'com.android.support.constraint:constraint-layout:1.0.2' androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' Loading k9mail/src/main/java/com/fsck/k9/Account.java +5 −1 Original line number Diff line number Diff line Loading @@ -16,10 +16,12 @@ import java.util.concurrent.ConcurrentHashMap; import android.content.ContentResolver; import android.content.Context; import android.content.SharedPreferences; import android.database.Cursor; import android.graphics.Color; import android.net.Uri; import com.fsck.k9.account.GmailOAuth2TokenStore; import com.fsck.k9.activity.AccountConfig; import com.fsck.k9.activity.setup.CheckDirection; import com.fsck.k9.helper.EmailHelper; Loading @@ -29,7 +31,6 @@ import com.fsck.k9.mail.ServerSettings; import com.fsck.k9.mail.Transport; import timber.log.Timber; import com.fsck.k9.account.AndroidAccountOAuth2TokenStore; import com.fsck.k9.helper.Utility; import com.fsck.k9.mail.Address; import com.fsck.k9.mail.MessagingException; Loading Loading @@ -610,6 +611,9 @@ public class Account implements BaseAccount, AccountConfig { // TODO: Remove preference settings that may exist for individual // folders in the account. editor.commit(); SharedPreferences oauth2SP = ((GmailOAuth2TokenStore) Globals.getOAuth2TokenProvider()).getSharedPreference(); oauth2SP.edit().remove(getEmail()).apply(); } private static int findNewAccountNumber(List<Integer> accountNumbers) { Loading k9mail/src/main/java/com/fsck/k9/K9.java +2 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.support.annotation.StringRes; import com.fsck.k9.Account.SortType; import com.fsck.k9.account.AndroidAccountOAuth2TokenStore; import com.fsck.k9.account.GmailOAuth2TokenStore; import com.fsck.k9.activity.MessageCompose; import com.fsck.k9.activity.UpgradeDatabases; import com.fsck.k9.controller.MessagingController; Loading Loading @@ -531,7 +532,7 @@ public class K9 extends Application { super.onCreate(); app = this; Globals.setContext(this); Globals.setOAuth2TokenProvider(new AndroidAccountOAuth2TokenStore(this)); Globals.setOAuth2TokenProvider(new GmailOAuth2TokenStore(this)); K9MailLib.setDebugStatus(new K9MailLib.DebugStatus() { @Override public boolean enabled() { Loading Loading
k9mail-library/src/main/java/com/fsck/k9/mail/oauth/OAuth2TokenProvider.java +1 −30 Original line number Diff line number Diff line Loading @@ -3,8 +3,6 @@ package com.fsck.k9.mail.oauth; import java.util.List; import android.app.Activity; import com.fsck.k9.mail.AuthenticationFailedException; import com.fsck.k9.mail.OAuth2NeedUserPromptException; Loading @@ -16,34 +14,7 @@ public interface OAuth2TokenProvider { int OAUTH2_TIMEOUT = 30000; /** * @return Accounts suitable for OAuth 2.0 token provision. */ List<String> getAccounts(); /** * Provides an asynchronous response to an * {@link OAuth2TokenProvider#authorizeAPI(String, Activity, OAuth2TokenProviderAuthCallback)} request */ interface OAuth2TokenProviderAuthCallback { void success(); void failure(AuthorizationException e); } /** * Request API authorization. This is a foreground action that may produce a dialog to interact with. * * @param username * Username * @param activity * The responsible activity * @param callback * A callback to process the asynchronous response */ void authorizeAPI(String username, Activity activity, OAuth2TokenProviderAuthCallback callback); boolean exchangeCode(String username, String code); /** * Fetch a token. No guarantees are provided for validity. Loading
k9mail-library/src/test/java/com/fsck/k9/mail/store/imap/ImapConnectionTest.java +1 −5 Original line number Diff line number Diff line Loading @@ -1037,14 +1037,10 @@ public class ImapConnectionTest { } @Override public List<String> getAccounts() { public boolean exchangeCode(String username, String code) { throw new UnsupportedOperationException(); } @Override public void authorizeAPI(String username, Activity activity, OAuth2TokenProviderAuthCallback callback) { throw new UnsupportedOperationException(); } }; } }
k9mail/build.gradle +2 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ dependencies { compile "com.jakewharton.timber:timber:${timberVersion}" compile 'net.jcip:jcip-annotations:1.0' compile 'com.squareup.retrofit2:retrofit:2.3.0' compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta3' compile 'com.android.support.constraint:constraint-layout:1.0.2' androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' Loading
k9mail/src/main/java/com/fsck/k9/Account.java +5 −1 Original line number Diff line number Diff line Loading @@ -16,10 +16,12 @@ import java.util.concurrent.ConcurrentHashMap; import android.content.ContentResolver; import android.content.Context; import android.content.SharedPreferences; import android.database.Cursor; import android.graphics.Color; import android.net.Uri; import com.fsck.k9.account.GmailOAuth2TokenStore; import com.fsck.k9.activity.AccountConfig; import com.fsck.k9.activity.setup.CheckDirection; import com.fsck.k9.helper.EmailHelper; Loading @@ -29,7 +31,6 @@ import com.fsck.k9.mail.ServerSettings; import com.fsck.k9.mail.Transport; import timber.log.Timber; import com.fsck.k9.account.AndroidAccountOAuth2TokenStore; import com.fsck.k9.helper.Utility; import com.fsck.k9.mail.Address; import com.fsck.k9.mail.MessagingException; Loading Loading @@ -610,6 +611,9 @@ public class Account implements BaseAccount, AccountConfig { // TODO: Remove preference settings that may exist for individual // folders in the account. editor.commit(); SharedPreferences oauth2SP = ((GmailOAuth2TokenStore) Globals.getOAuth2TokenProvider()).getSharedPreference(); oauth2SP.edit().remove(getEmail()).apply(); } private static int findNewAccountNumber(List<Integer> accountNumbers) { Loading
k9mail/src/main/java/com/fsck/k9/K9.java +2 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.support.annotation.StringRes; import com.fsck.k9.Account.SortType; import com.fsck.k9.account.AndroidAccountOAuth2TokenStore; import com.fsck.k9.account.GmailOAuth2TokenStore; import com.fsck.k9.activity.MessageCompose; import com.fsck.k9.activity.UpgradeDatabases; import com.fsck.k9.controller.MessagingController; Loading Loading @@ -531,7 +532,7 @@ public class K9 extends Application { super.onCreate(); app = this; Globals.setContext(this); Globals.setOAuth2TokenProvider(new AndroidAccountOAuth2TokenStore(this)); Globals.setOAuth2TokenProvider(new GmailOAuth2TokenStore(this)); K9MailLib.setDebugStatus(new K9MailLib.DebugStatus() { @Override public boolean enabled() { Loading