From d80ac412c0cf043d376aa6d0d13fc27d30f37c99 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Wed, 21 Jun 2017 10:52:02 +0200 Subject: [PATCH] use grey theme if no theming of elements is possible --- build.gradle | 3 ++- settings.gradle | 2 +- .../java/com/owncloud/android/MainApp.java | 3 ++- .../authentication/AuthenticatorActivity.java | 24 ++++++++++++------- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index db962cb621..f003ccfc2d 100644 --- a/build.gradle +++ b/build.gradle @@ -178,7 +178,8 @@ dependencies { compile name: 'touch-image-view' compile 'com.android.support:multidex:1.0.1' - compile 'com.github.nextcloud:android-library:1.0.21' +// compile 'com.github.nextcloud:android-library:1.0.21' + compile project(':nextcloud-android-library') compile "com.android.support:support-v4:${supportLibraryVersion}" compile "com.android.support:design:${supportLibraryVersion}" compile 'com.jakewharton:disklrucache:2.0.2' diff --git a/settings.gradle b/settings.gradle index fddff8ac90..cb1608d965 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':' +include ':nextcloud-android-library' \ No newline at end of file diff --git a/src/main/java/com/owncloud/android/MainApp.java b/src/main/java/com/owncloud/android/MainApp.java index d55fe15b31..21883a1445 100644 --- a/src/main/java/com/owncloud/android/MainApp.java +++ b/src/main/java/com/owncloud/android/MainApp.java @@ -105,7 +105,8 @@ public class MainApp extends MultiDexApplication { if (isSamlAuth) { OwnCloudClientManagerFactory.setDefaultPolicy(Policy.SINGLE_SESSION_PER_ACCOUNT); } else { - OwnCloudClientManagerFactory.setDefaultPolicy(Policy.ALWAYS_NEW_CLIENT); + OwnCloudClientManagerFactory + .setDefaultPolicy(Policy.SINGLE_SESSION_PER_ACCOUNT_IF_SERVER_SUPPORTS_SERVER_MONITORING); } // initialise thumbnails cache on background thread diff --git a/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java index 72cc08b32f..ac1f8ddaa3 100644 --- a/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -776,7 +776,13 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity OwnCloudCredentials credentials = null; if (BASIC_TOKEN_TYPE.equals(mAuthTokenType)) { - credentials = OwnCloudCredentialsFactory.newBasicCredentials(username, password); + String version = savedInstanceState.getString(KEY_OC_VERSION); + OwnCloudVersion ocVersion = (version != null) ? new OwnCloudVersion(version) : null; + credentials = OwnCloudCredentialsFactory.newBasicCredentials( + username, + password, + (ocVersion != null && ocVersion.isPreemptiveAuthenticationPreferred()) + ); } else if (OAUTH_TOKEN_TYPE.equals(mAuthTokenType)) { credentials = OwnCloudCredentialsFactory.newBearerCredentials(mAuthToken); @@ -1088,12 +1094,10 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity return; } - if (AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType()). - equals(mAuthTokenType)) { - + if (AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType()).equals(mAuthTokenType)) { startOauthorization(); - } else if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()). - equals(mAuthTokenType)) { + } else if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()) + .equals(mAuthTokenType)) { startSamlBasedFederatedSingleSignOnAuthorization(); } else { @@ -1125,8 +1129,12 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity dialog.show(getSupportFragmentManager(), WAIT_DIALOG_TAG); /// validate credentials accessing the root folder - OwnCloudCredentials credentials = OwnCloudCredentialsFactory.newBasicCredentials(username, - password); + OwnCloudCredentials credentials = OwnCloudCredentialsFactory.newBasicCredentials( + username, + password, + (mServerInfo != null && mServerInfo.mVersion != null + && mServerInfo.mVersion.isPreemptiveAuthenticationPreferred()) + ); accessRootFolder(credentials); }