forked from upstream-mirrors/OpenTracks
Fixing cupcake uploading by not referencing the Account object.
This commit is contained in:
@@ -24,7 +24,6 @@ import com.google.android.apps.mytracks.io.mymaps.MapsFacade;
|
|||||||
import com.google.android.apps.mytracks.io.mymaps.MyMapsConstants;
|
import com.google.android.apps.mytracks.io.mymaps.MyMapsConstants;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.accounts.Account;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -96,14 +95,13 @@ public class MyMapsList extends Activity implements MapsFacade.MapsListCallback
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Account account = new Account(accountName, accountType);
|
doLogin(auth.getAccountObject(accountName, accountType));
|
||||||
doLogin(account);
|
|
||||||
} else {
|
} else {
|
||||||
doLogin(null);
|
doLogin(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doLogin(final Account account) {
|
private void doLogin(final Object account) {
|
||||||
// Starts in the UI thread.
|
// Starts in the UI thread.
|
||||||
auth.doLogin(new AuthCallback() {
|
auth.doLogin(new AuthCallback() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -81,4 +81,13 @@ public interface AuthManager {
|
|||||||
* is successfully fetched
|
* is successfully fetched
|
||||||
*/
|
*/
|
||||||
void invalidateAndRefresh(AuthCallback whenFinished);
|
void invalidateAndRefresh(AuthCallback whenFinished);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an object that represents the given account, if possible.
|
||||||
|
*
|
||||||
|
* @param accountName the name of the account
|
||||||
|
* @param accountType the type of the account
|
||||||
|
* @return the account object
|
||||||
|
*/
|
||||||
|
Object getAccountObject(String accountName, String accountType);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,4 +133,9 @@ public class AuthManagerOld implements AuthManager {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getAccountObject(String accountName, String accountType) {
|
||||||
|
throw new UnsupportedOperationException("Legacy auth manager knows nothing about accounts");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -213,4 +213,9 @@ public class ModernAuthManager implements AuthManager {
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getAccountObject(String accountName, String accountType) {
|
||||||
|
return new Account(accountName, accountType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ public class SendActivity extends Activity implements ProgressIndicator {
|
|||||||
// Authentication
|
// Authentication
|
||||||
private AuthManager lastAuth;
|
private AuthManager lastAuth;
|
||||||
private final HashMap<String, AuthManager> authMap = new HashMap<String, AuthManager>();
|
private final HashMap<String, AuthManager> authMap = new HashMap<String, AuthManager>();
|
||||||
private final AccountChooser accountChooser = new AccountChooser();
|
private AccountChooser accountChooser;
|
||||||
private String lastAccountName;
|
private String lastAccountName;
|
||||||
private String lastAccountType;
|
private String lastAccountType;
|
||||||
|
|
||||||
@@ -268,9 +268,6 @@ public class SendActivity extends Activity implements ProgressIndicator {
|
|||||||
|
|
||||||
lastAccountName = savedInstanceState.getString(STATE_ACCOUNT_NAME);
|
lastAccountName = savedInstanceState.getString(STATE_ACCOUNT_NAME);
|
||||||
lastAccountType = savedInstanceState.getString(STATE_ACCOUNT_TYPE);
|
lastAccountType = savedInstanceState.getString(STATE_ACCOUNT_TYPE);
|
||||||
if (lastAccountName != null && lastAccountType != null) {
|
|
||||||
accountChooser.setChosenAccount(lastAccountName, lastAccountType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -762,6 +759,15 @@ public class SendActivity extends Activity implements ProgressIndicator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void chooseAccount(final int requestCode, final String service) {
|
private void chooseAccount(final int requestCode, final String service) {
|
||||||
|
if (accountChooser == null) {
|
||||||
|
accountChooser = new AccountChooser();
|
||||||
|
|
||||||
|
// Restore state if necessary.
|
||||||
|
if (lastAccountName != null && lastAccountType != null) {
|
||||||
|
accountChooser.setChosenAccount(lastAccountName, lastAccountType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
accountChooser.chooseAccount(SendActivity.this,
|
accountChooser.chooseAccount(SendActivity.this,
|
||||||
new AccountChooser.AccountHandler() {
|
new AccountChooser.AccountHandler() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user