Merge branch 'develop' into t3chguy/poc_riot_desktop_sso_multi_profile

This commit is contained in:
Michael Telatynski 2020-04-14 17:03:00 +01:00 committed by GitHub
commit a77ed6e844
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 73 additions and 5 deletions

View file

@ -9,6 +9,7 @@
"Unable to load config file: please refresh the page to try again.": "Unable to load config file: please refresh the page to try again.",
"Unexpected error preparing the app. See console for details.": "Unexpected error preparing the app. See console for details.",
"Open user settings": "Open user settings",
"Previous/next recently visited room or community": "Previous/next recently visited room or community",
"Riot Desktop on %(platformName)s": "Riot Desktop on %(platformName)s",
"Go to your browser to complete Sign In": "Go to your browser to complete Sign In",
"Unknown device": "Unknown device",

View file

@ -109,7 +109,8 @@ async function start() {
"./init");
try {
await settled(rageshakePromise); // give rageshake a chance to load/fail
// give rageshake a chance to load/fail, we don't actually assert rageshake loads, we allow it to fail if no IDB
await settled(rageshakePromise);
const fragparts = parseQsFromFragment(window.location);
@ -182,7 +183,6 @@ async function start() {
// app load critical path starts here
// assert things started successfully
// ##################################
await rageshakePromise;
await loadOlmPromise;
await loadSkinPromise;
await loadThemePromise;

View file

@ -219,7 +219,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
this.startUpdateCheck = this.startUpdateCheck.bind(this);
this.stopUpdateCheck = this.stopUpdateCheck.bind(this);
// register Mac specific shortcuts
// register OS-specific shortcuts
if (isMac) {
registerShortcut(Categories.NAVIGATION, {
keybinds: [{
@ -228,6 +228,28 @@ export default class ElectronPlatform extends VectorBasePlatform {
}],
description: _td("Open user settings"),
});
registerShortcut(Categories.NAVIGATION, {
keybinds: [{
modifiers: [Modifiers.COMMAND],
key: Key.SQUARE_BRACKET_LEFT,
}, {
modifiers: [Modifiers.COMMAND],
key: Key.SQUARE_BRACKET_RIGHT,
}],
description: _td("Previous/next recently visited room or community"),
});
} else {
registerShortcut(Categories.NAVIGATION, {
keybinds: [{
modifiers: [Modifiers.ALT],
key: Key.ARROW_LEFT,
}, {
modifiers: [Modifiers.ALT],
key: Key.ARROW_RIGHT,
}],
description: _td("Previous/next recently visited room or community"),
});
}
// this is the opaque token we pass to the HS which when we get it in our callback we can resolve to a profile
@ -440,4 +462,32 @@ export default class ElectronPlatform extends VectorBasePlatform {
description: <Spinner />,
});
}
_navigateForwardBack(back: boolean) {
this._ipcCall(back ? "navigateBack" : "navigateForward");
}
onKeyDown(ev: KeyboardEvent): boolean {
let handled = false;
switch (ev.key) {
case Key.SQUARE_BRACKET_LEFT:
case Key.SQUARE_BRACKET_RIGHT:
if (isMac && ev.metaKey && !ev.altKey && !ev.ctrlKey && !ev.shiftKey) {
this._navigateForwardBack(ev.key === Key.SQUARE_BRACKET_LEFT);
handled = true;
}
break;
case Key.ARROW_LEFT:
case Key.ARROW_RIGHT:
if (!isMac && ev.altKey && !ev.metaKey && !ev.ctrlKey && !ev.shiftKey) {
this._navigateForwardBack(ev.key === Key.ARROW_LEFT);
handled = true;
}
break;
}
return handled;
}
}