1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-30 19:26:24 +00:00

Merge pull request #331 from owncloud/fix/refresh_basic_credentials

[Fix] Refresh credentials
This commit is contained in:
Abel García de Prada 2020-07-01 08:45:36 +02:00 committed by GitHub
commit 137b417580
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,6 +32,7 @@ import android.content.Context;
import android.net.Uri; import android.net.Uri;
import com.owncloud.android.lib.common.accounts.AccountUtils; import com.owncloud.android.lib.common.accounts.AccountUtils;
import com.owncloud.android.lib.common.authentication.OwnCloudCredentials;
import com.owncloud.android.lib.common.http.HttpClient; import com.owncloud.android.lib.common.http.HttpClient;
import timber.log.Timber; import timber.log.Timber;
@ -191,6 +192,15 @@ public class SingleSessionManager {
} }
} }
public void refreshCredentialsForAccount(String accountName, OwnCloudCredentials credentials) {
OwnCloudClient ownCloudClient = mClientsWithKnownUsername.get(accountName);
if (ownCloudClient == null) {
return;
}
ownCloudClient.setCredentials(credentials);
mClientsWithKnownUsername.replace(accountName, ownCloudClient);
}
// this method is just a patch; we need to distinguish accounts in the same host but // this method is just a patch; we need to distinguish accounts in the same host but
// different paths; but that requires updating the accountNames for apps upgrading // different paths; but that requires updating the accountNames for apps upgrading
private void keepUriUpdated(OwnCloudAccount account, OwnCloudClient reusedClient) { private void keepUriUpdated(OwnCloudAccount account, OwnCloudClient reusedClient) {