Merge pull request #946 from owncloud/upgrading_account_manager
[pub/Android/ownCloud.git] / src / com / owncloud / android / authentication / AuthenticatorActivity.java
index a0c4433..f245900 100644 (file)
@@ -1,10 +1,11 @@
-/* ownCloud Android client application\r
+/**\r
+ *   ownCloud Android client application\r
  *\r
  *   @author Bartek Przybylski\r
  *   @author David A. Velasco\r
  *   @author masensio\r
  *   Copyright (C) 2012  Bartek Przybylski\r
- *   Copyright (C) 2012-2015 ownCloud Inc.\r
+ *   Copyright (C) 2015 ownCloud Inc.\r
  *\r
  *   This program is free software: you can redistribute it and/or modify\r
  *   it under the terms of the GNU General Public License version 2,\r
@@ -1118,13 +1119,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
 \r
     // TODO remove, if possible\r
     private String trimUrlWebdav(String url){       \r
-        if(url.toLowerCase().endsWith(AccountUtils.WEBDAV_PATH_4_0)){\r
-            url = url.substring(0, url.length() - AccountUtils.WEBDAV_PATH_4_0.length());             \r
-        } else if(url.toLowerCase().endsWith(AccountUtils.WEBDAV_PATH_2_0)){\r
-            url = url.substring(0, url.length() - AccountUtils.WEBDAV_PATH_2_0.length());             \r
-        } else if (url.toLowerCase().endsWith(AccountUtils.WEBDAV_PATH_1_2)){\r
-            url = url.substring(0, url.length() - AccountUtils.WEBDAV_PATH_1_2.length());             \r
-        } \r
+        if(url.toLowerCase().endsWith(AccountUtils.WEBDAV_PATH_4_0_AND_LATER)){\r
+            url = url.substring(0, url.length() - AccountUtils.WEBDAV_PATH_4_0_AND_LATER.length());\r
+        }\r
         return (url != null ? url : "");\r
     }\r
 \r
@@ -1486,6 +1483,13 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                 );\r
             }\r
 \r
+            // include account version with the new account\r
+            mAccountMgr.setUserData(\r
+                mAccount,\r
+                Constants.KEY_OC_ACCOUNT_VERSION,\r
+                Integer.toString(AccountUtils.ACCOUNT_VERSION)\r
+            );\r
+\r
             /// add the new account as default in preferences, if there is none already\r
             Account defaultAccount = AccountUtils.getCurrentOwnCloudAccount(this);\r
             if (defaultAccount == null) {\r