feat: confirm navigating away when upgrade is in progress
This commit is contained in:
@@ -49,3 +49,7 @@ export function StringImportError(errorCount: number) {
|
|||||||
|
|
||||||
/** @password_change */
|
/** @password_change */
|
||||||
export const STRING_FAILED_PASSWORD_CHANGE = "There was an error re-encrypting your items. Your password was changed, but not all your items were properly re-encrypted and synced. You should try syncing again. If all else fails, you should restore your notes from backup.";
|
export const STRING_FAILED_PASSWORD_CHANGE = "There was an error re-encrypting your items. Your password was changed, but not all your items were properly re-encrypted and synced. You should try syncing again. If all else fails, you should restore your notes from backup.";
|
||||||
|
|
||||||
|
export const STRING_CONFIRM_APP_QUIT_DURING_UPGRADE =
|
||||||
|
"The encryption upgrade is in progress. You may lose data if you quit the app. " +
|
||||||
|
"Are you sure you want to quit?"
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ import template from './footer-view.pug';
|
|||||||
import { AppStateEvent, EventSource } from '@/ui_models/app_state';
|
import { AppStateEvent, EventSource } from '@/ui_models/app_state';
|
||||||
import {
|
import {
|
||||||
STRING_GENERIC_SYNC_ERROR,
|
STRING_GENERIC_SYNC_ERROR,
|
||||||
STRING_NEW_UPDATE_READY
|
STRING_NEW_UPDATE_READY,
|
||||||
|
STRING_CONFIRM_APP_QUIT_DURING_UPGRADE
|
||||||
} from '@/strings';
|
} from '@/strings';
|
||||||
import { PureViewCtrl } from '@Views/abstract/pure_view_ctrl';
|
import { PureViewCtrl } from '@Views/abstract/pure_view_ctrl';
|
||||||
import { ComponentMutator } from '@node_modules/snjs/dist/@types/models';
|
import { ComponentMutator } from '@node_modules/snjs/dist/@types/models';
|
||||||
@@ -298,8 +299,14 @@ class FooterViewCtrl extends PureViewCtrl {
|
|||||||
this.offline = this.application!.noAccount();
|
this.offline = this.application!.noAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
openSecurityUpdate() {
|
async openSecurityUpdate() {
|
||||||
this.application!.performProtocolUpgrade();
|
const onBeforeUnload = window.onbeforeunload;
|
||||||
|
try {
|
||||||
|
window.onbeforeunload = () => STRING_CONFIRM_APP_QUIT_DURING_UPGRADE;
|
||||||
|
await this.application!.performProtocolUpgrade();
|
||||||
|
} finally {
|
||||||
|
window.onbeforeunload = onBeforeUnload;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
findErrors() {
|
findErrors() {
|
||||||
|
|||||||
Reference in New Issue
Block a user