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

fixed cold start protocol launch

parent 6e7e7f53
...@@ -10,20 +10,24 @@ if (!gotTheLock) { ...@@ -10,20 +10,24 @@ if (!gotTheLock) {
app.quit(); app.quit();
} else { } else {
app.on('second-instance', (event, commandLine, workingDirectory) => { app.on('second-instance', (event, commandLine, workingDirectory) => {
if (process.platform == 'win32') { executeDeeplink(commandLine);
let commandLineString = commandLine.slice(1) + '';
let commandLineArgs = commandLineString.split(",");
deeplinkingUrl = commandLineArgs[commandLineArgs.length - 1].replace("spinshare-song://", "").replace("/", "");
}
if (win) {
if (win.isMinimized()) win.restore();
win.focus();
win.webContents.executeJavaScript(`NavigateToSongDetail("${deeplinkingUrl}")`);
}
}); });
} }
function executeDeeplink(commandLine) {
if (process.platform == 'win32') {
let commandLineString = commandLine.slice(1) + '';
let commandLineArgs = commandLineString.split(",");
deeplinkingUrl = commandLineArgs[commandLineArgs.length - 1].replace("spinshare-song://", "").replace("/", "");
}
if (win) {
if (win.isMinimized()) win.restore();
win.focus();
win.webContents.executeJavaScript(`NavigateToSongDetail("${deeplinkingUrl}")`);
}
}
function createWindow () { function createWindow () {
win = new BrowserWindow({ win = new BrowserWindow({
title: "SpinSha.re", title: "SpinSha.re",
......
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') );
......
// Protocol // Protocol
ipcRenderer.on("protocol-to-songdetail", (event, info) => { ipcRenderer.on("protocol-to-songdetail", (event, info) => {
console.log(info); console.log(info);
}); });
\ No newline at end of file
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