mirror of
https://github.com/owncloud/android-library.git
synced 2025-07-09 15:38:41 +00:00
Compare commits
3 Commits
5a8f267325
...
c6508e6e20
Author | SHA1 | Date | |
---|---|---|---|
|
c6508e6e20 | ||
|
bcd7fead11 | ||
|
69355cfeb0 |
@ -36,7 +36,6 @@ import com.owncloud.android.lib.common.http.HttpClient;
|
|||||||
import com.owncloud.android.lib.common.http.HttpConstants;
|
import com.owncloud.android.lib.common.http.HttpConstants;
|
||||||
import com.owncloud.android.lib.common.http.methods.HttpBaseMethod;
|
import com.owncloud.android.lib.common.http.methods.HttpBaseMethod;
|
||||||
import com.owncloud.android.lib.common.utils.RandomUtils;
|
import com.owncloud.android.lib.common.utils.RandomUtils;
|
||||||
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
|
|
||||||
import okhttp3.Cookie;
|
import okhttp3.Cookie;
|
||||||
import okhttp3.HttpUrl;
|
import okhttp3.HttpUrl;
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
@ -59,7 +58,6 @@ public class OwnCloudClient extends HttpClient {
|
|||||||
private OwnCloudCredentials mCredentials = null;
|
private OwnCloudCredentials mCredentials = null;
|
||||||
private int mInstanceNumber;
|
private int mInstanceNumber;
|
||||||
private Uri mBaseUri;
|
private Uri mBaseUri;
|
||||||
private OwnCloudVersion mVersion = null;
|
|
||||||
private OwnCloudAccount mAccount;
|
private OwnCloudAccount mAccount;
|
||||||
private final ConnectionValidator mConnectionValidator;
|
private final ConnectionValidator mConnectionValidator;
|
||||||
private Object mRequestMutex = new Object();
|
private Object mRequestMutex = new Object();
|
||||||
@ -185,7 +183,7 @@ public class OwnCloudClient extends HttpClient {
|
|||||||
return (mCredentials instanceof OwnCloudAnonymousCredentials || mAccount == null)
|
return (mCredentials instanceof OwnCloudAnonymousCredentials || mAccount == null)
|
||||||
? Uri.parse(mBaseUri + WEBDAV_FILES_PATH_4_0)
|
? Uri.parse(mBaseUri + WEBDAV_FILES_PATH_4_0)
|
||||||
: Uri.parse(mBaseUri + WEBDAV_FILES_PATH_4_0 + AccountUtils.getUserId(
|
: Uri.parse(mBaseUri + WEBDAV_FILES_PATH_4_0 + AccountUtils.getUserId(
|
||||||
mAccount.getSavedAccount(), getContext()
|
mAccount.getSavedAccount(), getContext()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -194,7 +192,7 @@ public class OwnCloudClient extends HttpClient {
|
|||||||
return mCredentials instanceof OwnCloudAnonymousCredentials
|
return mCredentials instanceof OwnCloudAnonymousCredentials
|
||||||
? Uri.parse(mBaseUri + WEBDAV_UPLOADS_PATH_4_0)
|
? Uri.parse(mBaseUri + WEBDAV_UPLOADS_PATH_4_0)
|
||||||
: Uri.parse(mBaseUri + WEBDAV_UPLOADS_PATH_4_0 + AccountUtils.getUserId(
|
: Uri.parse(mBaseUri + WEBDAV_UPLOADS_PATH_4_0 + AccountUtils.getUserId(
|
||||||
mAccount.getSavedAccount(), getContext()
|
mAccount.getSavedAccount(), getContext()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -241,14 +239,6 @@ public class OwnCloudClient extends HttpClient {
|
|||||||
HttpUrl.parse(mBaseUri.toString()));
|
HttpUrl.parse(mBaseUri.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public OwnCloudVersion getOwnCloudVersion() {
|
|
||||||
return mVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOwnCloudVersion(OwnCloudVersion version) {
|
|
||||||
mVersion = version;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OwnCloudAccount getAccount() {
|
public OwnCloudAccount getAccount() {
|
||||||
return mAccount;
|
return mAccount;
|
||||||
}
|
}
|
||||||
|
@ -94,26 +94,6 @@ public class AccountUtils {
|
|||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the stored server version corresponding to an OC account.
|
|
||||||
*
|
|
||||||
* @param account An OC account
|
|
||||||
* @param context Application context
|
|
||||||
* @return Version of the OC server, according to last check
|
|
||||||
*/
|
|
||||||
public static OwnCloudVersion getServerVersionForAccount(Account account, Context context) {
|
|
||||||
AccountManager ama = AccountManager.get(context);
|
|
||||||
OwnCloudVersion version = null;
|
|
||||||
try {
|
|
||||||
String versionString = ama.getUserData(account, Constants.KEY_OC_VERSION);
|
|
||||||
version = new OwnCloudVersion(versionString);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Timber.e(e, "Couldn't get a the server version for an account");
|
|
||||||
}
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
@ -209,11 +189,6 @@ public class AccountUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Constants {
|
public static class Constants {
|
||||||
/**
|
|
||||||
* Version should be 3 numbers separated by dot so it can be parsed by
|
|
||||||
* {@link OwnCloudVersion}
|
|
||||||
*/
|
|
||||||
public static final String KEY_OC_VERSION = "oc_version";
|
|
||||||
/**
|
/**
|
||||||
* Base url should point to owncloud installation without trailing / ie:
|
* Base url should point to owncloud installation without trailing / ie:
|
||||||
* http://server/path or https://owncloud.server
|
* http://server/path or https://owncloud.server
|
||||||
|
Loading…
x
Reference in New Issue
Block a user