Disabled Gmail web OAuth

pull/209/head
M66B 2 years ago
parent 566bfbf447
commit ada1b48166

@ -47,7 +47,6 @@ import android.text.style.RelativeSizeSpan;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.TouchDelegate;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
@ -278,9 +277,9 @@ public class FragmentSetup extends FragmentBase {
Resources res = context.getResources(); Resources res = context.getResources();
String pkg = context.getPackageName(); String pkg = context.getPackageName();
List<EmailProvider> providers = EmailProvider.loadProfiles(context);
boolean web = false; boolean web = false;
List<EmailProvider> providers = EmailProvider.loadProfiles(context);
for (EmailProvider provider : providers) for (EmailProvider provider : providers)
if ("gmail".equals(provider.id) && if ("gmail".equals(provider.id) &&
provider.oauth != null && provider.oauth != null &&
@ -291,6 +290,7 @@ public class FragmentSetup extends FragmentBase {
int order = 1; int order = 1;
// Gmail / account manager
String gmail = getString(web ? R.string.title_setup_android : R.string.title_setup_oauth, String gmail = getString(web ? R.string.title_setup_android : R.string.title_setup_oauth,
getString(R.string.title_setup_gmail)); getString(R.string.title_setup_gmail));
MenuItem item = menu.add(Menu.FIRST, R.string.title_setup_gmail, order++, gmail); MenuItem item = menu.add(Menu.FIRST, R.string.title_setup_gmail, order++, gmail);
@ -298,6 +298,7 @@ public class FragmentSetup extends FragmentBase {
if (resid != 0) if (resid != 0)
item.setIcon(resid); item.setIcon(resid);
// OAuth
for (EmailProvider provider : providers) for (EmailProvider provider : providers)
if (provider.oauth != null && if (provider.oauth != null &&
(provider.oauth.enabled || BuildConfig.DEBUG) && (provider.oauth.enabled || BuildConfig.DEBUG) &&

@ -152,6 +152,9 @@ public class ServiceAuthenticator extends Authenticator {
private static void OAuthRefresh(Context context, String id, AuthState authState, boolean expire, long keep_alive) private static void OAuthRefresh(Context context, String id, AuthState authState, boolean expire, long keep_alive)
throws MessagingException { throws MessagingException {
try { try {
if ("gmail".equals(id) && !BuildConfig.DEBUG)
return;
long now = new Date().getTime(); long now = new Date().getTime();
Long expiration = authState.getAccessTokenExpirationTime(); Long expiration = authState.getAccessTokenExpirationTime();
if (expiration != null && expiration - keep_alive < now) { if (expiration != null && expiration - keep_alive < now) {

@ -24,7 +24,7 @@
askAccount="true" askAccount="true"
authorizationEndpoint="https://accounts.google.com/o/oauth2/auth" authorizationEndpoint="https://accounts.google.com/o/oauth2/auth"
clientId="803253368361-11ias0ee6bqhvdi4f21fs1lh7fsb0il2.apps.googleusercontent.com" clientId="803253368361-11ias0ee6bqhvdi4f21fs1lh7fsb0il2.apps.googleusercontent.com"
enabled="true" enabled="false"
privacy="https://policies.google.com/privacy" privacy="https://policies.google.com/privacy"
prompt="consent" prompt="consent"
redirectUri="eu.faircode.email:/" redirectUri="eu.faircode.email:/"

Loading…
Cancel
Save