Skip to content

Commit

Permalink
fix: show the beta warning on web
Browse files Browse the repository at this point in the history
  • Loading branch information
arielsvg committed Nov 20, 2020
1 parent 93876a1 commit b0ccecb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
15 changes: 0 additions & 15 deletions app/assets/javascripts/app.ts
Expand Up @@ -63,8 +63,6 @@ const startApplication: StartApplication = async function startApplication(
defaultSyncServerHost: string,
bridge: Bridge
) {
notifyBetaPeriodEnd();

SNLog.onLog = console.log;
startErrorReporting();

Expand Down Expand Up @@ -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 <a href="https://app.standardnotes.org" target="_blank">' +
'app.standardnotes.org</a> ' +
'to continue using Standard Notes.',
});
}
}

if (__WEB__) {
startApplication((window as any)._default_sync_server, new BrowserBridge(__VERSION__));
} else {
Expand Down
6 changes: 4 additions & 2 deletions app/assets/javascripts/ui_models/app_state.ts
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion app/assets/javascripts/ui_models/application_group.ts
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/views/footer/footer_view.ts
Expand Up @@ -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.<br>You can silence this warning in the ' +
'of this beta app first.<br>You can silence this warning from the ' +
'<em>Account</em> menu.'
});
}
Expand Down

0 comments on commit b0ccecb

Please sign in to comment.