Skip to content

Commit

Permalink
Merge ff02c30 into 5b0b290
Browse files Browse the repository at this point in the history
  • Loading branch information
walmat authored Jan 7, 2025
2 parents 5b0b290 + ff02c30 commit 2581b0b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
"react-native-branch": "5.3.1",
"react-native-change-icon": "4.0.0",
"react-native-circular-progress": "1.3.8",
"react-native-cloud-fs": "rainbow-me/react-native-cloud-fs#9b204615b76cf3d29bd86a9094dbd95d717b6a7a",
"react-native-cloud-fs": "rainbow-me/react-native-cloud-fs#d73f055c441566e5a57eebd621da8df3cf2499bb",
"react-native-crypto": "2.2.0",
"react-native-dark-mode": "0.2.2",
"react-native-device-info": "5.3.1",
Expand Down
5 changes: 3 additions & 2 deletions src/handlers/cloudBackup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ export type GoogleDriveUserData = {
avatarUrl?: string;
};

export async function getGoogleAccountUserData(): Promise<GoogleDriveUserData | undefined> {
export async function getGoogleAccountUserData(checkPermissions = false): Promise<GoogleDriveUserData | undefined> {
if (!IS_ANDROID) {
return;
}
return RNCloudFs.getCurrentlySignedInUserData();
const options = { checkPermissions };
return RNCloudFs.getCurrentlySignedInUserData(options);
}

// This is used for dev purposes only!
Expand Down
12 changes: 11 additions & 1 deletion src/state/backups/backups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const backupsStore = createRainbowStore<BackupsStore>((set, get) => ({
}

if (IS_ANDROID) {
const gdata = await getGoogleAccountUserData();
const gdata = await getGoogleAccountUserData(true);
if (!gdata) {
logger.debug('[backupsStore]: Google account is not available');
set({ backupProvider: undefined, status: CloudBackupState.NotAvailable, backups: { files: [] }, mostRecentBackup: undefined });
Expand Down Expand Up @@ -145,6 +145,16 @@ export const backupsStore = createRainbowStore<BackupsStore>((set, get) => ({
error: e,
});
set({ status: CloudBackupState.FailedToInitialize });

// See https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInStatusCodes#public-static-final-int-sign_in_cancelled
const stringifiedError = JSON.stringify(e);
if (stringifiedError.includes('12501')) {
logger.warn('[backupsStore]: Google sign in / oauth cancelled');
return {
success: false,
retry: false,
};
}
}

return {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8882,7 +8882,7 @@ __metadata:
react-native-branch: "npm:5.3.1"
react-native-change-icon: "npm:4.0.0"
react-native-circular-progress: "npm:1.3.8"
react-native-cloud-fs: "rainbow-me/react-native-cloud-fs#9b204615b76cf3d29bd86a9094dbd95d717b6a7a"
react-native-cloud-fs: "rainbow-me/react-native-cloud-fs#d73f055c441566e5a57eebd621da8df3cf2499bb"
react-native-crypto: "npm:2.2.0"
react-native-dark-mode: "npm:0.2.2"
react-native-device-info: "npm:5.3.1"
Expand Down Expand Up @@ -22280,10 +22280,10 @@ __metadata:
languageName: node
linkType: hard

"react-native-cloud-fs@rainbow-me/react-native-cloud-fs#9b204615b76cf3d29bd86a9094dbd95d717b6a7a":
"react-native-cloud-fs@rainbow-me/react-native-cloud-fs#d73f055c441566e5a57eebd621da8df3cf2499bb":
version: 2.6.2
resolution: "react-native-cloud-fs@https://github.com/rainbow-me/react-native-cloud-fs.git#commit=9b204615b76cf3d29bd86a9094dbd95d717b6a7a"
checksum: 10c0/db1c719b90475201aa1e1177209723598ac38689a827d387dd281ea5190ad09f3e6c8fee77caff70b46a228b6552459d9a9e73e4159c18a29d19d235e17d7907
resolution: "react-native-cloud-fs@https://github.com/rainbow-me/react-native-cloud-fs.git#commit=d73f055c441566e5a57eebd621da8df3cf2499bb"
checksum: 10c0/0d78db6a3978bf9a0fe485d2dc0cf80fb1185a63eec1d22d7e3afd6c693417b011779d8318c603a9a81ff6c9c67f194dd469fc16a220ac0cd2b9b1ec374f1e2b
languageName: node
linkType: hard

Expand Down

0 comments on commit 2581b0b

Please sign in to comment.