Merge branch 'hotfix/10.5.2'
This commit is contained in:
@@ -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
|
||||
);
|
||||
|
||||
@@ -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 { 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<Props> = observer(
|
||||
<Icon type="help" className={iconClassName} />
|
||||
Help & feedback
|
||||
</div>
|
||||
<span className="color-neutral">v{AppVersion}</span>
|
||||
<span className="color-neutral">v{appState.version}</span>
|
||||
</MenuItem>
|
||||
{user ? (
|
||||
<>
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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__;
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user