From 59f1253a8609db4056f41a81f9c4754fefa83806 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Wed, 6 Jun 2018 07:45:26 +0200 Subject: [PATCH 1/2] do not use static context Signed-off-by: tobiasKaminsky --- .../authentication/AuthenticatorActivity.java | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java index 37789a69bd..5c7e6fc3d5 100644 --- a/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -242,10 +242,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity /// Identifier of operation in progress which result shouldn't be lost private long mWaitingForOpId = Long.MAX_VALUE; - private final String BASIC_TOKEN_TYPE = AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType(this)); - private final String OAUTH_TOKEN_TYPE = AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType(this)); - private final String SAML_TOKEN_TYPE = AccountTypeUtils.getAuthTokenTypeSamlSessionCookie( - MainApp.getAccountType(this)); + private String basicTokenType; + private String oauthTokenType; + private String samlTokenType; private boolean webViewLoginMethod; private String webViewUser; @@ -264,6 +263,10 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity //Log_OC.e(TAG, "onCreate init"); super.onCreate(savedInstanceState); + basicTokenType = AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType(this)); + oauthTokenType = AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType(this)); + samlTokenType = AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType(this)); + // delete cookies for webView deleteCookies(); @@ -561,11 +564,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity private String chooseAuthTokenType(boolean oauth, boolean saml) { if (saml) { - return SAML_TOKEN_TYPE; + return samlTokenType; } else if (oauth) { - return OAUTH_TOKEN_TYPE; + return oauthTokenType; } else { - return BASIC_TOKEN_TYPE; + return basicTokenType; } } @@ -911,10 +914,10 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity String password = savedInstanceState.getString(KEY_PASSWORD); OwnCloudCredentials credentials = null; - if (BASIC_TOKEN_TYPE.equals(mAuthTokenType)) { + if (basicTokenType.equals(mAuthTokenType)) { credentials = OwnCloudCredentialsFactory.newBasicCredentials(username, password); - } else if (OAUTH_TOKEN_TYPE.equals(mAuthTokenType)) { + } else if (oauthTokenType.equals(mAuthTokenType)) { credentials = OwnCloudCredentialsFactory.newBearerCredentials(mAuthToken); } @@ -1475,11 +1478,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity private boolean authSupported(AuthenticationMethod authMethod) { - return ((BASIC_TOKEN_TYPE.equals(mAuthTokenType) && + return ((basicTokenType.equals(mAuthTokenType) && AuthenticationMethod.BASIC_HTTP_AUTH.equals(authMethod)) || - (OAUTH_TOKEN_TYPE.equals(mAuthTokenType) && + (oauthTokenType.equals(mAuthTokenType) && AuthenticationMethod.BEARER_TOKEN.equals(authMethod)) || - (SAML_TOKEN_TYPE.equals(mAuthTokenType) && + (samlTokenType.equals(mAuthTokenType) && AuthenticationMethod.SAML_WEB_SSO.equals(authMethod)) ); } @@ -2020,9 +2023,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity public void onCheckClick(View view) { CheckBox oAuth2Check = (CheckBox) view; if (oAuth2Check.isChecked()) { - mAuthTokenType = OAUTH_TOKEN_TYPE; + mAuthTokenType = oauthTokenType; } else { - mAuthTokenType = BASIC_TOKEN_TYPE; + mAuthTokenType = basicTokenType; } updateAuthenticationPreFragmentVisibility(); } From 75c61b2407a57ab0dc3670dfe7ffe42a28ffdd49 Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Sat, 9 Jun 2018 13:34:54 +0200 Subject: [PATCH 2/2] upgrade Android gradle plugin --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index eb7002bbda..ce33995522 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.2' + classpath 'com.android.tools.build:gradle:3.1.3' classpath 'com.google.gms:google-services:3.0.0' classpath 'org.codehaus.groovy:groovy-all:2.4.12' classpath('com.dicedmelon.gradle:jacoco-android:0.1.2') {