Skip to content

Commit

Permalink
fix(mac): error when running on mac os
Browse files Browse the repository at this point in the history
try to fix error when running on mac os.
  • Loading branch information
roldanjr committed May 26, 2020
1 parent 201c6e7 commit b953234
Show file tree
Hide file tree
Showing 11 changed files with 14,776 additions and 22 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/app/yarn.lock*

/node_modules
/.pnp
.pnp.js
Expand Down
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ env:
# Making the build process parallel: one on mac and one on linux
jobs:
include:
- if: tag IS present
os: osx
- os: osx
osx_image: xcode11.1
before_install:
- cd app
Expand All @@ -29,8 +28,7 @@ jobs:
before_cache:
- rm -rf $HOME/.cache/electron-builder/wine

- if: tag IS present
os: linux
- os: linux
dist: xenial
before_install:
- sudo apt-get install rpm
Expand Down
2 changes: 0 additions & 2 deletions app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

yarn.lock*

# Runtime data
pids
*.pid
Expand Down
9 changes: 2 additions & 7 deletions app/electron/electron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@ import {
activateAutoUpdate,
} from "./functions";

import { CHANNELS, UPDATES, ACTIONS } from "./helpers";
import { CHANNELS, UPDATES, ACTIONS, getIcon } from "./helpers";

import "v8-compile-cache";

const onProduction = app.isPackaged;

const appIconDark =
process.platform === "linux"
? path.join(__dirname, "../src/assets/logos/logo-dark.png")
: path.join(__dirname, "../src/assets/logos/logo-dark.ico");

const trayIcon = path.join(__dirname, "../src/assets/logos/tray.png");
const trayIconDark = path.join(__dirname, "../src/assets/logos/tray-dark.png");

Expand All @@ -34,7 +29,7 @@ function createMainWindow() {
maximizable: false,
show: false,
frame: false,
icon: appIconDark,
icon: getIcon(),
webPreferences: {
contextIsolation: true,
enableRemoteModule: false,
Expand Down
12 changes: 12 additions & 0 deletions app/electron/helpers/getIcon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import path from "path";

export function getIcon() {
switch (process.platform) {
case "darwin":
return path.join(__dirname, "../../src/assets/logos/[email protected]");
case "linux":
return path.join(__dirname, "../../src/assets/logos/logo-dark.png");
default:
return path.join(__dirname, "../../src/assets/logos/logo-dark.ico");
}
}
1 change: 1 addition & 0 deletions app/electron/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from "./isWindow";
export * from "./readHostsFile";
export * from "./writeHostsFile";
export * from "./findBlockerIndexes";
export * from "./getIcon";
5 changes: 2 additions & 3 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "app",
"version": "2.0.8-beta",
"version": "2.0.9-beta",
"private": true,
"main": "public/electron.js",
"license": "MIT",
Expand All @@ -13,7 +13,7 @@
"repository": "https://github.com/roldanjrCodeArts9711/productivity-timer",
"homepage": "./",
"scripts": {
"prepare": "yarn build:dir",
"postinstall": "yarn build:dir",
"clean": "rm -rf build/ dist/",
"develop": "react-scripts start",
"gen-tts": "node tts-generator.js",
Expand All @@ -25,7 +25,6 @@
"build:linux": "yarn build:app && electron-builder --linux",
"build:win": "yarn build:app && electron-builder --win",
"release": "yarn build:app && electron-builder --publish always",
"postinstall": "electron-builder install-app-deps",
"semantic-release": "semantic-release"
},
"babelMacros": {
Expand Down
5 changes: 1 addition & 4 deletions app/public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ var functions_1 = require("./functions");
var helpers_1 = require("./helpers");
require("v8-compile-cache");
var onProduction = electron_1.app.isPackaged;
var appIconDark = process.platform === "linux"
? path_1.default.join(__dirname, "../src/assets/logos/logo-dark.png")
: path_1.default.join(__dirname, "../src/assets/logos/logo-dark.ico");
var trayIcon = path_1.default.join(__dirname, "../src/assets/logos/tray.png");
var trayIconDark = path_1.default.join(__dirname, "../src/assets/logos/tray-dark.png");
var onlySingleIntance = electron_1.app.requestSingleInstanceLock();
Expand All @@ -24,7 +21,7 @@ function createMainWindow() {
maximizable: false,
show: false,
frame: false,
icon: appIconDark,
icon: helpers_1.getIcon(),
webPreferences: {
contextIsolation: true,
enableRemoteModule: false,
Expand Down
18 changes: 18 additions & 0 deletions app/public/helpers/getIcon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getIcon = void 0;
var path_1 = __importDefault(require("path"));
function getIcon() {
switch (process.platform) {
case "darwin":
return path_1.default.join(__dirname, "../../src/assets/logos/[email protected]");
case "linux":
return path_1.default.join(__dirname, "../../src/assets/logos/logo-dark.png");
default:
return path_1.default.join(__dirname, "../../src/assets/logos/logo-dark.ico");
}
}
exports.getIcon = getIcon;
1 change: 1 addition & 0 deletions app/public/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ __exportStar(require("./isWindow"), exports);
__exportStar(require("./readHostsFile"), exports);
__exportStar(require("./writeHostsFile"), exports);
__exportStar(require("./findBlockerIndexes"), exports);
__exportStar(require("./getIcon"), exports);
Loading

0 comments on commit b953234

Please sign in to comment.