fix: display correct app version for desktop
This commit is contained in:
@@ -80,7 +80,7 @@ import { NotesOptionsPanelDirective } from './components/NotesOptionsPanel';
|
|||||||
import { IconDirective } from './components/Icon';
|
import { IconDirective } from './components/Icon';
|
||||||
import { NoteTagsContainerDirective } from './components/NoteTagsContainer';
|
import { NoteTagsContainerDirective } from './components/NoteTagsContainer';
|
||||||
import { PreferencesDirective } from './preferences';
|
import { PreferencesDirective } from './preferences';
|
||||||
import { AppVersion, IsWebPlatform } from '@/version';
|
import { WebAppVersion, IsWebPlatform } from '@/version';
|
||||||
import { NotesListOptionsDirective } from './components/NotesListOptionsMenu';
|
import { NotesListOptionsDirective } from './components/NotesListOptionsMenu';
|
||||||
import { PurchaseFlowDirective } from './purchaseFlow';
|
import { PurchaseFlowDirective } from './purchaseFlow';
|
||||||
import { QuickSettingsMenuDirective } from './components/QuickSettingsMenu/QuickSettingsMenu';
|
import { QuickSettingsMenuDirective } from './components/QuickSettingsMenu/QuickSettingsMenu';
|
||||||
@@ -224,7 +224,7 @@ const startApplication: StartApplication = async function startApplication(
|
|||||||
if (IsWebPlatform) {
|
if (IsWebPlatform) {
|
||||||
startApplication(
|
startApplication(
|
||||||
window._default_sync_server,
|
window._default_sync_server,
|
||||||
new BrowserBridge(AppVersion),
|
new BrowserBridge(WebAppVersion),
|
||||||
window._enable_unfinished_features,
|
window._enable_unfinished_features,
|
||||||
window._websocket_url
|
window._websocket_url
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -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 (
|
|
||||||
<div className="sk-panel-footer">
|
|
||||||
<div className="sk-panel-row">
|
|
||||||
<div className="sk-p left neutral">
|
|
||||||
<span>{appVersion}</span>
|
|
||||||
{showBetaWarning && (
|
|
||||||
<span>
|
|
||||||
<span> (</span>
|
|
||||||
<a className="sk-a" onClick={disableBetaWarning}>
|
|
||||||
Hide beta warning
|
|
||||||
</a>
|
|
||||||
<span>)</span>
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
{(showSignIn || showRegister) && (
|
|
||||||
<a className="sk-a right" onClick={hidePasswordForm}>
|
|
||||||
Cancel
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
{!showSignIn && !showRegister && (
|
|
||||||
<a className="sk-a right danger capitalize" onClick={signOut}>
|
|
||||||
{application.hasAccount() ? 'Sign out' : 'Clear session data'}
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
export default Footer;
|
|
||||||
@@ -8,7 +8,6 @@ import { STRING_GENERIC_SYNC_ERROR } from '@/strings';
|
|||||||
import { useState } from 'preact/hooks';
|
import { useState } from 'preact/hooks';
|
||||||
import { AccountMenuPane } from '.';
|
import { AccountMenuPane } from '.';
|
||||||
import { FunctionComponent } from 'preact';
|
import { FunctionComponent } from 'preact';
|
||||||
import { AppVersion } from '@/version';
|
|
||||||
import { Menu } from '../menu/Menu';
|
import { Menu } from '../menu/Menu';
|
||||||
import { MenuItem, MenuItemSeparator, MenuItemType } from '../menu/MenuItem';
|
import { MenuItem, MenuItemSeparator, MenuItemType } from '../menu/MenuItem';
|
||||||
|
|
||||||
@@ -156,7 +155,7 @@ export const GeneralAccountMenu: FunctionComponent<Props> = observer(
|
|||||||
<Icon type="help" className={iconClassName} />
|
<Icon type="help" className={iconClassName} />
|
||||||
Help & feedback
|
Help & feedback
|
||||||
</div>
|
</div>
|
||||||
<span className="color-neutral">v{AppVersion}</span>
|
<span className="color-neutral">v{appState.version}</span>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
{user ? (
|
{user ? (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { isNullOrUndefined, SNLog } from '@standardnotes/snjs';
|
import { isNullOrUndefined, SNLog } from '@standardnotes/snjs';
|
||||||
import { isDesktopApplication, isDev } from '@/utils';
|
import { getDesktopVersion, isDesktopApplication, isDev } from '@/utils';
|
||||||
import { storage, StorageKey } from './localStorage';
|
import { storage, StorageKey } from './localStorage';
|
||||||
import Bugsnag from '@bugsnag/js';
|
import Bugsnag from '@bugsnag/js';
|
||||||
import { WebCrypto } from '../crypto';
|
import { WebCrypto } from '../crypto';
|
||||||
import { AppVersion } from '@/version';
|
import { WebAppVersion } from '@/version';
|
||||||
|
|
||||||
function redactFilePath(line: string): string {
|
function redactFilePath(line: string): string {
|
||||||
const fileName = line.match(/\w+\.(html|js)/)?.[0];
|
const fileName = line.match(/\w+\.(html|js)/)?.[0];
|
||||||
@@ -43,7 +43,7 @@ export function startErrorReporting(): void {
|
|||||||
Bugsnag.start({
|
Bugsnag.start({
|
||||||
apiKey: window._bugsnag_api_key,
|
apiKey: window._bugsnag_api_key,
|
||||||
appType: isDesktopApplication() ? 'desktop' : 'web',
|
appType: isDesktopApplication() ? 'desktop' : 'web',
|
||||||
appVersion: AppVersion,
|
appVersion: getDesktopVersion() || WebAppVersion,
|
||||||
collectUserIp: false,
|
collectUserIp: false,
|
||||||
autoTrackSessions: false,
|
autoTrackSessions: false,
|
||||||
releaseStage: isDev ? 'development' : undefined,
|
releaseStage: isDev ? 'development' : undefined,
|
||||||
|
|||||||
@@ -226,6 +226,10 @@ export class AppState {
|
|||||||
storage.set(StorageKey.ShowBetaWarning, true);
|
storage.set(StorageKey.ShowBetaWarning, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get version(): string {
|
||||||
|
return this.bridge.appVersion;
|
||||||
|
}
|
||||||
|
|
||||||
async openNewNote(title?: string) {
|
async openNewNote(title?: string) {
|
||||||
if (!this.multiEditorSupport) {
|
if (!this.multiEditorSupport) {
|
||||||
this.closeActiveNoteController();
|
this.closeActiveNoteController();
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import { ThemeManager } from '@/services/themeManager';
|
|||||||
import { PasswordWizardScope, PasswordWizardType } from '@/types';
|
import { PasswordWizardScope, PasswordWizardType } from '@/types';
|
||||||
import { AppState } from '@/ui_models/app_state';
|
import { AppState } from '@/ui_models/app_state';
|
||||||
import { NoteGroupController } from '@/views/note_group_view/note_group_controller';
|
import { NoteGroupController } from '@/views/note_group_view/note_group_controller';
|
||||||
import { AppVersion } from '@/version';
|
|
||||||
import { WebDeviceInterface } from '@/web_device_interface';
|
import { WebDeviceInterface } from '@/web_device_interface';
|
||||||
import {
|
import {
|
||||||
DeinitSource,
|
DeinitSource,
|
||||||
@@ -59,7 +58,7 @@ export class WebApplication extends SNApplication {
|
|||||||
identifier,
|
identifier,
|
||||||
[],
|
[],
|
||||||
defaultSyncServerHost,
|
defaultSyncServerHost,
|
||||||
AppVersion,
|
bridge.appVersion,
|
||||||
enableUnfinishedFeatures,
|
enableUnfinishedFeatures,
|
||||||
webSocketUrl
|
webSocketUrl
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -148,6 +148,10 @@ export function isDesktopApplication() {
|
|||||||
return IsDesktopPlatform;
|
return IsDesktopPlatform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getDesktopVersion() {
|
||||||
|
return (window as any).electronAppVersion;
|
||||||
|
}
|
||||||
|
|
||||||
export const isEmailValid = (email: string): boolean => {
|
export const isEmailValid = (email: string): boolean => {
|
||||||
return EMAIL_REGEX.test(email);
|
return EMAIL_REGEX.test(email);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ declare const __VERSION__: string;
|
|||||||
declare const __DESKTOP__: boolean;
|
declare const __DESKTOP__: boolean;
|
||||||
declare const __WEB__: boolean;
|
declare const __WEB__: boolean;
|
||||||
|
|
||||||
export const AppVersion = __VERSION__;
|
export const WebAppVersion = __VERSION__;
|
||||||
export const IsDesktopPlatform = __DESKTOP__;
|
export const IsDesktopPlatform = __DESKTOP__;
|
||||||
export const IsWebPlatform = __WEB__;
|
export const IsWebPlatform = __WEB__;
|
||||||
|
|||||||
@@ -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 { Database } from '@/database';
|
||||||
import { Bridge } from './services/bridge';
|
import { Bridge } from './services/bridge';
|
||||||
|
|
||||||
export class WebDeviceInterface extends DeviceInterface {
|
export class WebDeviceInterface extends DeviceInterface {
|
||||||
|
private databases: Database[] = [];
|
||||||
|
|
||||||
private databases: Database[] = []
|
constructor(timeout: any, private bridge: Bridge) {
|
||||||
|
|
||||||
constructor(
|
|
||||||
timeout: any,
|
|
||||||
private bridge: Bridge
|
|
||||||
) {
|
|
||||||
super(
|
super(
|
||||||
timeout || setTimeout.bind(getGlobalScope()),
|
timeout || setTimeout.bind(getGlobalScope()),
|
||||||
setInterval.bind(getGlobalScope())
|
setInterval.bind(getGlobalScope())
|
||||||
@@ -17,17 +18,22 @@ export class WebDeviceInterface extends DeviceInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setApplication(application: SNApplication) {
|
setApplication(application: SNApplication) {
|
||||||
const database = new Database(application.identifier, application.alertService!);
|
const database = new Database(
|
||||||
|
application.identifier,
|
||||||
|
application.alertService
|
||||||
|
);
|
||||||
this.databases.push(database);
|
this.databases.push(database);
|
||||||
}
|
}
|
||||||
|
|
||||||
private databaseForIdentifier(identifier: ApplicationIdentifier) {
|
private databaseForIdentifier(identifier: ApplicationIdentifier) {
|
||||||
return this.databases.find(database => database.databaseName === identifier)!;
|
return this.databases.find(
|
||||||
|
(database) => database.databaseName === identifier
|
||||||
|
)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit() {
|
deinit() {
|
||||||
super.deinit();
|
super.deinit();
|
||||||
for(const database of this.databases) {
|
for (const database of this.databases) {
|
||||||
database.deinit();
|
database.deinit();
|
||||||
}
|
}
|
||||||
this.databases = [];
|
this.databases = [];
|
||||||
@@ -42,7 +48,7 @@ export class WebDeviceInterface extends DeviceInterface {
|
|||||||
for (const key of Object.keys(localStorage)) {
|
for (const key of Object.keys(localStorage)) {
|
||||||
results.push({
|
results.push({
|
||||||
key: key,
|
key: key,
|
||||||
value: localStorage[key]
|
value: localStorage[key],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
@@ -63,13 +69,16 @@ export class WebDeviceInterface extends DeviceInterface {
|
|||||||
async openDatabase(identifier: ApplicationIdentifier) {
|
async openDatabase(identifier: ApplicationIdentifier) {
|
||||||
this.databaseForIdentifier(identifier).unlock();
|
this.databaseForIdentifier(identifier).unlock();
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.databaseForIdentifier(identifier).openDatabase(() => {
|
this.databaseForIdentifier(identifier)
|
||||||
resolve({ isNewDatabase: true });
|
.openDatabase(() => {
|
||||||
}).then(() => {
|
resolve({ isNewDatabase: true });
|
||||||
resolve({ isNewDatabase: false });
|
})
|
||||||
}).catch((error => {
|
.then(() => {
|
||||||
reject(error);
|
resolve({ isNewDatabase: false });
|
||||||
}));
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
}) as Promise<{ isNewDatabase?: boolean } | undefined>;
|
}) as Promise<{ isNewDatabase?: boolean } | undefined>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,15 +86,24 @@ export class WebDeviceInterface extends DeviceInterface {
|
|||||||
return this.databaseForIdentifier(identifier).getAllPayloads();
|
return this.databaseForIdentifier(identifier).getAllPayloads();
|
||||||
}
|
}
|
||||||
|
|
||||||
async saveRawDatabasePayload(payload: any, identifier: ApplicationIdentifier) {
|
async saveRawDatabasePayload(
|
||||||
|
payload: any,
|
||||||
|
identifier: ApplicationIdentifier
|
||||||
|
) {
|
||||||
return this.databaseForIdentifier(identifier).savePayload(payload);
|
return this.databaseForIdentifier(identifier).savePayload(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
async saveRawDatabasePayloads(payloads: any[], identifier: ApplicationIdentifier) {
|
async saveRawDatabasePayloads(
|
||||||
|
payloads: any[],
|
||||||
|
identifier: ApplicationIdentifier
|
||||||
|
) {
|
||||||
return this.databaseForIdentifier(identifier).savePayloads(payloads);
|
return this.databaseForIdentifier(identifier).savePayloads(payloads);
|
||||||
}
|
}
|
||||||
|
|
||||||
async removeRawDatabasePayloadWithId(id: string, identifier: ApplicationIdentifier) {
|
async removeRawDatabasePayloadWithId(
|
||||||
|
id: string,
|
||||||
|
identifier: ApplicationIdentifier
|
||||||
|
) {
|
||||||
return this.databaseForIdentifier(identifier).deletePayload(id);
|
return this.databaseForIdentifier(identifier).deletePayload(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,14 +119,17 @@ export class WebDeviceInterface extends DeviceInterface {
|
|||||||
return keychain[identifier];
|
return keychain[identifier];
|
||||||
}
|
}
|
||||||
|
|
||||||
async setNamespacedKeychainValue(value: any, identifier: ApplicationIdentifier) {
|
async setNamespacedKeychainValue(
|
||||||
|
value: any,
|
||||||
|
identifier: ApplicationIdentifier
|
||||||
|
) {
|
||||||
let keychain = await this.getRawKeychainValue();
|
let keychain = await this.getRawKeychainValue();
|
||||||
if (!keychain) {
|
if (!keychain) {
|
||||||
keychain = {};
|
keychain = {};
|
||||||
}
|
}
|
||||||
return this.bridge.setKeychainValue({
|
return this.bridge.setKeychainValue({
|
||||||
...keychain,
|
...keychain,
|
||||||
[identifier]: value
|
[identifier]: value,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user