Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23e9e4f5 authored by Romain Hunault's avatar Romain Hunault 🚴🏻
Browse files

Merge branch 'sprint_delhi' into 'master'

[RELEASE] Sprint delhi

See merge request e/apps/Mail!13
parents d7b94c88 703af5ea
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ public abstract class OAuth2AuthorizationCodeFlowTokenProvider {
        return authTokens.get(email);
    }

    protected abstract void showAuthDialog(String email);
    protected abstract void showAuthDialog(String email) throws AuthenticationFailedException;

    /**
     * get refresh token got before
+3 −1
Original line number Diff line number Diff line
package foundation.e.mail.mail.oauth;

import foundation.e.mail.mail.AuthenticationFailedException;
import foundation.e.mail.mail.MessagingException;

public abstract class SpecificOAuth2TokenProvider {

    public abstract OAuth2AuthorizationCodeFlowTokenProvider.Tokens exchangeCode(String username, String code) throws AuthenticationFailedException;

    public abstract String refreshToken(String username, String refreshToken) throws AuthenticationFailedException;

    public abstract void showAuthDialog();
    public abstract void showAuthDialog() throws AuthenticationFailedException;
}
+2 −1
Original line number Diff line number Diff line
@@ -397,8 +397,9 @@ class ImapConnection {
            return attemptXOAuth2();
        } catch (NegativeImapResponseException e) {
            //TODO: Check response code so we don't needlessly invalidate the token.
            if(e.getMessage().contains("Too many simultaneous connections"))
                throw new MessagingException("Too many simultaneous connections");
            oauthTokenProvider.invalidateToken(settings.getUsername());

            if (!retryXoauth2WithNewToken) {
                throw handlePermanentXoauth2Failure(e);
            } else {
+4 −3
Original line number Diff line number Diff line
@@ -621,10 +621,11 @@ public class Account implements BaseAccount, AccountConfig {
        // TODO: Remove preference settings that may exist for individual
        // folders in the account.
        editor.commit();

        if(getEmail() != null) {
            Globals.getOAuth2TokenProvider().invalidateToken(getEmail());
            Globals.getOAuth2TokenProvider().disconnectEmailWithK9(getEmail());
        }
    }

    private static int findNewAccountNumber(List<Integer> accountNumbers) {
        int newAccountNumber = -1;
+4 −1
Original line number Diff line number Diff line
package foundation.e.mail.account;


import foundation.e.mail.mail.AuthenticationFailedException;
import retrofit2.Call;
import retrofit2.GsonConverterFactory;
import retrofit2.Retrofit;
@@ -30,7 +31,9 @@ public class GmailOAuth2TokenStore extends AndroidSpecificOAuth2TokenProvider {
    }

    @Override
    public void showAuthDialog() {
    public void showAuthDialog() throws AuthenticationFailedException {
        if(promptRequestHandler == null)
            throw new AuthenticationFailedException("No handler available");
        promptRequestHandler.handleGmailRedirectUrl(AUTHORIZATION_URL);
    }

Loading