diff --git a/electron-builder.imex.yml b/electron-builder.imex.yml index 5ce7ef4..ab21439 100644 --- a/electron-builder.imex.yml +++ b/electron-builder.imex.yml @@ -16,7 +16,7 @@ asarUnpack: - resources/** win: executableName: ShopPartner - icon: resources/diamond.png + icon: resources/icon.png azureSignOptions: endpoint: https://eus.codesigning.azure.net certificateProfileName: ImEXRPS diff --git a/electron-builder.rome.yml b/electron-builder.rome.yml index 0913cab..9a5a8ab 100644 --- a/electron-builder.rome.yml +++ b/electron-builder.rome.yml @@ -16,7 +16,7 @@ asarUnpack: - resources/** win: executableName: ShopPartner - icon: resources/diamond.png + icon: resources/icon.png azureSignOptions: endpoint: https://eus.codesigning.azure.net certificateProfileName: ImEXRPS diff --git a/src/main/index.ts b/src/main/index.ts index 29a207b..7d9ca9b 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -12,7 +12,7 @@ import { import log from "electron-log/main"; import { autoUpdater } from "electron-updater"; import path, { join } from "path"; -import appIcon from "../../resources/diamond.png?asset"; +import appIcon from "../../resources/icon.png?asset"; import { default as ErrorTypeCheck, default as errorTypeCheck, @@ -29,7 +29,8 @@ Sentry.init({ }); log.initialize(); -const isMac = process.platform === "darwin"; +const isMac: boolean = process.platform === "darwin"; +const protocol: string = "shopprt"; let isAppQuitting = false; //Needed on Mac as an override to allow us to fully quit the app. // Initialize the server const localServer = new LocalServer(); @@ -311,7 +312,7 @@ if (!gotTheLock) { // Some APIs can only be used after this event occurs. app.whenReady().then(async () => { // Set app user model id for windows - electronApp.setAppUserModelId("com.electron"); + electronApp.setAppUserModelId("com.convenient-brands.partner"); // Default open or close DevTools by F12 in development // and ignore CommandOrControl + R in production. @@ -320,10 +321,22 @@ app.whenReady().then(async () => { optimizer.watchWindowShortcuts(window); }); + const isDefaultProtocolClient = app.setAsDefaultProtocolClient(protocol); + if (isDefaultProtocolClient) { + log.info("Protocol handler registered successfully."); + } else { + log.warn("Failed to register protocol handler."); + } + // Add this event handler for second instance - app.on("second-instance", () => { + app.on("second-instance", (_event: Electron.Event, argv: string[]) => { // Someone tried to run a second instance, we should focus our window openMainWindow(); + const url = argv.find((arg) => arg.startsWith(`${protocol}://`)); + if (url) { + console.log("App launched with URL:", url); + // Handle the URL. Not doing anything for now. + } }); //Dynamically load ipcMain handlers once ready. @@ -406,6 +419,16 @@ app.whenReady().then(async () => { }); }); +app.on( + "open-url", + ( + event: Electron.Event, //, _url: string + ) => { + event.preventDefault(); + //Don't do anythign for now. We just want to open the app. + }, +); + // Quit when all windows are closed, except on macOS. There, it's common // for applications and their menu bar to stay active until the user quits // explicitly with Cmd + Q. diff --git a/src/renderer/src/components/Settings/Settings.Watcher.tsx b/src/renderer/src/components/Settings/Settings.Watcher.tsx index b163c61..1d3312d 100644 --- a/src/renderer/src/components/Settings/Settings.Watcher.tsx +++ b/src/renderer/src/components/Settings/Settings.Watcher.tsx @@ -1,4 +1,9 @@ -import { CheckCircleFilled, ExclamationCircleFilled } from "@ant-design/icons"; +import { + CheckCircleFilled, + ExclamationCircleFilled, + PlayCircleOutlined, + PauseCircleOutlined, +} from "@ant-design/icons"; import { selectWatcherError, selectWatcherStatus, @@ -104,11 +109,19 @@ const SettingsWatcher: React.FC = () => { {isWatcherStarted ? ( - ) : ( - )} diff --git a/src/renderer/src/components/Welcome/Welcome.tsx b/src/renderer/src/components/Welcome/Welcome.tsx index 185150c..a36ed9d 100644 --- a/src/renderer/src/components/Welcome/Welcome.tsx +++ b/src/renderer/src/components/Welcome/Welcome.tsx @@ -1,9 +1,10 @@ +import { LogoutOutlined } from "@ant-design/icons"; import { auth } from "@renderer/util/firebase"; -import { Card, Typography } from "antd"; +import { Button, Space, Typography } from "antd"; +import _ from "lodash"; import { JSX, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import ipcTypes from "../../../../util/ipcTypes.json"; -import _ from "lodash"; const Welcome = (): JSX.Element => { const { t } = useTranslation(); const [shopName, setShopName] = useState(null); @@ -25,7 +26,19 @@ const Welcome = (): JSX.Element => { : `${auth.currentUser?.displayName} (${auth.currentUser?.email})`.trim(), })} - {shopName || ""} + + {shopName || ""} + + ); };