Skip to content

Commit

Permalink
Merge pull request #8 from tehaksbrid/dev
Browse files Browse the repository at this point in the history
1.1.0 Release codebase
  • Loading branch information
tehaksbrid authored Apr 5, 2021
2 parents fce7695 + b140789 commit 99a41b5
Show file tree
Hide file tree
Showing 11 changed files with 2,869 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
backup
data
app-config.json
.DS_STORE
.idea
node_modules
dist
12 changes: 12 additions & 0 deletions build/entitlements.mac.inherit.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
</dict>
</plist>
Binary file added build/icon.icns
Binary file not shown.
File renamed without changes.
30 changes: 30 additions & 0 deletions build/notarize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const path = require('path');
const electron_notarize = require('electron-notarize');

module.exports = async function (params) {
// Only notarize the app on Mac OS only.
if (process.platform !== 'darwin') {
return;
}
console.log('Notarization requested:', params);

// Same appId in electron-builder.
let appId = 'ShopDatabaser'

let appPath = path.join(params.appOutDir, `${params.packager.appInfo.productFilename}.app`);

console.log(`Notarizing ${appId} found at ${appPath}`);

try {
await electron_notarize.notarize({
appBundleId: appId,
appPath: appPath,
appleId: process.env.appleid,
appleIdPassword: '@keychain:SD_PASSWORD',
});
} catch (error) {
console.error(error);
}

console.log(`Done notarizing ${appId}`);
};
20 changes: 15 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ const path = require('path');
const {Menu, Tray, app, BrowserWindow, ipcMain, shell, dialog} = require('electron');
const electron_is_dev = require('electron-is-dev');
const controller = new AppController();

const singleInstanceLock = app.requestSingleInstanceLock();
if (!singleInstanceLock) return app.quit();
/**
* Setup and open windows
*/
Expand All @@ -69,7 +70,7 @@ app.whenReady().then(() => {
width: 800,
height: 600,
frame: false,
icon: path.join(__dirname, './icon.png'),
icon: path.join(__dirname, './view/assets/icons/icon.png'),
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true
Expand All @@ -95,7 +96,7 @@ app.whenReady().then(() => {
return false;
});

tray = new Tray(path.join(__dirname, './icon.png'));
tray = new Tray(path.join(__dirname, process.platform === "darwin" ? './view/assets/icons/[email protected]' : './view/assets/icons/icon.png'));
let contextMenu = Menu.buildFromTemplate([
{
label: 'Close application', click: () => {
Expand Down Expand Up @@ -127,10 +128,19 @@ app.whenReady().then(() => {
});

app.on('window-all-closed', () => {
if (process.platform !== 'darwin' || trueQuit === true) {
if (trueQuit === true) {
app.quit()
}
})
});

app.on('second-instance', () => {
view.show();
view.focus();
});

app.on('activate', (ev, hasWindow) => {
if (!hasWindow) view.show();
});

/**
* IPCs
Expand Down
Loading

0 comments on commit 99a41b5

Please sign in to comment.