-/* ownCloud Android client application
- * Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ * ownCloud Android client application
+ *
+ * @author David A. Velasco
+ * Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
+import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
-import com.owncloud.android.utils.Log_OC;
import android.accounts.Account;
import android.accounts.AccountManager;
/**
* Remote operation that checks the version of an ownCloud server and stores it locally
- *
- * @author David A. Velasco
*/
public class UpdateOCVersionOperation extends RemoteOperation {
private Account mAccount;
private Context mContext;
+ private OwnCloudVersion mOwnCloudVersion;
public UpdateOCVersionOperation(Account account, Context context) {
mAccount = account;
mContext = context;
+ mOwnCloudVersion = null;
}
if (response != null) {
JSONObject json = new JSONObject(response);
if (json != null && json.getString("version") != null) {
- OwnCloudVersion ocver = new OwnCloudVersion(json.getString("version"));
- if (ocver.isVersionValid()) {
- accountMngr.setUserData(mAccount, Constants.KEY_OC_VERSION, ocver.toString());
- Log_OC.d(TAG, "Got new OC version " + ocver.toString());
+
+ String version = json.getString("version");
+ mOwnCloudVersion = new OwnCloudVersion(version);
+ if (mOwnCloudVersion.isVersionValid()) {
+ accountMngr.setUserData(mAccount, Constants.KEY_OC_VERSION, mOwnCloudVersion.getVersion());
+ Log_OC.d(TAG, "Got new OC version " + mOwnCloudVersion.toString());
+
result = new RemoteOperationResult(ResultCode.OK);
} else {
return result;
}
+
+ public OwnCloudVersion getOCVersion() {
+ return mOwnCloudVersion;
+ }
+
}