Skip to content

Commit

Permalink
few adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
geraldoramos committed Jun 9, 2019
1 parent 14930cc commit 3e0d0aa
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
16 changes: 12 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,13 @@ function createWindow() {
} else {
tray = new Tray(path.join(__dirname, 'src', 'assets', 'img', 'white.png'))
}
tray.setToolTip('Nikola')
}

if (process.platform === 'win32') {
if (process.platform !== 'darwin') {
tray = new Tray(path.join(__dirname, 'src', 'assets', 'img', 'win_tray.png'))
}


tray.setToolTip('Nikola')


// Don't show the app in the dock
if (process.platform === 'darwin') {
Expand Down Expand Up @@ -155,6 +154,11 @@ function createWindow() {
}

// Actions
// require some sleep to prevent state update delay
const sleep = (ms = 0) => {
return new Promise(r => setTimeout(r, ms));
}

ipcMain.on('login-attempt', async (event, loginEmailPw) => {
startLogin(false, loginEmailPw)
})
Expand All @@ -174,6 +178,7 @@ function createWindow() {
await tesla.lockDoor(store.get('authToken'), store.get('vehicleId'))
}
await getTeslaData()
sleep(500)
mainWindow.webContents.send('action-loading', null)
} catch (error) {
log.error(error)
Expand All @@ -193,6 +198,7 @@ function createWindow() {
await tesla.climateStop(store.get('authToken'), store.get('vehicleId'))
}
await getTeslaData()
sleep(500)
mainWindow.webContents.send('action-loading', null)
} catch (error) {
log.error(error)
Expand All @@ -212,6 +218,7 @@ function createWindow() {
await tesla.setSentryMode(store.get('authToken'), store.get('vehicleId'), false)
}
await getTeslaData()
sleep(500)
mainWindow.webContents.send('action-loading', null)
} catch (error) {
log.error(error)
Expand All @@ -226,6 +233,7 @@ function createWindow() {
log.info('Changing temperature')
await tesla.setTemps(store.get('authToken'), store.get('vehicleId'), temp)
await getTeslaData()
sleep(500)
mainWindow.webContents.send('action-loading', null)
} catch (error) {
log.error(error)
Expand Down
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Nikola",
"version": "0.2.5",
"description": "Open source and unoffocial cross-platform desktop app to control tesla vehicles",
"author": "Geraldo Ramos",
"author": "Geraldo Ramos <[email protected]> (https://geraldoramos.com)",
"homepage": "https://github.com/geraldoramos/nikola",
"repository": {
"type": "git",
Expand Down Expand Up @@ -40,6 +40,12 @@
"publish": [
"github"
]
},
"linux": {
"target": ["AppImage", "deb", "zip"],
"publish": [
"github"
]
}
},
"license": "MIT",
Expand All @@ -48,8 +54,8 @@
"prod": "webpack --config webpack.build.config.js && electron --noDevServer .",
"dev": "webpack-dev-server --hot --host 0.0.0.0 --config=./webpack.dev.config.js",
"build-ui": "webpack --config webpack.build.config.js",
"build": "yarn build-ui && build -w -m",
"publish": "yarn build-ui && build -m -w -p always"
"build": "yarn build-ui && build -w -m -l",
"publish": "build -m -w -l -p always"
},
"devDependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.18",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Home extends React.Component {
componentDidMount() {

ipcRenderer.once('platform', function (event, platform) {
if(platform==='win32'){
if(platform!=='darwin'){
document.querySelector('.header-arrow').style = 'display: none'
document.querySelector('.toolbar').style = '-webkit-app-region: drag;min-height: 10px'
}
Expand Down

0 comments on commit 3e0d0aa

Please sign in to comment.