Page MenuHomePhabricator

D13937.diff
No OneTemporary

D13937.diff

diff --git a/native/backup/use-client-backup.js b/native/backup/use-client-backup.js
--- a/native/backup/use-client-backup.js
+++ b/native/backup/use-client-backup.js
@@ -14,8 +14,8 @@
import { useSelector } from '../redux/redux-utils.js';
type ClientBackup = {
- +createFullBackup: () => Promise<void>,
- +createUserKeysBackup: () => Promise<void>,
+ +createFullBackup: () => Promise<string>,
+ +createUserKeysBackup: () => Promise<string>,
+retrieveLatestBackupInfo: () => Promise<LatestBackupInfo>,
};
@@ -33,7 +33,7 @@
}
const backupSecret = await getBackupSecret();
- await commCoreModule.createFullBackup(backupSecret);
+ return commCoreModule.createFullBackup(backupSecret);
}, [loggedIn, currentUserID, getBackupSecret]);
const createUserKeysBackup = React.useCallback(async () => {
@@ -42,7 +42,7 @@
}
const backupSecret = await getBackupSecret();
- await commCoreModule.createUserKeysBackup(backupSecret);
+ return commCoreModule.createUserKeysBackup(backupSecret);
}, [loggedIn, currentUserID, getBackupSecret]);
const retrieveLatestBackupInfo = React.useCallback(async () => {
diff --git a/native/native_rust_library/src/backup/compaction_upload_promises.rs b/native/native_rust_library/src/backup/compaction_upload_promises.rs
--- a/native/native_rust_library/src/backup/compaction_upload_promises.rs
+++ b/native/native_rust_library/src/backup/compaction_upload_promises.rs
@@ -1,4 +1,4 @@
-use crate::handle_void_result_as_callback;
+use crate::handle_string_result_as_callback;
use lazy_static::lazy_static;
use std::{collections::HashMap, sync::Mutex};
@@ -20,5 +20,9 @@
let Some(promise_id) = backups_to_promises.remove(backup_id) else {
return;
};
- handle_void_result_as_callback(result, promise_id);
+
+ let backup_id_result: Result<String, String> =
+ result.map(|_| backup_id.to_string());
+
+ handle_string_result_as_callback(backup_id_result, promise_id);
}
diff --git a/native/profile/backup-menu.react.js b/native/profile/backup-menu.react.js
--- a/native/profile/backup-menu.react.js
+++ b/native/profile/backup-menu.react.js
@@ -43,9 +43,10 @@
useClientBackup();
const uploadBackup = React.useCallback(async () => {
- let message = 'Success';
+ let message;
try {
- await createFullBackup();
+ const backupID = await createFullBackup();
+ message = `Success!\n` + `Backup ID: ${backupID}`;
} catch (e) {
message = `Backup upload error: ${String(getMessageForException(e))}`;
console.error(message);
@@ -54,9 +55,10 @@
}, [createFullBackup]);
const uploadUserKeys = React.useCallback(async () => {
- let message = 'Success';
+ let message;
try {
- await createUserKeysBackup();
+ const backupID = await createUserKeysBackup();
+ message = `Success!\n` + `Backup ID: ${backupID}`;
} catch (e) {
message = `User Keys upload error: ${String(getMessageForException(e))}`;
console.error(message);
diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js
--- a/native/schema/CommCoreModuleSchema.js
+++ b/native/schema/CommCoreModuleSchema.js
@@ -156,8 +156,8 @@
+clearCommServicesAccessToken: () => Promise<void>;
+startBackupHandler: () => void;
+stopBackupHandler: () => void;
- +createUserKeysBackup: (backupSecret: string) => Promise<void>;
- +createFullBackup: (backupSecret: string) => Promise<void>;
+ +createUserKeysBackup: (backupSecret: string) => Promise<string>;
+ +createFullBackup: (backupSecret: string) => Promise<string>;
+restoreBackup: (
backupSecret: string,
maxVersion: string,

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 23, 12:23 AM (12 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2690861
Default Alt Text
D13937.diff (3 KB)

Event Timeline