fix: use confirmDialog

This commit is contained in:
Johnny Almonte
2020-08-13 13:10:52 -04:00
parent ef651298e3
commit ee49d80ceb
2 changed files with 19 additions and 13 deletions

View File

@@ -5,6 +5,7 @@ import { SNItem, ItemHistoryEntry } from '@node_modules/snjs/dist/@types';
import { PureViewCtrl } from '@/views';
import { ItemSessionHistory } from 'snjs/dist/@types/services/history/session/item_session_history';
import { RemoteHistoryList, RemoteHistoryListEntry } from 'snjs/dist/@types/services/history/history_manager';
import { confirmDialog } from '@/services/alertService';
interface HistoryScope {
application: WebApplication
@@ -90,9 +91,10 @@ class HistoryMenuCtrl extends PureViewCtrl implements HistoryScope {
}
clearItemHistory() {
this.application.alertService!.confirm(
"Are you sure you want to delete the local session history for this note?"
).then((confirmed) => {
confirmDialog({
text: "Are you sure you want to delete the local session history for this note?",
confirmButtonStyle: "danger"
}).then((confirmed) => {
if (!confirmed) {
return;
}
@@ -105,9 +107,10 @@ class HistoryMenuCtrl extends PureViewCtrl implements HistoryScope {
}
clearAllHistory() {
this.application.alertService!.confirm(
"Are you sure you want to delete the local session history for all notes?"
).then((confirmed) => {
confirmDialog({
text: "Are you sure you want to delete the local session history for all notes?",
confirmButtonStyle: "danger"
}).then((confirmed) => {
if (!confirmed) {
return;
}
@@ -136,11 +139,12 @@ class HistoryMenuCtrl extends PureViewCtrl implements HistoryScope {
});
};
if (!this.application.historyManager!.isDiskEnabled()) {
this.application.alertService!.confirm(
"Are you sure you want to save history to disk? This will decrease general " +
confirmDialog({
text: "Are you sure you want to save history to disk? This will decrease general " +
"performance, especially as you type. You are advised to disable this feature " +
"if you experience any lagging."
).then((confirmed) => {
"if you experience any lagging.",
confirmButtonStyle: "danger"
}).then((confirmed) => {
if (confirmed) {
run();
}

View File

@@ -9,6 +9,7 @@ import {
} from 'snjs';
import template from '%/directives/revision-preview-modal.pug';
import { PayloadContent } from '@node_modules/snjs/dist/@types/protocol/payloads/generator';
import { confirmDialog } from '@/services/alertService';
interface RevisionPreviewScope {
uuid: string
@@ -109,9 +110,10 @@ class RevisionPreviewModalCtrl implements RevisionPreviewScope {
};
if (!asCopy) {
this.application.alertService!.confirm(
"Are you sure you want to replace the current note's contents with what you see in this preview?"
).then((confirmed) => {
confirmDialog({
text: "Are you sure you want to replace the current note's contents with what you see in this preview?",
confirmButtonStyle: "danger"
}).then((confirmed) => {
if (confirmed) {
run();
}