Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3245243
D13937.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D13937.diff
View Options
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,11 @@
let Some(promise_id) = backups_to_promises.remove(backup_id) else {
return;
};
- handle_void_result_as_callback(result, promise_id);
+
+ let result_with_id: Result<String, String> = match result {
+ Ok(_) => Ok(backup_id.to_string()),
+ Err(e) => Err(e),
+ };
+
+ handle_string_result_as_callback(result_with_id, 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
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 15, 5:20 PM (18 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2494906
Default Alt Text
D13937.diff (3 KB)
Attached To
Mode
D13937: [native_rust_library] update creating backup to return `backupID`
Attached
Detach File
Event Timeline
Log In to Comment