Update SNJS

This commit is contained in:
Mo Bitar
2020-03-14 11:06:03 -05:00
parent 444c18bbde
commit 8fcfef08a6
22 changed files with 89726 additions and 68 deletions

View File

@@ -5,7 +5,7 @@ import {
platformFromString
} from 'snjs';
import { getPlatformString } from '@/utils';
import { AlertManager } from '@/services/alertManager';
import { AlertService } from '@/services/alertService';
import { WebDeviceInterface } from '@/web_device_interface';
export class Application extends SNApplication {
@@ -21,7 +21,7 @@ export class Application extends SNApplication {
swapClasses: [
{
swap: SNAlertService,
with: AlertManager
with: AlertService
}
]
});

View File

@@ -369,13 +369,13 @@ class EditorCtrl extends PureCtrl {
const note = this.state.note;
note.dummy = false;
if (note.deleted) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: STRING_DELETED_NOTE
});
return;
}
if (!this.application.findItem({ uuid: note.uuid })) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: STRING_INVALID_NOTE
});
return;
@@ -520,14 +520,14 @@ class EditorCtrl extends PureCtrl {
async deleteNote(permanently) {
if (this.state.note.dummy) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: STRING_DELETE_PLACEHOLDER_ATTEMPT
});
return;
}
const run = () => {
if (this.state.note.locked) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: STRING_DELETE_LOCKED_ATTEMPT
});
return;
@@ -539,7 +539,7 @@ class EditorCtrl extends PureCtrl {
title: title,
permanently: permanently
});
this.application.alertManager.confirm({
this.application.alertService.confirm({
text: text,
destructive: true,
onConfirm: () => {
@@ -605,7 +605,7 @@ class EditorCtrl extends PureCtrl {
emptyTrash() {
const count = this.getTrashCount();
this.application.alertManager.confirm({
this.application.alertService.confirm({
text: StringEmptyTrash({ count }),
destructive: true,
onConfirm: () => {

View File

@@ -254,7 +254,7 @@ class FooterCtrl extends PureCtrl {
this.isRefreshing = false;
}, 200);
if (response && response.error) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: STRING_GENERIC_SYNC_ERROR
});
} else {
@@ -273,7 +273,7 @@ class FooterCtrl extends PureCtrl {
clickedNewUpdateAnnouncement() {
this.newUpdateAvailable = false;
this.application.alertManager.alert({
this.application.alertService.alert({
text: STRING_NEW_UPDATE_READY
});
}

View File

@@ -55,7 +55,7 @@ class LockScreenCtrl extends PureCtrl {
}
beginDeleteData() {
this.application.alertManager.confirm({
this.application.alertService.confirm({
text: "Are you sure you want to clear all local data?",
destructive: true,
onConfirm: async () => {

View File

@@ -85,7 +85,7 @@ class RootCtrl extends PureCtrl {
handleChallengeFailures: (responses) => {
for (const response of responses) {
if (response.challenge === Challenges.LocalPasscode) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: "Invalid passcode. Please try again.",
onClose: () => {
this.lockScreenPuppet.focusInput();
@@ -188,13 +188,13 @@ class RootCtrl extends PureCtrl {
// if (!lastShownDate || lastShownSeconds > SHOW_INTERVAL) {
// lastShownDate = new Date();
// setTimeout(() => {
// this.alertManager.alert({
// this.alertService.alert({
// text: STRING_SESSION_EXPIRED
// });
// }, 500);
// }
// } else if (syncEvent === 'sync-exception') {
// this.alertManager.alert({
// this.alertService.alert({
// text: StringSyncException(data)
// });
// }
@@ -247,7 +247,7 @@ class RootCtrl extends PureCtrl {
window.addEventListener('drop', (event) => {
if (event.dataTransfer.files.length > 0) {
event.preventDefault();
this.application.alertManager.alert({
this.application.alertService.alert({
text: STRING_DEFAULT_FILE_ERROR
});
}

View File

@@ -226,7 +226,7 @@ class TagsPanelCtrl extends PureCtrl {
const matchingTag = this.application.findTag({ title: tag.title });
const alreadyExists = matchingTag && matchingTag !== tag;
if (this.state.newTag === tag && alreadyExists) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: "A tag with this name already exists."
});
/** @todo Should not be accessing internal function */
@@ -257,7 +257,7 @@ class TagsPanelCtrl extends PureCtrl {
}
removeTag(tag) {
this.application.alertManager.confirm({
this.application.alertService.confirm({
text: STRING_DELETE_TAG,
destructive: true,
onConfirm: () => {

View File

@@ -4,14 +4,14 @@ export class Database {
}
setApplication(application) {
this.alertManager = application.alertManager;
this.alertService = application.alertService;
}
displayOfflineAlert() {
var message = "There was an issue loading your offline database. This could happen for two reasons:";
message += "\n\n1. You're in a private window in your browser. We can't save your data without access to the local database. Please use a non-private window.";
message += "\n\n2. You have two windows of the app open at the same time. Please close any other app instances and reload the page.";
this.alertManager.alert({ text: message });
this.alertService.alert({ text: message });
}
setLocked(locked) {
@@ -28,7 +28,7 @@ export class Database {
return new Promise((resolve, reject) => {
request.onerror = (event) => {
if (event.target.errorCode) {
this.alertManager.alert({ text: 'Offline database issue: ' + event.target.errorCode });
this.alertService.alert({ text: 'Offline database issue: ' + event.target.errorCode });
} else {
this.displayOfflineAlert();
}
@@ -93,7 +93,7 @@ export class Database {
async savePayloads(payloads) {
const showGenericError = (error) => {
this.alertManager.alert({
this.alertService.alert({
text: `Unable to save changes locally due to an unknown system issue. Issue Code: ${error.code} Issue Name: ${error.name}.`
});
};
@@ -118,7 +118,7 @@ export class Database {
console.error('Offline saving aborted:', event);
const error = event.target.error;
if (error.name === 'QuotaExceededError') {
this.alertManager.alert({ text:
this.alertService.alert({ text:
'Unable to save changes locally because your device is out of space. Please free up some disk space and try again, otherwise, your data may end up in an inconsistent state.'
});
} else {
@@ -177,7 +177,7 @@ export class Database {
deleteRequest.onblocked = function (event) {
console.error('Delete request blocked');
this.alertManager.alert({ text: 'Your browser is blocking Standard Notes from deleting the local database. Make sure there are no other open windows of this app and try again. If the issue persists, please manually delete app data to sign out.' });
this.alertService.alert({ text: 'Your browser is blocking Standard Notes from deleting the local database. Make sure there are no other open windows of this app and try again. If the issue persists, please manually delete app data to sign out.' });
resolve();
};
});

View File

@@ -215,7 +215,7 @@ class AccountMenuCtrl extends PureCtrl {
mfa: null
});
if (error.message) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: error.message
});
}
@@ -228,7 +228,7 @@ class AccountMenuCtrl extends PureCtrl {
async register() {
const confirmation = this.state.formData.password_conf;
if (confirmation !== this.state.formData.user_password) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: STRING_NON_MATCHING_PASSWORDS
});
return;
@@ -254,7 +254,7 @@ class AccountMenuCtrl extends PureCtrl {
await this.setFormDataState({
authenticating: false
});
this.application.alertManager.alert({
this.application.alertService.alert({
text: error.message
});
} else {
@@ -265,7 +265,7 @@ class AccountMenuCtrl extends PureCtrl {
mergeLocalChanged() {
if (!this.state.formData.mergeLocal) {
this.application.alertManager.confirm({
this.application.alertService.confirm({
text: STRING_ACCOUNT_MENU_UNCHECK_MERGE,
destructive: true,
onCancel: () => {
@@ -303,7 +303,7 @@ class AccountMenuCtrl extends PureCtrl {
}
destroyLocalData() {
this.application.alertManager.confirm({
this.application.alertService.confirm({
text: STRING_SIGN_OUT_CONFIRMATION,
destructive: true,
onConfirm: async () => {
@@ -327,7 +327,7 @@ class AccountMenuCtrl extends PureCtrl {
const data = JSON.parse(e.target.result);
resolve(data);
} catch (e) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: STRING_INVALID_IMPORT_FILE
});
}
@@ -390,11 +390,11 @@ class AccountMenuCtrl extends PureCtrl {
});
if (errorCount > 0) {
const message = StringImportError({ errorCount: errorCount });
this.application.alertManager.alert({
this.application.alertService.alert({
text: message
});
} else {
this.application.alertManager.alert({
this.application.alertService.alert({
text: STRING_IMPORT_SUCCESS
});
}
@@ -471,7 +471,7 @@ class AccountMenuCtrl extends PureCtrl {
submitPasscodeForm() {
const passcode = this.state.formData.passcode;
if (passcode !== this.state.formData.confirmPasscode) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: STRING_NON_MATCHING_PASSCODES
});
return;
@@ -513,7 +513,7 @@ class AccountMenuCtrl extends PureCtrl {
if (!signedIn) {
message += STRING_REMOVE_PASSCODE_OFFLINE_ADDENDUM;
}
this.application.alertManager.confirm({
this.application.alertService.confirm({
text: message,
destructive: true,
onConfirm: () => {

View File

@@ -27,7 +27,7 @@ class ConflictResolutionCtrl {
}
keepItem1() {
this.application.alertManager.confirm({
this.application.alertService.confirm({
text: `Are you sure you want to delete the item on the right?`,
destructive: true,
onConfirm: () => {
@@ -39,7 +39,7 @@ class ConflictResolutionCtrl {
}
keepItem2() {
this.application.alertManager.confirm({
this.application.alertService.confirm({
text: `Are you sure you want to delete the item on the left?`,
destructive: true,
onConfirm: () => {

View File

@@ -101,20 +101,20 @@ class PasswordWizardCtrl extends PureCtrl {
const currentPassword = this.state.formData.currentPassword;
const newPass = this.props.securityUpdate ? currentPassword : this.state.formData.newPassword;
if (!currentPassword || currentPassword.length === 0) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: "Please enter your current password."
});
return false;
}
if (this.props.changePassword) {
if (!newPass || newPass.length === 0) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: "Please enter a new password."
});
return false;
}
if (newPass !== this.state.formData.newPasswordConfirmation) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: "Your new password does not match its confirmation."
});
this.state.formData.status = null;
@@ -122,7 +122,7 @@ class PasswordWizardCtrl extends PureCtrl {
}
}
if (!this.application.getUser().email) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: "We don't have your email stored. Please log out then log back in to fix this issue."
});
this.state.formData.status = null;
@@ -134,7 +134,7 @@ class PasswordWizardCtrl extends PureCtrl {
password: this.state.formData.currentPassword
});
if (!success) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: "The current password you entered is not correct. Please try again."
});
}
@@ -163,7 +163,7 @@ class PasswordWizardCtrl extends PureCtrl {
processing: success
});
if (!success) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: response.error.message
? response.error.message
: "There was an error changing your password. Please try again."
@@ -187,7 +187,7 @@ class PasswordWizardCtrl extends PureCtrl {
dismiss() {
if (this.state.lockContinue) {
this.application.alertManager.alert({
this.application.alertService.alert({
text: "Cannot close window until pending tasks are complete."
});
} else {

View File

@@ -99,7 +99,7 @@ class RevisionPreviewModalCtrl {
};
if (!asCopy) {
this.application.alertManager.confirm({
this.application.alertService.confirm({
text: "Are you sure you want to replace the current note's contents with what you see in this preview?",
destructive: true,
onConfirm: run

View File

@@ -45,7 +45,7 @@ class SessionHistoryMenuCtrl {
}
clearItemHistory() {
this.application.alertManager.confirm({
this.application.alertService.confirm({
text: "Are you sure you want to delete the local session history for this note?",
destructive: true,
onConfirm: () => {
@@ -59,7 +59,7 @@ class SessionHistoryMenuCtrl {
}
clearAllHistory() {
this.application.alertManager.confirm({
this.application.alertService.confirm({
text: "Are you sure you want to delete the local session history for all notes?",
destructive: true,
onConfirm: () => {
@@ -81,7 +81,7 @@ class SessionHistoryMenuCtrl {
});
};
if (!this.application.historyManager.diskEnabled) {
this.application.alertManager.confirm({
this.application.alertService.confirm({
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.`,

View File

@@ -2,7 +2,7 @@
import { SNAlertService } from 'snjs';
import { SKAlert } from 'sn-stylekit';
export class AlertManager extends SNAlertService {
export class AlertService extends SNAlertService {
async alert({
title,
text,

View File

@@ -1,4 +1,4 @@
export { AlertManager } from './alertManager';
export { AlertService } from './alertService';
export { ArchiveManager } from './archiveManager';
export { DesktopManager } from './desktopManager';
export { GodService } from './godService';

87032
dist/javascripts/app.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2652
dist/stylesheets/app.css vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
package-lock.json generated
View File

@@ -9797,8 +9797,8 @@
}
},
"snjs": {
"version": "github:standardnotes/snjs#b9d7b7939a8f123798e553ab705916e5251b0981",
"from": "github:standardnotes/snjs#b9d7b7939a8f123798e553ab705916e5251b0981",
"version": "github:standardnotes/snjs#ea2f182ba4b53642516714396bbef264f25e373b",
"from": "github:standardnotes/snjs#ea2f182ba4b53642516714396bbef264f25e373b",
"dev": true
},
"sort-keys": {

View File

@@ -48,7 +48,7 @@
"sass-loader": "^8.0.2",
"serve-static": "^1.14.1",
"sn-stylekit": "2.0.20",
"snjs": "github:standardnotes/snjs#b9d7b7939a8f123798e553ab705916e5251b0981",
"snjs": "github:standardnotes/snjs#ea2f182ba4b53642516714396bbef264f25e373b",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10"
},

View File

@@ -1,2 +1,2 @@
(window.webpackJsonpSNCrypto=window.webpackJsonpSNCrypto||[]).push([[0],{123:function(t,c){},124:function(t,c){},166:function(t,c,n){"use strict";n.r(c);var o=n(18);n.d(c,"ready",(function(){return o.ready})),n.d(c,"crypto_pwhash",(function(){return o.crypto_pwhash})),n.d(c,"crypto_pwhash_ALG_DEFAULT",(function(){return o.crypto_pwhash_ALG_DEFAULT})),n.d(c,"crypto_aead_xchacha20poly1305_ietf_encrypt",(function(){return o.crypto_aead_xchacha20poly1305_ietf_encrypt})),n.d(c,"crypto_aead_xchacha20poly1305_ietf_decrypt",(function(){return o.crypto_aead_xchacha20poly1305_ietf_decrypt}))},48:function(t,c){},88:function(t,c){},90:function(t,c){}}]);
(window.webpackJsonpSNCrypto=window.webpackJsonpSNCrypto||[]).push([[0],{125:function(t,c){},126:function(t,c){},168:function(t,c,n){"use strict";n.r(c);var o=n(21);n.d(c,"ready",(function(){return o.ready})),n.d(c,"crypto_pwhash",(function(){return o.crypto_pwhash})),n.d(c,"crypto_pwhash_ALG_DEFAULT",(function(){return o.crypto_pwhash_ALG_DEFAULT})),n.d(c,"crypto_aead_xchacha20poly1305_ietf_encrypt",(function(){return o.crypto_aead_xchacha20poly1305_ietf_encrypt})),n.d(c,"crypto_aead_xchacha20poly1305_ietf_decrypt",(function(){return o.crypto_aead_xchacha20poly1305_ietf_decrypt}))},51:function(t,c){},91:function(t,c){},93:function(t,c){}}]);
//# sourceMappingURL=libsodium.bundle.js.map

File diff suppressed because one or more lines are too long