Эх сурвалжийг харах

Updated after renaming operation in OC library

David A. Velasco 8 жил өмнө
parent
commit
282f62b735

+ 1 - 1
owncloud-android-library

@@ -1 +1 @@
-Subproject commit 06f27a7c796dcec57f1705ca8f59fa340c589135
+Subproject commit 75667c67f4455217c1843d576f6c471280c409f4

+ 5 - 4
src/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -79,7 +79,8 @@ 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.lib.resources.users.GetRemoteUserNameOperation;
+import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation;
+import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation.UserInfo;
 import com.owncloud.android.operations.DetectAuthenticationMethodOperation.AuthenticationMethod;
 import com.owncloud.android.operations.GetServerInfoOperation;
 import com.owncloud.android.operations.OAuth2GetAccessToken;
@@ -1030,7 +1031,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         } else if (operation instanceof OAuth2GetAccessToken) {
             onGetOAuthAccessTokenFinish(result);
 
-        } else if (operation instanceof GetRemoteUserNameOperation) {
+        } else if (operation instanceof GetRemoteUserInfoOperation) {
             onGetUserNameFinish(result);
         }
 
@@ -1596,9 +1597,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             );
             if (authResult.getData() != null) {
                 try {
-                    String displayName = (String) authResult.getData().get(0);
+                    UserInfo userInfo = (UserInfo) authResult.getData().get(0);
                     mAccountMgr.setUserData(
-                        mAccount, Constants.KEY_DISPLAY_NAME, displayName
+                        mAccount, Constants.KEY_DISPLAY_NAME, userInfo.mDisplayName
                     );
                 } catch (ClassCastException c) {
                     Log_OC.w(TAG, "Couldn't get display name for " + username);

+ 2 - 2
src/com/owncloud/android/authentication/AuthenticatorAsyncTask.java

@@ -30,7 +30,7 @@ import com.owncloud.android.lib.common.OwnCloudCredentials;
 import com.owncloud.android.lib.common.network.RedirectionPath;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
-import com.owncloud.android.lib.resources.users.GetRemoteUserNameOperation;
+import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation;
 
 import java.lang.ref.WeakReference;
 
@@ -80,7 +80,7 @@ public class AuthenticatorAsyncTask  extends AsyncTask<Object, Void, RemoteOpera
 
             // Operation - get display name
             if (result.isSuccess()) {
-                GetRemoteUserNameOperation remoteUserNameOperation = new GetRemoteUserNameOperation();
+                GetRemoteUserInfoOperation remoteUserNameOperation = new GetRemoteUserInfoOperation();
                 result = remoteUserNameOperation.execute(client);
             }
 

+ 9 - 8
src/com/owncloud/android/operations/GetUserProfileOperation.java

@@ -26,13 +26,10 @@ import com.owncloud.android.MainApp;
 import com.owncloud.android.lib.common.OwnCloudClient;
 import com.owncloud.android.lib.common.accounts.AccountUtils;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
-import com.owncloud.android.lib.resources.status.GetRemoteStatusOperation;
-import com.owncloud.android.lib.resources.status.OwnCloudVersion;
-import com.owncloud.android.lib.resources.users.GetRemoteUserNameOperation;
+import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation;
+import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation.UserInfo;
 import com.owncloud.android.operations.common.SyncOperation;
 
-import java.util.ArrayList;
-
 /**
  * Get and save user's profile from the server.
  *
@@ -55,15 +52,19 @@ public class GetUserProfileOperation extends SyncOperation {
     protected RemoteOperationResult run(OwnCloudClient client) {
 
         // get display name
-        GetRemoteUserNameOperation getDisplayName = new GetRemoteUserNameOperation();
+        GetRemoteUserInfoOperation getDisplayName = new GetRemoteUserInfoOperation();
         RemoteOperationResult result = getDisplayName.execute(client);
 
         if (result.isSuccess()) {
             // store display name with account data
             AccountManager accountManager = AccountManager.get(MainApp.getAppContext());
-            String displayName = (String) result.getData().get(0);
+            UserInfo userInfo = (UserInfo) result.getData().get(0);
             Account storedAccount = getStorageManager().getAccount();
-            accountManager.setUserData(storedAccount, AccountUtils.Constants.KEY_DISPLAY_NAME, displayName);
+            accountManager.setUserData(
+                storedAccount,
+                AccountUtils.Constants.KEY_DISPLAY_NAME,
+                userInfo.mDisplayName
+            );
         }
         return result;
     }

+ 2 - 2
src/com/owncloud/android/services/OperationsService.java

@@ -51,7 +51,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.lib.resources.shares.ShareType;
 import com.owncloud.android.lib.resources.status.OwnCloudVersion;
-import com.owncloud.android.lib.resources.users.GetRemoteUserNameOperation;
+import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation;
 import com.owncloud.android.operations.CheckCurrentCredentialsOperation;
 import com.owncloud.android.operations.CopyFileOperation;
 import com.owncloud.android.operations.CreateFolderOperation;
@@ -642,7 +642,7 @@ public class OperationsService extends Service {
 
                 } else if (action.equals(ACTION_GET_USER_NAME)) {
                     // Get User Name
-                    operation = new GetRemoteUserNameOperation();
+                    operation = new GetRemoteUserInfoOperation();
                     
                 } else if (action.equals(ACTION_RENAME)) {
                     // Rename file or folder