diff --git a/app/assets/javascripts/app.ts b/app/assets/javascripts/app.ts
index 039f62df91c..2d1762e8d6f 100644
--- a/app/assets/javascripts/app.ts
+++ b/app/assets/javascripts/app.ts
@@ -80,7 +80,7 @@ import { NotesOptionsPanelDirective } from './components/NotesOptionsPanel';
import { IconDirective } from './components/Icon';
import { NoteTagsContainerDirective } from './components/NoteTagsContainer';
import { PreferencesDirective } from './preferences';
-import { AppVersion, IsWebPlatform } from '@/version';
+import { WebAppVersion, IsWebPlatform } from '@/version';
import { NotesListOptionsDirective } from './components/NotesListOptionsMenu';
import { PurchaseFlowDirective } from './purchaseFlow';
import { QuickSettingsMenuDirective } from './components/QuickSettingsMenu/QuickSettingsMenu';
@@ -224,7 +224,7 @@ const startApplication: StartApplication = async function startApplication(
if (IsWebPlatform) {
startApplication(
window._default_sync_server,
- new BrowserBridge(AppVersion),
+ new BrowserBridge(WebAppVersion),
window._enable_unfinished_features,
window._websocket_url
);
diff --git a/app/assets/javascripts/components/AccountMenu/Footer.tsx b/app/assets/javascripts/components/AccountMenu/Footer.tsx
deleted file mode 100644
index ac4b67f9d67..00000000000
--- a/app/assets/javascripts/components/AccountMenu/Footer.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-import { AppState } from '@/ui_models/app_state';
-import { useState } from 'preact/hooks';
-import { WebApplication } from '@/ui_models/application';
-import { observer } from 'mobx-react-lite';
-
-type Props = {
- application: WebApplication;
- appState: AppState;
-};
-
-const Footer = observer(({ application, appState }: Props) => {
- const {
- showSignIn,
- showRegister,
- setShowSignIn,
- setShowRegister,
- setSigningOut,
- } = appState.accountMenu;
-
- const { showBetaWarning, disableBetaWarning: disableAppStateBetaWarning } =
- appState;
-
- const [appVersion] = useState(
- () =>
- `v${(window as any).electronAppVersion || application.bridge.appVersion}`
- );
-
- const disableBetaWarning = () => {
- disableAppStateBetaWarning();
- };
-
- const signOut = () => {
- setSigningOut(true);
- };
-
- const hidePasswordForm = () => {
- setShowSignIn(false);
- setShowRegister(false);
- };
-
- return (
-
- );
-});
-
-export default Footer;
diff --git a/app/assets/javascripts/components/AccountMenu/GeneralAccountMenu.tsx b/app/assets/javascripts/components/AccountMenu/GeneralAccountMenu.tsx
index 68e00ed9a16..5b037864847 100644
--- a/app/assets/javascripts/components/AccountMenu/GeneralAccountMenu.tsx
+++ b/app/assets/javascripts/components/AccountMenu/GeneralAccountMenu.tsx
@@ -8,7 +8,6 @@ import { STRING_GENERIC_SYNC_ERROR } from '@/strings';
import { useState } from 'preact/hooks';
import { AccountMenuPane } from '.';
import { FunctionComponent } from 'preact';
-import { AppVersion } from '@/version';
import { Menu } from '../menu/Menu';
import { MenuItem, MenuItemSeparator, MenuItemType } from '../menu/MenuItem';
@@ -156,7 +155,7 @@ export const GeneralAccountMenu: FunctionComponent = observer(
Help & feedback
- v{AppVersion}
+ v{appState.version}
{user ? (
<>
diff --git a/app/assets/javascripts/services/errorReporting.ts b/app/assets/javascripts/services/errorReporting.ts
index cb748d1640d..4949fe90b18 100644
--- a/app/assets/javascripts/services/errorReporting.ts
+++ b/app/assets/javascripts/services/errorReporting.ts
@@ -1,9 +1,9 @@
import { isNullOrUndefined, SNLog } from '@standardnotes/snjs';
-import { isDesktopApplication, isDev } from '@/utils';
+import { getDesktopVersion, isDesktopApplication, isDev } from '@/utils';
import { storage, StorageKey } from './localStorage';
import Bugsnag from '@bugsnag/js';
import { WebCrypto } from '../crypto';
-import { AppVersion } from '@/version';
+import { WebAppVersion } from '@/version';
function redactFilePath(line: string): string {
const fileName = line.match(/\w+\.(html|js)/)?.[0];
@@ -43,7 +43,7 @@ export function startErrorReporting(): void {
Bugsnag.start({
apiKey: window._bugsnag_api_key,
appType: isDesktopApplication() ? 'desktop' : 'web',
- appVersion: AppVersion,
+ appVersion: getDesktopVersion() || WebAppVersion,
collectUserIp: false,
autoTrackSessions: false,
releaseStage: isDev ? 'development' : undefined,
diff --git a/app/assets/javascripts/ui_models/app_state/app_state.ts b/app/assets/javascripts/ui_models/app_state/app_state.ts
index 642d9f8c08b..71d4440f0c2 100644
--- a/app/assets/javascripts/ui_models/app_state/app_state.ts
+++ b/app/assets/javascripts/ui_models/app_state/app_state.ts
@@ -226,6 +226,10 @@ export class AppState {
storage.set(StorageKey.ShowBetaWarning, true);
}
+ public get version(): string {
+ return this.bridge.appVersion;
+ }
+
async openNewNote(title?: string) {
if (!this.multiEditorSupport) {
this.closeActiveNoteController();
diff --git a/app/assets/javascripts/ui_models/application.ts b/app/assets/javascripts/ui_models/application.ts
index d574a938b55..c99fd8a9f37 100644
--- a/app/assets/javascripts/ui_models/application.ts
+++ b/app/assets/javascripts/ui_models/application.ts
@@ -11,7 +11,6 @@ import { ThemeManager } from '@/services/themeManager';
import { PasswordWizardScope, PasswordWizardType } from '@/types';
import { AppState } from '@/ui_models/app_state';
import { NoteGroupController } from '@/views/note_group_view/note_group_controller';
-import { AppVersion } from '@/version';
import { WebDeviceInterface } from '@/web_device_interface';
import {
DeinitSource,
@@ -59,7 +58,7 @@ export class WebApplication extends SNApplication {
identifier,
[],
defaultSyncServerHost,
- AppVersion,
+ bridge.appVersion,
enableUnfinishedFeatures,
webSocketUrl
);
diff --git a/app/assets/javascripts/utils/index.ts b/app/assets/javascripts/utils/index.ts
index 7a271451665..4325f837095 100644
--- a/app/assets/javascripts/utils/index.ts
+++ b/app/assets/javascripts/utils/index.ts
@@ -148,6 +148,10 @@ export function isDesktopApplication() {
return IsDesktopPlatform;
}
+export function getDesktopVersion() {
+ return (window as any).electronAppVersion;
+}
+
export const isEmailValid = (email: string): boolean => {
return EMAIL_REGEX.test(email);
};
diff --git a/app/assets/javascripts/version.ts b/app/assets/javascripts/version.ts
index ca108b555f5..abb410a2de3 100644
--- a/app/assets/javascripts/version.ts
+++ b/app/assets/javascripts/version.ts
@@ -3,6 +3,6 @@ declare const __VERSION__: string;
declare const __DESKTOP__: boolean;
declare const __WEB__: boolean;
-export const AppVersion = __VERSION__;
+export const WebAppVersion = __VERSION__;
export const IsDesktopPlatform = __DESKTOP__;
export const IsWebPlatform = __WEB__;
diff --git a/app/assets/javascripts/web_device_interface.ts b/app/assets/javascripts/web_device_interface.ts
index e163a93a59e..3e8b611a5ab 100644
--- a/app/assets/javascripts/web_device_interface.ts
+++ b/app/assets/javascripts/web_device_interface.ts
@@ -1,15 +1,16 @@
-import { DeviceInterface, getGlobalScope, SNApplication, ApplicationIdentifier } from '@standardnotes/snjs';
+import {
+ DeviceInterface,
+ getGlobalScope,
+ SNApplication,
+ ApplicationIdentifier,
+} from '@standardnotes/snjs';
import { Database } from '@/database';
import { Bridge } from './services/bridge';
export class WebDeviceInterface extends DeviceInterface {
+ private databases: Database[] = [];
- private databases: Database[] = []
-
- constructor(
- timeout: any,
- private bridge: Bridge
- ) {
+ constructor(timeout: any, private bridge: Bridge) {
super(
timeout || setTimeout.bind(getGlobalScope()),
setInterval.bind(getGlobalScope())
@@ -17,17 +18,22 @@ export class WebDeviceInterface extends DeviceInterface {
}
setApplication(application: SNApplication) {
- const database = new Database(application.identifier, application.alertService!);
+ const database = new Database(
+ application.identifier,
+ application.alertService
+ );
this.databases.push(database);
}
private databaseForIdentifier(identifier: ApplicationIdentifier) {
- return this.databases.find(database => database.databaseName === identifier)!;
+ return this.databases.find(
+ (database) => database.databaseName === identifier
+ )!;
}
deinit() {
super.deinit();
- for(const database of this.databases) {
+ for (const database of this.databases) {
database.deinit();
}
this.databases = [];
@@ -42,7 +48,7 @@ export class WebDeviceInterface extends DeviceInterface {
for (const key of Object.keys(localStorage)) {
results.push({
key: key,
- value: localStorage[key]
+ value: localStorage[key],
});
}
return results;
@@ -63,13 +69,16 @@ export class WebDeviceInterface extends DeviceInterface {
async openDatabase(identifier: ApplicationIdentifier) {
this.databaseForIdentifier(identifier).unlock();
return new Promise((resolve, reject) => {
- this.databaseForIdentifier(identifier).openDatabase(() => {
- resolve({ isNewDatabase: true });
- }).then(() => {
- resolve({ isNewDatabase: false });
- }).catch((error => {
- reject(error);
- }));
+ this.databaseForIdentifier(identifier)
+ .openDatabase(() => {
+ resolve({ isNewDatabase: true });
+ })
+ .then(() => {
+ resolve({ isNewDatabase: false });
+ })
+ .catch((error) => {
+ reject(error);
+ });
}) as Promise<{ isNewDatabase?: boolean } | undefined>;
}
@@ -77,15 +86,24 @@ export class WebDeviceInterface extends DeviceInterface {
return this.databaseForIdentifier(identifier).getAllPayloads();
}
- async saveRawDatabasePayload(payload: any, identifier: ApplicationIdentifier) {
+ async saveRawDatabasePayload(
+ payload: any,
+ identifier: ApplicationIdentifier
+ ) {
return this.databaseForIdentifier(identifier).savePayload(payload);
}
- async saveRawDatabasePayloads(payloads: any[], identifier: ApplicationIdentifier) {
+ async saveRawDatabasePayloads(
+ payloads: any[],
+ identifier: ApplicationIdentifier
+ ) {
return this.databaseForIdentifier(identifier).savePayloads(payloads);
}
- async removeRawDatabasePayloadWithId(id: string, identifier: ApplicationIdentifier) {
+ async removeRawDatabasePayloadWithId(
+ id: string,
+ identifier: ApplicationIdentifier
+ ) {
return this.databaseForIdentifier(identifier).deletePayload(id);
}
@@ -101,14 +119,17 @@ export class WebDeviceInterface extends DeviceInterface {
return keychain[identifier];
}
- async setNamespacedKeychainValue(value: any, identifier: ApplicationIdentifier) {
+ async setNamespacedKeychainValue(
+ value: any,
+ identifier: ApplicationIdentifier
+ ) {
let keychain = await this.getRawKeychainValue();
if (!keychain) {
keychain = {};
}
return this.bridge.setKeychainValue({
...keychain,
- [identifier]: value
+ [identifier]: value,
});
}