فهرست منبع

Merge pull request #2064 from nextcloud/fixE2EuserID

Use fetched userID
Andy Scherzinger 7 سال پیش
والد
کامیت
dbba847001

+ 1 - 1
build.gradle

@@ -182,7 +182,7 @@ dependencies {
     // dependencies for app building
     implementation 'com.android.support:multidex:1.0.2'
 //    implementation project('nextcloud-android-library')
-    implementation 'com.github.nextcloud:android-library:1.0.36'
+    implementation 'com.github.nextcloud:android-library:1.0.37'
     versionDevImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT' // use always latest master
     implementation "com.android.support:support-v4:${supportLibraryVersion}"
     implementation "com.android.support:design:${supportLibraryVersion}"

+ 2 - 2
src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java

@@ -276,7 +276,7 @@ public class UserInfoActivity extends FileActivity {
         }
         
         if (userInfo.getPhone() == null && userInfo.getEmail() == null && userInfo.getAddress() == null
-                && userInfo.getTwitter() == null & userInfo.getWebpage() == null) {
+                && userInfo.getTwitter() == null & userInfo.getWebsite() == null) {
 
             setErrorMessageForMultiList(getString(R.string.userinfo_no_info_headline),
                     getString(R.string.userinfo_no_info_text), R.drawable.ic_user);
@@ -296,7 +296,7 @@ public class UserInfoActivity extends FileActivity {
         addToListIfNeeded(result, R.drawable.ic_phone, userInfo.getPhone(), R.string.user_info_phone);
         addToListIfNeeded(result, R.drawable.ic_email, userInfo.getEmail(), R.string.user_info_email);
         addToListIfNeeded(result, R.drawable.ic_map_marker, userInfo.getAddress(), R.string.user_info_address);
-        addToListIfNeeded(result, R.drawable.ic_web, DisplayUtils.beautifyURL(userInfo.getWebpage()),
+        addToListIfNeeded(result, R.drawable.ic_web, DisplayUtils.beautifyURL(userInfo.getWebsite()),
                     R.string.user_info_website);
         addToListIfNeeded(result, R.drawable.ic_twitter, DisplayUtils.beautifyTwitterHandle(userInfo.getTwitter()),
                     R.string.user_info_twitter);

+ 14 - 1
src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.java

@@ -241,7 +241,20 @@ public class SetupEncryptionDialogFragment extends DialogFragment {
             //  - store public key
             //  - decrypt private key, store unencrypted private key in database
 
-            GetPublicKeyOperation publicKeyOperation = new GetPublicKeyOperation();
+            // get user id
+            String userID;
+            GetRemoteUserInfoOperation remoteUserNameOperation = new GetRemoteUserInfoOperation();
+            RemoteOperationResult remoteUserNameOperationResult = remoteUserNameOperation.execute(account,
+                    getContext(), true);
+
+            if (remoteUserNameOperationResult.isSuccess() && remoteUserNameOperationResult.getData() != null) {
+                UserInfo userInfo = (UserInfo) remoteUserNameOperationResult.getData().get(0);
+                userID = userInfo.getId();
+            } else {
+                userID = account.name;
+            }
+
+            GetPublicKeyOperation publicKeyOperation = new GetPublicKeyOperation(userID);
             RemoteOperationResult publicKeyResult = publicKeyOperation.execute(account, getContext(), true);
 
             if (publicKeyResult.isSuccess()) {