From b0ccecbd9608d985fcd52e900db25c344e8728a1 Mon Sep 17 00:00:00 2001 From: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com> Date: Fri, 20 Nov 2020 12:14:39 +0100 Subject: [PATCH] fix: show the beta warning on web --- app/assets/javascripts/app.ts | 15 --------------- app/assets/javascripts/ui_models/app_state.ts | 6 ++++-- .../javascripts/ui_models/application_group.ts | 3 ++- .../javascripts/views/footer/footer_view.ts | 2 +- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/app/assets/javascripts/app.ts b/app/assets/javascripts/app.ts index 66e9ca7de..63172c94e 100644 --- a/app/assets/javascripts/app.ts +++ b/app/assets/javascripts/app.ts @@ -63,8 +63,6 @@ const startApplication: StartApplication = async function startApplication( defaultSyncServerHost: string, bridge: Bridge ) { - notifyBetaPeriodEnd(); - SNLog.onLog = console.log; startErrorReporting(); @@ -150,19 +148,6 @@ const startApplication: StartApplication = async function startApplication( }); }; -function notifyBetaPeriodEnd() { - if (window.location.hostname === 'app-beta.standardnotes.org') { - alertDialog({ - title: 'Beta period has ended', - text: - 'Thank you for trying this beta version. Please sign out, then ' + - 'sign in to ' + - 'app.standardnotes.org ' + - 'to continue using Standard Notes.', - }); - } -} - if (__WEB__) { startApplication((window as any)._default_sync_server, new BrowserBridge(__VERSION__)); } else { diff --git a/app/assets/javascripts/ui_models/app_state.ts b/app/assets/javascripts/ui_models/app_state.ts index a935851e8..732ef0fd5 100644 --- a/app/assets/javascripts/ui_models/app_state.ts +++ b/app/assets/javascripts/ui_models/app_state.ts @@ -15,6 +15,7 @@ import { import { WebApplication } from '@/ui_models/application'; import { Editor } from '@/ui_models/editor'; import { action, makeObservable, observable } from 'mobx'; +import { Bridge } from '@/services/bridge'; export enum AppStateEvent { TagChanged = 1, @@ -77,7 +78,8 @@ export class AppState { constructor( $rootScope: ng.IRootScopeService, $timeout: ng.ITimeoutService, - application: WebApplication + application: WebApplication, + private bridge: Bridge, ) { this.$timeout = $timeout; this.$rootScope = $rootScope; @@ -133,7 +135,7 @@ export class AppState { } private determineBetaWarningValue() { - if ((window as any).electronAppVersion?.includes('-beta')) { + if (this.bridge.appVersion.includes('-beta')) { switch (localStorage.getItem(SHOW_BETA_WARNING_KEY)) { case 'true': default: diff --git a/app/assets/javascripts/ui_models/application_group.ts b/app/assets/javascripts/ui_models/application_group.ts index e5ea91113..abe36b84e 100644 --- a/app/assets/javascripts/ui_models/application_group.ts +++ b/app/assets/javascripts/ui_models/application_group.ts @@ -63,7 +63,8 @@ export class ApplicationGroup extends SNApplicationGroup { const appState = new AppState( this.$rootScope, this.$timeout, - application + application, + this.bridge, ); const archiveService = new ArchiveManager( application diff --git a/app/assets/javascripts/views/footer/footer_view.ts b/app/assets/javascripts/views/footer/footer_view.ts index 0797ae601..b6491d070 100644 --- a/app/assets/javascripts/views/footer/footer_view.ts +++ b/app/assets/javascripts/views/footer/footer_view.ts @@ -573,7 +573,7 @@ class FooterViewCtrl extends PureViewCtrl<{}, { title: 'You are using a beta version of the app', text: 'If you wish to go back to a stable version, make sure to sign out ' + - 'before installing it.
You can silence this warning in the ' + + 'of this beta app first.
You can silence this warning from the ' + 'Account menu.' }); }