Actually assign the promise

This commit is contained in:
David Baker 2025-06-04 18:26:56 +01:00
parent 86f6136257
commit 39f460b636

View File

@ -233,7 +233,7 @@ class Store extends ElectronStore<StoreData> {
});
}
private safeStorageReadyPromise?: Promise<unknown>;
private safeStorageReadyPromise?: Promise<boolean>;
public async safeStorageReady(): Promise<void> {
if (!this.safeStorageReadyPromise) {
throw new Error("prepareSafeStorage must be called before using storage methods");
@ -283,6 +283,11 @@ class Store extends ElectronStore<StoreData> {
* @returns true if safeStorage was initialised successfully or false if the app will be relaunched
*/
public async prepareSafeStorage(electronSession: Session): Promise<boolean> {
this.safeStorageReadyPromise = this.reallyPrepareSafeStorage(electronSession);
return this.safeStorageReadyPromise;
}
private async reallyPrepareSafeStorage(electronSession: Session): Promise<boolean> {
await app.whenReady();
// The backend the existing data is written with if any