feat: display beta warning on desktop
This commit is contained in:
@@ -26,6 +26,7 @@ import { SyncOpStatus } from 'snjs/dist/@types/services/sync/sync_op_status';
|
|||||||
import { PasswordWizardType } from '@/types';
|
import { PasswordWizardType } from '@/types';
|
||||||
import { BackupFile } from 'snjs/dist/@types/services/protocol_service';
|
import { BackupFile } from 'snjs/dist/@types/services/protocol_service';
|
||||||
import { confirmDialog, alertDialog } from '@/services/alertService';
|
import { confirmDialog, alertDialog } from '@/services/alertService';
|
||||||
|
import { autorun, IReactionDisposer } from 'mobx';
|
||||||
|
|
||||||
const ELEMENT_ID_IMPORT_PASSWORD_INPUT = 'import-password-request';
|
const ELEMENT_ID_IMPORT_PASSWORD_INPUT = 'import-password-request';
|
||||||
|
|
||||||
@@ -63,6 +64,7 @@ type AccountMenuState = {
|
|||||||
server: string;
|
server: string;
|
||||||
encryptionEnabled: boolean;
|
encryptionEnabled: boolean;
|
||||||
selectedAutoLockInterval: any;
|
selectedAutoLockInterval: any;
|
||||||
|
showBetaWarning: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
class AccountMenuCtrl extends PureViewCtrl<{}, AccountMenuState> {
|
class AccountMenuCtrl extends PureViewCtrl<{}, AccountMenuState> {
|
||||||
@@ -71,6 +73,7 @@ class AccountMenuCtrl extends PureViewCtrl<{}, AccountMenuState> {
|
|||||||
/** @template */
|
/** @template */
|
||||||
syncStatus?: SyncOpStatus
|
syncStatus?: SyncOpStatus
|
||||||
private closeFunction?: () => void
|
private closeFunction?: () => void
|
||||||
|
private removeBetaWarningListener?: IReactionDisposer
|
||||||
|
|
||||||
/* @ngInject */
|
/* @ngInject */
|
||||||
constructor(
|
constructor(
|
||||||
@@ -91,7 +94,8 @@ class AccountMenuCtrl extends PureViewCtrl<{}, AccountMenuState> {
|
|||||||
mergeLocal: true,
|
mergeLocal: true,
|
||||||
ephemeral: false,
|
ephemeral: false,
|
||||||
},
|
},
|
||||||
mutable: {}
|
mutable: {},
|
||||||
|
showBetaWarning: false,
|
||||||
} as AccountMenuState;
|
} as AccountMenuState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,6 +128,16 @@ class AccountMenuCtrl extends PureViewCtrl<{}, AccountMenuState> {
|
|||||||
$onInit() {
|
$onInit() {
|
||||||
super.$onInit();
|
super.$onInit();
|
||||||
this.syncStatus = this.application!.getSyncStatus();
|
this.syncStatus = this.application!.getSyncStatus();
|
||||||
|
this.removeBetaWarningListener = autorun(() => {
|
||||||
|
this.setState({
|
||||||
|
showBetaWarning: this.appState.showBetaWarning
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deinit() {
|
||||||
|
this.removeBetaWarningListener?.();
|
||||||
|
super.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
|
|||||||
@@ -8,10 +8,12 @@ import {
|
|||||||
SNUserPrefs,
|
SNUserPrefs,
|
||||||
ContentType,
|
ContentType,
|
||||||
SNSmartTag,
|
SNSmartTag,
|
||||||
PayloadSource
|
PayloadSource,
|
||||||
|
DeinitSource
|
||||||
} from 'snjs';
|
} from 'snjs';
|
||||||
import { WebApplication } from '@/ui_models/application';
|
import { WebApplication } from '@/ui_models/application';
|
||||||
import { Editor } from '@/ui_models/editor';
|
import { Editor } from '@/ui_models/editor';
|
||||||
|
import { action, makeObservable, observable } from 'mobx';
|
||||||
|
|
||||||
export enum AppStateEvent {
|
export enum AppStateEvent {
|
||||||
TagChanged = 1,
|
TagChanged = 1,
|
||||||
@@ -32,19 +34,22 @@ export enum EventSource {
|
|||||||
|
|
||||||
type ObserverCallback = (event: AppStateEvent, data?: any) => Promise<void>
|
type ObserverCallback = (event: AppStateEvent, data?: any) => Promise<void>
|
||||||
|
|
||||||
|
const SHOW_BETA_WARNING_KEY = 'show_beta_warning';
|
||||||
|
|
||||||
export class AppState {
|
export class AppState {
|
||||||
$rootScope: ng.IRootScopeService
|
$rootScope: ng.IRootScopeService;
|
||||||
$timeout: ng.ITimeoutService
|
$timeout: ng.ITimeoutService;
|
||||||
application: WebApplication
|
application: WebApplication;
|
||||||
observers: ObserverCallback[] = []
|
observers: ObserverCallback[] = [];
|
||||||
locked = true
|
locked = true;
|
||||||
unsubApp: any
|
unsubApp: any;
|
||||||
rootScopeCleanup1: any
|
rootScopeCleanup1: any;
|
||||||
rootScopeCleanup2: any
|
rootScopeCleanup2: any;
|
||||||
onVisibilityChange: any
|
onVisibilityChange: any;
|
||||||
selectedTag?: SNTag
|
selectedTag?: SNTag;
|
||||||
userPreferences?: SNUserPrefs
|
userPreferences?: SNUserPrefs;
|
||||||
multiEditorEnabled = false
|
multiEditorEnabled = false;
|
||||||
|
showBetaWarning = false;
|
||||||
|
|
||||||
/* @ngInject */
|
/* @ngInject */
|
||||||
constructor(
|
constructor(
|
||||||
@@ -55,6 +60,11 @@ export class AppState {
|
|||||||
this.$timeout = $timeout;
|
this.$timeout = $timeout;
|
||||||
this.$rootScope = $rootScope;
|
this.$rootScope = $rootScope;
|
||||||
this.application = application;
|
this.application = application;
|
||||||
|
makeObservable(this, {
|
||||||
|
showBetaWarning: observable,
|
||||||
|
enableBetaWarning: action,
|
||||||
|
disableBetaWarning: action,
|
||||||
|
});
|
||||||
this.addAppEventObserver();
|
this.addAppEventObserver();
|
||||||
this.streamNotesAndTags();
|
this.streamNotesAndTags();
|
||||||
this.onVisibilityChange = () => {
|
this.onVisibilityChange = () => {
|
||||||
@@ -65,9 +75,13 @@ export class AppState {
|
|||||||
this.notifyEvent(event);
|
this.notifyEvent(event);
|
||||||
}
|
}
|
||||||
this.registerVisibilityObservers();
|
this.registerVisibilityObservers();
|
||||||
|
this.determineBetaWarningValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit() {
|
deinit(source: DeinitSource) {
|
||||||
|
if (source === DeinitSource.SignOut) {
|
||||||
|
localStorage.removeItem(SHOW_BETA_WARNING_KEY);
|
||||||
|
}
|
||||||
this.unsubApp();
|
this.unsubApp();
|
||||||
this.unsubApp = undefined;
|
this.unsubApp = undefined;
|
||||||
this.observers.length = 0;
|
this.observers.length = 0;
|
||||||
@@ -81,6 +95,34 @@ export class AppState {
|
|||||||
this.onVisibilityChange = undefined;
|
this.onVisibilityChange = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disableBetaWarning() {
|
||||||
|
this.showBetaWarning = false;
|
||||||
|
localStorage.setItem(SHOW_BETA_WARNING_KEY, 'false');
|
||||||
|
}
|
||||||
|
|
||||||
|
enableBetaWarning() {
|
||||||
|
this.showBetaWarning = true;
|
||||||
|
localStorage.setItem(SHOW_BETA_WARNING_KEY, 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
clearBetaWarning() {
|
||||||
|
localStorage.setItem(SHOW_BETA_WARNING_KEY, 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
private determineBetaWarningValue() {
|
||||||
|
if ((window as any).electronAppVersion?.includes('-beta')) {
|
||||||
|
switch (localStorage.getItem(SHOW_BETA_WARNING_KEY)) {
|
||||||
|
case 'true':
|
||||||
|
default:
|
||||||
|
this.enableBetaWarning();
|
||||||
|
break;
|
||||||
|
case 'false':
|
||||||
|
this.disableBetaWarning();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new editor if one doesn't exist. If one does, we'll replace the
|
* Creates a new editor if one doesn't exist. If one does, we'll replace the
|
||||||
* editor's note with an empty one.
|
* editor's note with an empty one.
|
||||||
|
|||||||
@@ -81,12 +81,11 @@ export class WebApplication extends SNApplication {
|
|||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
deinit(source: DeinitSource) {
|
deinit(source: DeinitSource) {
|
||||||
for (const key of Object.keys(this.webServices)) {
|
for (const service of Object.values(this.webServices)) {
|
||||||
const service = (this.webServices as any)[key];
|
if ('deinit' in service) {
|
||||||
if (service.deinit) {
|
service.deinit?.(source);
|
||||||
service.deinit();
|
|
||||||
}
|
}
|
||||||
service.application = undefined;
|
(service as any).application = undefined;
|
||||||
}
|
}
|
||||||
this.webServices = {} as WebServices;
|
this.webServices = {} as WebServices;
|
||||||
(this.$compile as any) = undefined;
|
(this.$compile as any) = undefined;
|
||||||
|
|||||||
@@ -34,7 +34,14 @@
|
|||||||
ng-if='ctrl.roomShowState[room.uuid]',
|
ng-if='ctrl.roomShowState[room.uuid]',
|
||||||
on-dismiss='ctrl.onRoomDismiss(room)',
|
on-dismiss='ctrl.onRoomDismiss(room)',
|
||||||
application='ctrl.application'
|
application='ctrl.application'
|
||||||
)
|
)
|
||||||
|
.sk-app-bar-item.border(ng-if="ctrl.state.showBetaWarning")
|
||||||
|
.sk-app-bar-item(ng-if="ctrl.state.showBetaWarning")
|
||||||
|
a.no-decoration.sk-label.title.uppercase(
|
||||||
|
href='https://github.com/standardnotes/forum/issues/1114',
|
||||||
|
rel='noopener',
|
||||||
|
target='_blank'
|
||||||
|
) You are using a beta version of the app
|
||||||
.center
|
.center
|
||||||
.sk-app-bar-item(ng-if='ctrl.arbitraryStatusMessage')
|
.sk-app-bar-item(ng-if='ctrl.arbitraryStatusMessage')
|
||||||
.sk-app-bar-item-column
|
.sk-app-bar-item-column
|
||||||
@@ -42,7 +49,7 @@
|
|||||||
.right
|
.right
|
||||||
.sk-app-bar-item(
|
.sk-app-bar-item(
|
||||||
ng-click='ctrl.openSecurityUpdate()',
|
ng-click='ctrl.openSecurityUpdate()',
|
||||||
ng-if='ctrl.state.dataUpgradeAvailable'
|
ng-if='ctrl.state.dataUpgradeAvailable && ctrl.state.showDataUpgrade'
|
||||||
)
|
)
|
||||||
span.success.sk-label Encryption upgrade available.
|
span.success.sk-label Encryption upgrade available.
|
||||||
.sk-app-bar-item(
|
.sk-app-bar-item(
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import {
|
|||||||
} from '@/strings';
|
} from '@/strings';
|
||||||
import { PureViewCtrl } from '@Views/abstract/pure_view_ctrl';
|
import { PureViewCtrl } from '@Views/abstract/pure_view_ctrl';
|
||||||
import { confirmDialog } from '@/services/alertService';
|
import { confirmDialog } from '@/services/alertService';
|
||||||
|
import { autorun, IReactionDisposer } from 'mobx';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable before production release.
|
* Disable before production release.
|
||||||
@@ -51,7 +52,9 @@ class FooterViewCtrl extends PureViewCtrl<{}, {
|
|||||||
hasPasscode: boolean;
|
hasPasscode: boolean;
|
||||||
dataUpgradeAvailable: boolean;
|
dataUpgradeAvailable: boolean;
|
||||||
dockShortcuts: DockShortcut[];
|
dockShortcuts: DockShortcut[];
|
||||||
hasAccountSwitcher: boolean
|
hasAccountSwitcher: boolean;
|
||||||
|
showBetaWarning: boolean;
|
||||||
|
showDataUpgrade: boolean;
|
||||||
}> {
|
}> {
|
||||||
private $rootScope: ng.IRootScopeService
|
private $rootScope: ng.IRootScopeService
|
||||||
private rooms: SNComponent[] = []
|
private rooms: SNComponent[] = []
|
||||||
@@ -76,6 +79,7 @@ class FooterViewCtrl extends PureViewCtrl<{}, {
|
|||||||
private observerRemovers: Array<() => void> = [];
|
private observerRemovers: Array<() => void> = [];
|
||||||
private completedInitialSync = false;
|
private completedInitialSync = false;
|
||||||
private showingDownloadStatus = false;
|
private showingDownloadStatus = false;
|
||||||
|
private removeBetaWarningListener?: IReactionDisposer;
|
||||||
|
|
||||||
/* @ngInject */
|
/* @ngInject */
|
||||||
constructor(
|
constructor(
|
||||||
@@ -103,6 +107,7 @@ class FooterViewCtrl extends PureViewCtrl<{}, {
|
|||||||
this.rootScopeListener2 = undefined;
|
this.rootScopeListener2 = undefined;
|
||||||
(this.closeAccountMenu as any) = undefined;
|
(this.closeAccountMenu as any) = undefined;
|
||||||
(this.toggleSyncResolutionMenu as any) = undefined;
|
(this.toggleSyncResolutionMenu as any) = undefined;
|
||||||
|
this.removeBetaWarningListener?.();
|
||||||
super.deinit();
|
super.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,6 +119,13 @@ class FooterViewCtrl extends PureViewCtrl<{}, {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.loadAccountSwitcherState();
|
this.loadAccountSwitcherState();
|
||||||
|
this.removeBetaWarningListener = autorun(() => {
|
||||||
|
const showBetaWarning = this.appState.showBetaWarning;
|
||||||
|
this.setState({
|
||||||
|
showBetaWarning: showBetaWarning,
|
||||||
|
showDataUpgrade: !showBetaWarning
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
loadAccountSwitcherState() {
|
loadAccountSwitcherState() {
|
||||||
@@ -133,7 +145,9 @@ class FooterViewCtrl extends PureViewCtrl<{}, {
|
|||||||
hasPasscode: false,
|
hasPasscode: false,
|
||||||
dockShortcuts: [],
|
dockShortcuts: [],
|
||||||
descriptors: this.mainApplicationGroup.getDescriptors(),
|
descriptors: this.mainApplicationGroup.getDescriptors(),
|
||||||
hasAccountSwitcher: false
|
hasAccountSwitcher: false,
|
||||||
|
showBetaWarning: false,
|
||||||
|
showDataUpgrade: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ body {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.uppercase {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
.tinted {
|
.tinted {
|
||||||
color: var(--sn-stylekit-info-color);
|
color: var(--sn-stylekit-info-color);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,13 +164,12 @@
|
|||||||
.sk-panel-row
|
.sk-panel-row
|
||||||
a.sk-a.info.sk-panel-row.condensed(
|
a.sk-a.info.sk-panel-row.condensed(
|
||||||
ng-click="self.openPasswordWizard()"
|
ng-click="self.openPasswordWizard()"
|
||||||
)
|
ng-if="!self.state.showBetaWarning"
|
||||||
| Change Password
|
) Change Password
|
||||||
a.sk-a.info.sk-panel-row.condensed(
|
a.sk-a.info.sk-panel-row.condensed(
|
||||||
ng-click="self.openPrivilegesModal('')",
|
ng-click="self.openPrivilegesModal('')",
|
||||||
ng-show='self.state.user'
|
ng-show='self.state.user'
|
||||||
)
|
) Manage Privileges
|
||||||
| Manage Privileges
|
|
||||||
.sk-panel-section
|
.sk-panel-section
|
||||||
.sk-panel-section-title Encryption
|
.sk-panel-section-title Encryption
|
||||||
.sk-panel-section-subtitle.info(ng-if='self.state.encryptionEnabled')
|
.sk-panel-section-subtitle.info(ng-if='self.state.encryptionEnabled')
|
||||||
@@ -305,7 +304,12 @@
|
|||||||
.sk-spinner.small.info(ng-if='self.state.importData.loading')
|
.sk-spinner.small.info(ng-if='self.state.importData.loading')
|
||||||
.sk-panel-footer
|
.sk-panel-footer
|
||||||
.sk-panel-row
|
.sk-panel-row
|
||||||
.sk-p.left.neutral.faded {{self.state.appVersion}}
|
.sk-p.left.neutral
|
||||||
|
span.faded {{self.state.appVersion}}
|
||||||
|
span(ng-if="self.state.showBetaWarning")
|
||||||
|
span.faded (
|
||||||
|
a.sk-a(ng-click="self.appState.disableBetaWarning()") Hide beta warning
|
||||||
|
span.faded )
|
||||||
a.sk-a.right(
|
a.sk-a.right(
|
||||||
ng-click='self.hidePasswordForm()',
|
ng-click='self.hidePasswordForm()',
|
||||||
ng-if='self.state.formData.showLogin || self.state.formData.showRegister'
|
ng-if='self.state.formData.showLogin || self.state.formData.showRegister'
|
||||||
|
|||||||
5
package-lock.json
generated
5
package-lock.json
generated
@@ -8380,6 +8380,11 @@
|
|||||||
"minimist": "0.0.8"
|
"minimist": "0.0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"mobx": {
|
||||||
|
"version": "6.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/mobx/-/mobx-6.0.1.tgz",
|
||||||
|
"integrity": "sha512-Pk6uJXZ34yqd661yRmS6z/9avm4FOGXpFpVjnEfiYYOsZXnAxv1fpYjxTCEZ9tuwk0Xe1qnUUlgm+rJtGe0YJA=="
|
||||||
|
},
|
||||||
"mocha": {
|
"mocha": {
|
||||||
"version": "7.1.0",
|
"version": "7.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.0.tgz",
|
||||||
|
|||||||
@@ -69,6 +69,7 @@
|
|||||||
"webpack-merge": "^4.2.2"
|
"webpack-merge": "^4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"mobx": "^6.0.1",
|
||||||
"sncrypto": "github:standardnotes/sncrypto#8794c88daa967eaae493cd5fdec7506d52b257ad",
|
"sncrypto": "github:standardnotes/sncrypto#8794c88daa967eaae493cd5fdec7506d52b257ad",
|
||||||
"snjs": "github:standardnotes/snjs#2009f754384475bfc6a2658eb247e1192f12c784"
|
"snjs": "github:standardnotes/snjs#2009f754384475bfc6a2658eb247e1192f12c784"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user