deep link working basically

This commit is contained in:
talksik
2022-03-31 15:00:31 -04:00
parent 1c25fea726
commit 210264f352
3 changed files with 32 additions and 2 deletions
+8 -1
View File
@@ -20,7 +20,14 @@
"config": {
"forge": {
"packagerConfig": {
"icon": "./src/assets/1024x1024"
"icon": "./src/assets/1024x1024",
"protocols": [
{
"protocol": "nirvana-desktop",
"name": "nirvana-desktop",
"schemes": "nirvana-desktop"
}
]
},
"makers": [
{
+19 -1
View File
@@ -1,4 +1,4 @@
import { BrowserWindow, app, ipcMain } from "electron";
import { BrowserWindow, app, dialog, ipcMain } from "electron";
import Channels, { Dimensions } from "./electron/constants";
import { handleLogin } from "./electron/handleLogin";
@@ -88,3 +88,21 @@ app.on("activate", () => {
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and import them here.
// open deep links from nirvana web app
if (process.defaultApp) {
if (process.argv.length >= 2) {
app.setAsDefaultProtocolClient("nirvana-desktop", process.execPath, [
path.resolve(process.argv[1]),
]);
}
} else {
app.setAsDefaultProtocolClient("nirvana-desktop");
}
// Handle the protocol. In this case, we choose to show an Error Box.
app.on("open-url", (event, url) => {
console.log("welcome back, you arrived from: ", url);
browserWindow.focus();
});
+5
View File
@@ -1,8 +1,13 @@
import { FcGoogle } from "react-icons/fc";
import Footer from "../../components/footer";
import Header from "../../components/header";
import { useEffect } from "react";
export default function AuthSuccess() {
useEffect(() => {
window.open("nirvana-desktop://login", "_self");
}, []);
return (
<>
<Header />