Commit 0ed9ea44 authored by Andreas Heimann's avatar Andreas Heimann

fixed cold start protocol launch

parent 6e7e7f53
...@@ -10,6 +10,11 @@ if (!gotTheLock) { ...@@ -10,6 +10,11 @@ if (!gotTheLock) {
app.quit(); app.quit();
} else { } else {
app.on('second-instance', (event, commandLine, workingDirectory) => { app.on('second-instance', (event, commandLine, workingDirectory) => {
executeDeeplink(commandLine);
});
}
function executeDeeplink(commandLine) {
if (process.platform == 'win32') { if (process.platform == 'win32') {
let commandLineString = commandLine.slice(1) + ''; let commandLineString = commandLine.slice(1) + '';
let commandLineArgs = commandLineString.split(","); let commandLineArgs = commandLineString.split(",");
...@@ -21,7 +26,6 @@ if (!gotTheLock) { ...@@ -21,7 +26,6 @@ if (!gotTheLock) {
win.focus(); win.focus();
win.webContents.executeJavaScript(`NavigateToSongDetail("${deeplinkingUrl}")`); win.webContents.executeJavaScript(`NavigateToSongDetail("${deeplinkingUrl}")`);
} }
});
} }
function createWindow () { function createWindow () {
......
const { ipcRenderer } = require('electron'); const { ipcRenderer } = require('electron');
const { dialog, shell, app, clipboard } = require('electron').remote; const { dialog, shell, app, clipboard, process } = require('electron').remote;
const isDev = require('electron-is-dev'); const isDev = require('electron-is-dev');
const path = require('path'); const path = require('path');
const SSAPI = require( path.resolve(__dirname, './assets/js/module.api.js') ); const SSAPI = require( path.resolve(__dirname, './assets/js/module.api.js') );
......
...@@ -2,3 +2,10 @@ ...@@ -2,3 +2,10 @@
ipcRenderer.on("protocol-to-songdetail", (event, info) => { ipcRenderer.on("protocol-to-songdetail", (event, info) => {
console.log(info); console.log(info);
}); });
if(process.argv.length > 1) {
if(process.argv[1].includes("spinshare-song")) {
let songId = process.argv[1].replace("spinshare-song://", "").replace("/", "");
NavigateToSongDetail(songId);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment