OC-3079: (fix bug) Two send options appear after send and mail with a ownCloud file
[pub/Android/ownCloud.git] / src / com / owncloud / android / operations / UpdateOCVersionOperation.java
index 22fdc93..c878ede 100644 (file)
@@ -47,11 +47,13 @@ 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;
     }
     
     
@@ -74,10 +76,15 @@ public class UpdateOCVersionOperation extends RemoteOperation {
                 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");
+                        String versionstring = json.getString("versionstring");
+                        mOwnCloudVersion = new OwnCloudVersion(version, versionstring);
+                        if (mOwnCloudVersion.isVersionValid()) {
+                            accountMngr.setUserData(mAccount, Constants.KEY_OC_VERSION, mOwnCloudVersion.getVersion());
+                            accountMngr.setUserData(mAccount, Constants.KEY_OC_VERSION_STRING, mOwnCloudVersion.getVersionString());
+                            Log_OC.d(TAG, "Got new OC version " + mOwnCloudVersion.toString());
+
                             result = new RemoteOperationResult(ResultCode.OK);
                             
                         } else {
@@ -107,4 +114,9 @@ public class UpdateOCVersionOperation extends RemoteOperation {
         return result;
     }
 
+
+    public OwnCloudVersion getOCVersion() {
+        return mOwnCloudVersion;
+    }
+
 }