Merge branch 'feature/IO-3066-1-scaffolding' of bitbucket.org:snaptsoft/bodyshop-desktop into feature/IO-3066-1-scaffolding
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { platform } from "@electron-toolkit/utils";
|
||||
import { UUID } from "crypto";
|
||||
import { Notification } from "electron";
|
||||
import { Notification, shell } from "electron";
|
||||
import log from "electron-log/main";
|
||||
import fs from "fs";
|
||||
import _ from "lodash";
|
||||
@@ -173,21 +173,32 @@ async function ImportJob(filepath: string): Promise<void> {
|
||||
},
|
||||
);
|
||||
setAppProgressbar(-1);
|
||||
new Notification({
|
||||
const uploadNotification = new Notification({
|
||||
title: "Job Imported",
|
||||
body: `Job ${newAvailableJob.cieca_id} imported successfully`,
|
||||
//subtitle: `${newAvailableJob.ownr_name} - ${newAvailableJob.vehicle_info}`,
|
||||
body: `${newAvailableJob.ownr_name} - ${newAvailableJob.vehicle_info}. Click to view.`,
|
||||
actions: [{ text: "View Job", type: "button" }],
|
||||
subtitle: newAvailableJob.ownr_name,
|
||||
}).show();
|
||||
});
|
||||
uploadNotification.on("click", () => {
|
||||
shell.openExternal(
|
||||
`${
|
||||
store.get("app.isTest")
|
||||
? import.meta.env.VITE_FE_URL_TEST
|
||||
: import.meta.env.VITE_FE_URL
|
||||
}/manage/available`,
|
||||
);
|
||||
});
|
||||
uploadNotification.show();
|
||||
|
||||
log.debug("Job inserted", insertRecordResult);
|
||||
} catch (error) {
|
||||
log.error("Error encountered while decoding job. ", errorTypeCheck(error));
|
||||
new Notification({
|
||||
const uploadNotificationFailure = new Notification({
|
||||
title: "Job Upload Failure",
|
||||
body: errorTypeCheck(error).message, //TODO: Remove after debug.
|
||||
actions: [{ text: "View Job", type: "button" }],
|
||||
}).show();
|
||||
});
|
||||
|
||||
uploadNotificationFailure.show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -325,7 +325,22 @@ app.whenReady().then(async () => {
|
||||
optimizer.watchWindowShortcuts(window);
|
||||
});
|
||||
|
||||
const isDefaultProtocolClient = app.setAsDefaultProtocolClient(protocol);
|
||||
let isDefaultProtocolClient;
|
||||
// remove so we can register each time as we run the app.
|
||||
app.removeAsDefaultProtocolClient(protocol);
|
||||
|
||||
// If we are running a non-packaged version of the app && on windows
|
||||
if (process.env.NODE_ENV === "development" && process.platform === "win32") {
|
||||
// Set the path of electron.exe and your app.
|
||||
// These two additional parameters are only available on windows.
|
||||
isDefaultProtocolClient = app.setAsDefaultProtocolClient(
|
||||
protocol,
|
||||
process.execPath,
|
||||
[path.resolve(process.argv[1])],
|
||||
);
|
||||
} else {
|
||||
isDefaultProtocolClient = app.setAsDefaultProtocolClient(protocol);
|
||||
}
|
||||
if (isDefaultProtocolClient) {
|
||||
log.info("Protocol handler registered successfully.");
|
||||
} else {
|
||||
@@ -486,6 +501,6 @@ function openMainWindow(): void {
|
||||
|
||||
function openInExplorer(url: string): void {
|
||||
const folderPath: string = decodeURIComponent(url.split(`${protocol}://`)[1]);
|
||||
log.info("Opening folder in explorer", path.dirname(folderPath));
|
||||
shell.openPath(path.dirname(folderPath));
|
||||
log.info("Opening folder in explorer", folderPath);
|
||||
shell.openPath(folderPath);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
QUERY_ACTIVE_BODYSHOP_TYPED,
|
||||
QUERY_MASTERDATA_TYPED,
|
||||
} from "../graphql/queries";
|
||||
import Store from "../store/store";
|
||||
import { default as Store, default as store } from "../store/store";
|
||||
import { checkForAppUpdatesContinuously } from "../util/checkForAppUpdates";
|
||||
import { sendIpcToRenderer } from "../util/toRenderer";
|
||||
|
||||
@@ -66,9 +66,9 @@ const ipcMainHandleAuthStateChanged = async (
|
||||
|
||||
const ipMainHandleResetPassword = async (): Promise<void> => {
|
||||
shell.openExternal(
|
||||
import.meta.env.VITE_COMPANY === "IMEX"
|
||||
? "https://imex.online/resetpassword"
|
||||
: "https://romeonline.io/resetpassword",
|
||||
store.get("app.isTest")
|
||||
? `${import.meta.env.VITE_FE_URL_TEST}/resetpassword`
|
||||
: `${import.meta.env.VITE_FE_URL}/resetpassword`,
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user