forked from upstream-mirrors/OpenTracks
Code cleanup: move request code to AbstractSendToGoogleActivity
This commit is contained in:
+2
-8
@@ -47,20 +47,14 @@ public class SendToGoogleUtils {
|
||||
|
||||
private static final String TAG = SendToGoogleUtils.class.getSimpleName();
|
||||
|
||||
// Request code to obtain Drive permission
|
||||
public static final int DRIVE_PERMISSION_REQUEST_CODE = 1;
|
||||
public static final String DRIVE_SCOPE = DriveScopes.DRIVE;
|
||||
public static final int DRIVE_NOTIFICATION_ID = 1;
|
||||
|
||||
// Request code to obtain Fusion Tables permission
|
||||
public static final int FUSION_TABLES_PERMISSION_REQUEST_CODE = 2;
|
||||
public static final String FUSION_TABLES_SCOPE = FusiontablesScopes.FUSIONTABLES;
|
||||
public static final int FUSION_TABLES_NOTIFICATION_ID = 2;
|
||||
|
||||
// Request code to obtain Spreadsheet permission
|
||||
public static final int SPREADSHEET_PERMISSION_REQUEST_CODE = 3;
|
||||
public static final String SPREADSHEET_SCOPE = "https://spreadsheets.google.com/feeds";
|
||||
public static final int SPREADSHEET_NOTIFICATION_ID = 3;
|
||||
public static final String SPREADSHEETS_SCOPE = "https://spreadsheets.google.com/feeds";
|
||||
public static final int SPREADSHEETS_NOTIFICATION_ID = 3;
|
||||
|
||||
private SendToGoogleUtils() {}
|
||||
|
||||
|
||||
+3
-3
@@ -103,7 +103,7 @@ public class SendSpreadsheetsAsyncTask extends AbstractSendAsyncTask {
|
||||
Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod());
|
||||
|
||||
credential.setAccessToken(
|
||||
SendToGoogleUtils.getToken(context, account.name, SendToGoogleUtils.SPREADSHEET_SCOPE));
|
||||
SendToGoogleUtils.getToken(context, account.name, SendToGoogleUtils.SPREADSHEETS_SCOPE));
|
||||
spreadsheetService.setOAuth2Credentials(credential);
|
||||
|
||||
Track track = myTracksProviderUtils.getTrack(trackId);
|
||||
@@ -141,14 +141,14 @@ public class SendSpreadsheetsAsyncTask extends AbstractSendAsyncTask {
|
||||
return true;
|
||||
} catch (UserRecoverableAuthException e) {
|
||||
SendToGoogleUtils.sendNotification(
|
||||
context, account.name, e.getIntent(), SendToGoogleUtils.SPREADSHEET_NOTIFICATION_ID);
|
||||
context, account.name, e.getIntent(), SendToGoogleUtils.SPREADSHEETS_NOTIFICATION_ID);
|
||||
return false;
|
||||
} catch (GoogleAuthException e) {
|
||||
Log.e(TAG, "GoogleaAuthException", e);
|
||||
return retryTask();
|
||||
} catch (UserRecoverableAuthIOException e) {
|
||||
SendToGoogleUtils.sendNotification(
|
||||
context, account.name, e.getIntent(), SendToGoogleUtils.SPREADSHEET_NOTIFICATION_ID);
|
||||
context, account.name, e.getIntent(), SendToGoogleUtils.SPREADSHEETS_NOTIFICATION_ID);
|
||||
return false;
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "IOException", e);
|
||||
|
||||
Reference in New Issue
Block a user