Redirect to correct links during search when on desktop

This commit is contained in:
Marquis Kurt 2019-05-22 18:52:19 -04:00
parent 6cd9d3950f
commit 98d98f6824
2 changed files with 12 additions and 4 deletions

View File

@ -69,6 +69,10 @@ function registerProtocol() {
if (target[target.length -1] === "") {
target[target.length -1] = "index.html";
}
if (target[0] === "#") {
target[0] = "app";
}
// Check the middle target and redirect to the appropriate
// build files of the desktop app when running.
@ -164,6 +168,10 @@ function createWindow() {
event.preventDefault();
shell.openExternal(url);
});
mainWindow.webContents.on('will-navigate', (event, url) => {
console.log(url)
})
}
/**
@ -307,4 +315,4 @@ app.on('activate', () => {
createWindow();
createMenubar();
}
});
});

View File

@ -21,7 +21,7 @@ import { Notification } from '../../types/Notification';
import {sendNotificationRequest} from '../../utilities/notifications';
import {withSnackbar} from 'notistack';
import { getConfig, getUserDefaultBool } from '../../utilities/settings';
import { isDarwinApp } from '../../utilities/desktop';
import { isDesktopApp, isDarwinApp } from '../../utilities/desktop';
import { Config } from '../../types/Config';
interface IAppLayoutState {
@ -153,7 +153,7 @@ export class AppLayout extends Component<any, IAppLayoutState> {
}
searchForQuery(what: string) {
window.location.href = "/#/search?query=" + what;
window.location.href = isDesktopApp? "hyperspace://hyperspace/app/index.html#/search?query=" + what: "/#/search?query=" + what;
window.location.reload;
}
@ -408,4 +408,4 @@ export class AppLayout extends Component<any, IAppLayoutState> {
}
}
export default withStyles(styles)(withSnackbar(AppLayout));
export default withStyles(styles)(withSnackbar(AppLayout));