mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 17:46:37 +03:00
Display name is sync'ed whenever a refresh of root folder occurs
This commit is contained in:
parent
3584666cf6
commit
0913e3f234
2 changed files with 28 additions and 13 deletions
|
@ -187,7 +187,7 @@ public class RefreshFolderOperation extends RemoteOperation {
|
|||
|
||||
if (OCFile.ROOT_PATH.equals(mLocalFolder.getRemotePath()) && !mSyncFullAccount) {
|
||||
updateOCVersion(client);
|
||||
|
||||
updateUserProfile();
|
||||
}
|
||||
|
||||
result = checkForChanges(client);
|
||||
|
@ -226,7 +226,6 @@ public class RefreshFolderOperation extends RemoteOperation {
|
|||
|
||||
}
|
||||
|
||||
|
||||
private void updateOCVersion(OwnCloudClient client) {
|
||||
UpdateOCVersionOperation update = new UpdateOCVersionOperation(mAccount, mContext);
|
||||
RemoteOperationResult result = update.execute(client);
|
||||
|
@ -235,14 +234,24 @@ public class RefreshFolderOperation extends RemoteOperation {
|
|||
|
||||
// Update Capabilities for this account
|
||||
if (update.getOCVersion().isVersionWithCapabilitiesAPI()) {
|
||||
updateCapabilities(client);
|
||||
updateCapabilities();
|
||||
} else {
|
||||
Log_OC.d(TAG, "Capabilities API disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateCapabilities(OwnCloudClient client){
|
||||
private void updateUserProfile() {
|
||||
GetUserProfileOperation update = new GetUserProfileOperation();
|
||||
RemoteOperationResult result = update.execute(mStorageManager, mContext);
|
||||
if (!result.isSuccess()) {
|
||||
Log_OC.w(TAG, "Couldn't update user profile from server");
|
||||
} else {
|
||||
Log_OC.i(TAG, "Got display name: " + result.getData().get(0));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateCapabilities(){
|
||||
GetCapabilitiesOperarion getCapabilities = new GetCapabilitiesOperarion();
|
||||
RemoteOperationResult result = getCapabilities.execute(mStorageManager,mContext);
|
||||
if (!result.isSuccess()){
|
||||
|
|
|
@ -977,22 +977,28 @@ public class FileDisplayActivity extends HookActivity
|
|||
.equals(event));
|
||||
|
||||
if (RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.
|
||||
equals(event) &&/// TODO refactor and make common
|
||||
equals(event)) {
|
||||
|
||||
synchResult != null && !synchResult.isSuccess()) {
|
||||
if (synchResult != null && !synchResult.isSuccess()) {
|
||||
/// TODO refactor and make common
|
||||
|
||||
if(ResultCode.UNAUTHORIZED.equals(synchResult.getCode()) ||
|
||||
(synchResult.isException() && synchResult.getException()
|
||||
instanceof AuthenticatorException)) {
|
||||
if (ResultCode.UNAUTHORIZED.equals(synchResult.getCode()) ||
|
||||
(synchResult.isException() && synchResult.getException()
|
||||
instanceof AuthenticatorException)) {
|
||||
|
||||
requestCredentialsUpdate(context);
|
||||
requestCredentialsUpdate(context);
|
||||
|
||||
} else if(RemoteOperationResult.ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED.equals(
|
||||
synchResult.getCode())) {
|
||||
} else if (RemoteOperationResult.ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED.equals(
|
||||
synchResult.getCode())) {
|
||||
|
||||
showUntrustedCertDialog(synchResult);
|
||||
}
|
||||
|
||||
showUntrustedCertDialog(synchResult);
|
||||
}
|
||||
|
||||
if (synchFolderRemotePath.equals(OCFile.ROOT_PATH)) {
|
||||
setUsernameInDrawer(mDrawerLayout, getAccount());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue