feat: improve strings, challenges, and template readiness
This commit is contained in:
@@ -12,6 +12,11 @@ export class PureViewCtrl<P = CtrlProps, S = CtrlState> {
|
||||
private unsubApp: any
|
||||
private unsubState: any
|
||||
private stateTimeout?: ng.IPromise<void>
|
||||
/**
|
||||
* Subclasses can optionally add an ng-if=ctrl.templateReady to make sure that
|
||||
* no Angular handlebars/syntax render in the UI before display data is ready.
|
||||
*/
|
||||
protected templateReady = false
|
||||
|
||||
/* @ngInject */
|
||||
constructor(
|
||||
@@ -28,6 +33,7 @@ export class PureViewCtrl<P = CtrlProps, S = CtrlState> {
|
||||
}
|
||||
this.addAppEventObserver();
|
||||
this.addAppStateObserver();
|
||||
this.templateReady = true;
|
||||
}
|
||||
|
||||
deinit() {
|
||||
@@ -114,7 +120,7 @@ export class PureViewCtrl<P = CtrlProps, S = CtrlState> {
|
||||
await this.onAppLaunch();
|
||||
} else if (eventName === ApplicationEvent.CompletedIncrementalSync) {
|
||||
this.onAppIncrementalSync();
|
||||
} else if (eventName === ApplicationEvent.CompletedFullSync) {
|
||||
} else if (eventName === ApplicationEvent.CompletedFullSync) {
|
||||
this.onAppFullSync();
|
||||
} else if (eventName === ApplicationEvent.KeyStatusChanged) {
|
||||
this.onAppKeyChange();
|
||||
|
||||
@@ -10,12 +10,10 @@ import {
|
||||
PANEL_NAME_TAGS
|
||||
} from '@/views/constants';
|
||||
import {
|
||||
STRING_SESSION_EXPIRED,
|
||||
STRING_DEFAULT_FILE_ERROR
|
||||
} from '@/strings';
|
||||
import { PureViewCtrl } from '@Views/abstract/pure_view_ctrl';
|
||||
import { PermissionDialog } from 'snjs/dist/@types/services/component_manager';
|
||||
import { alertDialog } from '@/services/alertService';
|
||||
|
||||
class ApplicationViewCtrl extends PureViewCtrl {
|
||||
private $compile?: ng.ICompileService
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
.sk-modal-background(ng-click="ctrl.cancel()")
|
||||
.challenge-modal.sk-modal-content
|
||||
.challenge-modal.sk-modal-content(ng-if='ctrl.templateReady')
|
||||
.sn-component
|
||||
.sk-panel
|
||||
.sk-panel-header
|
||||
.sk-panel-header-title {{ctrl.modalTitle}}
|
||||
.sk-panel-header-title {{ctrl.challenge.modalTitle}}
|
||||
.sk-panel-content
|
||||
.sk-panel-section
|
||||
.sk-p.sk-panel-row.centered.prompt
|
||||
strong {{ctrl.state.title}}
|
||||
.sk-p.sk-panel-row.centered.subprompt(ng-if='ctrl.state.subtitle')
|
||||
| {{ctrl.state.subtitle}}
|
||||
strong {{ctrl.challenge.heading}}
|
||||
.sk-p.sk-panel-row.centered.subprompt(ng-if='ctrl.challenge.subheading')
|
||||
| {{ctrl.challenge.subheading}}
|
||||
.sk-panel-section
|
||||
div(ng-repeat="prompt in ctrl.state.prompts track by prompt.id")
|
||||
.sk-panel-row
|
||||
|
||||
@@ -12,8 +12,6 @@ import { WebDirective } from '@/types';
|
||||
import { confirmDialog } from '@/services/alertService';
|
||||
import {
|
||||
STRING_SIGN_OUT_CONFIRMATION,
|
||||
STRING_STORAGE_UPDATE,
|
||||
STRING_AUTHENTICATION_REQUIRED,
|
||||
} from '@/strings';
|
||||
|
||||
type InputValue = {
|
||||
@@ -32,8 +30,6 @@ type ChallengeModalState = {
|
||||
showForgotPasscodeLink: boolean,
|
||||
processingPrompts: ChallengePrompt[],
|
||||
hasAccount: boolean,
|
||||
title: string,
|
||||
subtitle: string
|
||||
}
|
||||
|
||||
class ChallengeModalCtrl extends PureViewCtrl<{}, ChallengeModalState> {
|
||||
@@ -93,8 +89,6 @@ class ChallengeModalCtrl extends PureViewCtrl<{}, ChallengeModalState> {
|
||||
forgotPasscode: false,
|
||||
showForgotPasscodeLink,
|
||||
hasAccount: this.application.hasAccount(),
|
||||
title: this.challenge.title,
|
||||
subtitle: this.challenge.subtitle,
|
||||
processingPrompts: []
|
||||
});
|
||||
this.application.addChallengeObserver(
|
||||
@@ -137,14 +131,6 @@ class ChallengeModalCtrl extends PureViewCtrl<{}, ChallengeModalState> {
|
||||
});
|
||||
}
|
||||
|
||||
get modalTitle(): string {
|
||||
if (this.challenge.reason === ChallengeReason.Migration) {
|
||||
return STRING_STORAGE_UPDATE;
|
||||
} else {
|
||||
return STRING_AUTHENTICATION_REQUIRED;
|
||||
}
|
||||
}
|
||||
|
||||
async destroyLocalData() {
|
||||
if (await confirmDialog({
|
||||
text: STRING_SIGN_OUT_CONFIRMATION,
|
||||
|
||||
@@ -347,7 +347,7 @@ class FooterViewCtrl extends PureViewCtrl<{}, {
|
||||
confirmButtonText: STRING_UPGRADE_ACCOUNT_CONFIRM_BUTTON,
|
||||
})) {
|
||||
preventRefreshing(STRING_CONFIRM_APP_QUIT_DURING_UPGRADE, async () => {
|
||||
await this.application.performProtocolUpgrade();
|
||||
await this.application.upgradeProtocolVersion();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SNNote, SNTag } from 'snjs';
|
||||
import { SNNote } from 'snjs';
|
||||
|
||||
export enum NoteSortKey {
|
||||
CreatedAt = 'created_at',
|
||||
|
||||
Reference in New Issue
Block a user