mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 16:06:08 +00:00
Include new isServerVersionSupported parameter to log out <10 accounts
This commit is contained in:
parent
8ba4fa5960
commit
20e4317bd9
@ -381,16 +381,19 @@ public class OwnCloudClient extends HttpClient {
|
|||||||
* cannot be invalidated with the given arguments.
|
* cannot be invalidated with the given arguments.
|
||||||
*/
|
*/
|
||||||
private boolean shouldInvalidateAccountCredentials(int httpStatusCode) {
|
private boolean shouldInvalidateAccountCredentials(int httpStatusCode) {
|
||||||
|
boolean isServerVersionSupported = AccountUtils.getServerVersionForAccount(getAccount().getSavedAccount(),
|
||||||
|
getContext()).isServerVersionSupported();
|
||||||
|
|
||||||
boolean should = (httpStatusCode == HttpConstants.HTTP_UNAUTHORIZED); // invalid credentials
|
boolean shouldInvalidateAccountCredentials =
|
||||||
|
(httpStatusCode == HttpConstants.HTTP_UNAUTHORIZED || !isServerVersionSupported);
|
||||||
|
|
||||||
should &= (mCredentials != null && // real credentials
|
shouldInvalidateAccountCredentials &= (mCredentials != null && // real credentials
|
||||||
!(mCredentials instanceof OwnCloudCredentialsFactory.OwnCloudAnonymousCredentials));
|
!(mCredentials instanceof OwnCloudCredentialsFactory.OwnCloudAnonymousCredentials));
|
||||||
|
|
||||||
// test if have all the needed to effectively invalidate ...
|
// test if have all the needed to effectively invalidate ...
|
||||||
should &= (mAccount != null && mAccount.getSavedAccount() != null && getContext() != null);
|
shouldInvalidateAccountCredentials &= (mAccount != null && mAccount.getSavedAccount() != null && getContext() != null);
|
||||||
|
|
||||||
return should;
|
return shouldInvalidateAccountCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,8 +45,8 @@ class OwnCloudVersion(version: String) : Comparable<OwnCloudVersion>, Parcelable
|
|||||||
INVALID_ZERO_VERSION
|
INVALID_ZERO_VERSION
|
||||||
}
|
}
|
||||||
|
|
||||||
val isVersionLowerThan10: Boolean
|
val isServerVersionSupported: Boolean
|
||||||
get() = mVersion < VERSION_10
|
get() = mVersion >= MINIMUN_VERSION_SUPPORTED
|
||||||
|
|
||||||
val isPublicSharingWriteOnlySupported: Boolean
|
val isPublicSharingWriteOnlySupported: Boolean
|
||||||
get() = mVersion >= MINIMUM_VERSION_WITH_WRITE_ONLY_PUBLIC_SHARING
|
get() = mVersion >= MINIMUM_VERSION_WITH_WRITE_ONLY_PUBLIC_SHARING
|
||||||
@ -144,6 +144,8 @@ class OwnCloudVersion(version: String) : Comparable<OwnCloudVersion>, Parcelable
|
|||||||
|
|
||||||
private const val MINIMUM_VERSION_WITH_WRITE_ONLY_PUBLIC_SHARING = 0xA000100 // 10.0.1
|
private const val MINIMUM_VERSION_WITH_WRITE_ONLY_PUBLIC_SHARING = 0xA000100 // 10.0.1
|
||||||
|
|
||||||
|
private const val MINIMUN_VERSION_SUPPORTED = 0xA000000 // 10.0.0
|
||||||
|
|
||||||
private const val INVALID_ZERO_VERSION = "0.0.0"
|
private const val INVALID_ZERO_VERSION = "0.0.0"
|
||||||
|
|
||||||
private const val MAX_DOTS = 3
|
private const val MAX_DOTS = 3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user