1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Merge pull request #118 from owncloud/stable

Release 0.9.11
This commit is contained in:
David A. Velasco 2016-04-21 12:53:16 +02:00
commit f53ebc09b2
3 changed files with 24 additions and 5 deletions

View File

@ -83,7 +83,7 @@ public class OwnCloudClientFactory {
am.getUserData(account, AccountUtils.Constants.KEY_SUPPORTS_SAML_WEB_SSO) != null;
OwnCloudClient client = createOwnCloudClient(baseUri, appContext, !isSamlSso);
String username = account.name.substring(0, account.name.lastIndexOf('@'));
String username = AccountUtils.getUsernameForAccount(account);
if (isOauth2) {
String accessToken = am.blockingGetAuthToken(
account,
@ -137,7 +137,7 @@ public class OwnCloudClientFactory {
am.getUserData(account, AccountUtils.Constants.KEY_SUPPORTS_SAML_WEB_SSO) != null;
OwnCloudClient client = createOwnCloudClient(baseUri, appContext, !isSamlSso);
String username = account.name.substring(0, account.name.lastIndexOf('@'));
String username = AccountUtils.getUsernameForAccount(account);
if (isOauth2) { // TODO avoid a call to getUserData here
AccountManagerFuture<Bundle> future = am.getAuthToken(
account,

View File

@ -147,6 +147,22 @@ public class AccountUtils {
}
/**
* Get the username corresponding to an OC account.
*
* @param account An OC account
* @return Username for the given account, extracted from the account.name
*/
public static String getUsernameForAccount(Account account) {
String username = null;
try {
username = account.name.substring(0, account.name.lastIndexOf('@'));
} catch (Exception e) {
Log_OC.e(TAG, "Couldn't get a username for the given account", e);
}
return username;
}
/**
*
* @return
@ -168,7 +184,7 @@ public class AccountUtils {
account,
AccountUtils.Constants.KEY_SUPPORTS_SAML_WEB_SSO) != null;
String username = account.name.substring(0, account.name.lastIndexOf('@'));
String username = AccountUtils.getUsernameForAccount(account);
if (isOauth2) {
String accessToken = am.blockingGetAuthToken(

View File

@ -217,6 +217,9 @@ public class UpdateRemoteShareOperation extends RemoteOperation {
} else {
result = new RemoteOperationResult(false, status, put.getResponseHeaders());
}
if (!result.isSuccess()) {
break;
}
}
} catch (Exception e) {