Skip to content

Commit 243e0d1

Browse files
authored
Merge pull request #29 from hovancik/release/0.3.0
Release version 0.3.0
2 parents 01e12d4 + 6c64a60 commit 243e0d1

File tree

9 files changed

+91
-34
lines changed

9 files changed

+91
-34
lines changed

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
8+
-
9+
10+
## [0.3.0] - 2016-10-15
811
### Added
912
- possibility to pause reminders for different times
1013
- autostart for Windows and macOS
11-
- check for latest version on About page
14+
- check for the latest version on About page, on app start
15+
- remind new version via notification and tray menu
1216

1317
## [0.2.1] - 2016-10-10
1418
### Fixed
@@ -39,7 +43,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3943
- resume/pause functionality for reminder
4044
- scripts for creating installers for OS X, Windows, Linux
4145

42-
[Unreleased]: https://github.com/hovancik/stretchly/compare/v0.2.0...HEAD
46+
[Unreleased]: https://github.com/hovancik/stretchly/compare/v0.3.0...HEAD
47+
[0.3.0]: https://github.com/hovancik/stretchly/compare/v0.2.1...v0.3.0
4348
[0.2.1]: https://github.com/hovancik/stretchly/compare/v0.2.0...v0.2.1
4449
[0.2.0]: https://github.com/hovancik/stretchly/compare/v0.1.1...v0.2.0
4550
[0.1.1]: https://github.com/hovancik/stretchly/compare/v0.1.0...v0.1.1

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
<img src="https://raw.githubusercontent.com/hovancik/stretchly/master/stretchly-break.png" height="340">
1010

11-
It runs in your tray and shows reminder window every 10 minutes, that is open for 20 seconds, containg idea for microbreak.
11+
It runs in your tray and shows reminder window every 10 minutes, that is open for 20 seconds, containing idea for microbreak.
1212

13-
You can pause/resume reminding of breaks.
13+
You can pause/resume reminding of breaks. On Windows and macOS, you can set app to start at login.
1414

1515
<img src="https://raw.githubusercontent.com/hovancik/stretchly/master/stretchly-tray.png">
1616

app/about.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<title>About stretchly v0.2.1</title>
54
<link rel="stylesheet" type="text/css" href="css/app.css">
65
</head>
76
<body>

app/main.js

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// process.on('uncaughtException', (...args) => console.error(...args))
2-
const {app, BrowserWindow, Tray, Menu, ipcMain} = require('electron')
2+
const {app, BrowserWindow, Tray, Menu, ipcMain, shell} = require('electron')
33
const path = require('path')
44
const AppSettings = require('./utils/settings')
55
let microbreakIdeas = require('./microbreakIdeas')
@@ -15,6 +15,11 @@ let startMicrobreakTimer
1515
let planMicrobreakTimer
1616
let resumeMicrobreaksTimer
1717
let settings
18+
let isPaused = false
19+
20+
global.shared = {
21+
isNewVersion: false
22+
}
1823

1924
function createTrayIcon () {
2025
if (process.platform === 'darwin') {
@@ -23,7 +28,8 @@ function createTrayIcon () {
2328
const iconPath = path.join(__dirname, 'images/stretchly_18x18.png')
2429
appIcon = new Tray(iconPath)
2530
appIcon.setToolTip('stretchly - break time reminder app')
26-
appIcon.setContextMenu(getTrayMenu(false))
31+
isPaused = false
32+
appIcon.setContextMenu(getTrayMenu())
2733
}
2834

2935
function startProcessWin () {
@@ -32,6 +38,18 @@ function startProcessWin () {
3238
show: false
3339
})
3440
processWin.loadURL(modalPath)
41+
processWin.webContents.on('did-finish-load', () => {
42+
planVersionCheck()
43+
})
44+
}
45+
46+
function planVersionCheck (seconds = 1) {
47+
setTimeout(checkVersion, seconds * 1000)
48+
}
49+
50+
function checkVersion () {
51+
processWin.webContents.send('checkVersion', `v${app.getVersion()}`)
52+
planVersionCheck(3600 * 5)
3553
}
3654

3755
function showStartUpWindow () {
@@ -90,6 +108,10 @@ ipcMain.on('save-setting', function (event, key, value) {
90108
settingsWin.webContents.send('renderSettings', settings.data)
91109
})
92110

111+
ipcMain.on('update-tray', function (event) {
112+
appIcon.setContextMenu(getTrayMenu())
113+
})
114+
93115
let shouldQuit = app.makeSingleInstance(function (commandLine, workingDirectory) {
94116
if (appIcon) {
95117
// Someone tried to run a second instance
@@ -127,12 +149,14 @@ function pauseMicrobreaks (seconds) {
127149
if (seconds !== 1) {
128150
resumeMicrobreaksTimer = setTimeout(resumeMicrobreaks, seconds)
129151
}
130-
appIcon.setContextMenu(getTrayMenu(true))
152+
isPaused = true
153+
appIcon.setContextMenu(getTrayMenu())
131154
}
132155

133156
function resumeMicrobreaks () {
134157
clearTimeout(resumeMicrobreaksTimer)
135-
appIcon.setContextMenu(getTrayMenu(false))
158+
isPaused = false
159+
appIcon.setContextMenu(getTrayMenu())
136160
planMicrobreak()
137161
}
138162

@@ -141,7 +165,7 @@ function showAboutWindow () {
141165
aboutWin = new BrowserWindow({
142166
alwaysOnTop: true,
143167
backgroundColor: settings.get('mainColor'),
144-
title: 'About stretchly'
168+
title: `About stretchly v${app.getVersion()}`
145169
})
146170
aboutWin.loadURL(modalPath)
147171
}
@@ -159,9 +183,30 @@ function showSettingsWindow () {
159183
})
160184
}
161185

162-
function getTrayMenu (MicrobreaksPaused) {
186+
function getTrayMenu () {
163187
let trayMenu = []
188+
if (global.shared.isNewVersion) {
189+
trayMenu.push({
190+
label: 'Download latest version',
191+
click: function () {
192+
shell.openExternal('https://github.com/hovancik/stretchly/releases')
193+
}
194+
})
195+
}
164196

197+
trayMenu.push({
198+
label: 'About',
199+
click: function () {
200+
showAboutWindow()
201+
}
202+
}, {
203+
type: 'separator'
204+
}, {
205+
label: 'Settings',
206+
click: function () {
207+
showSettingsWindow()
208+
}
209+
})
165210
if (process.platform === 'darwin' || process.platform === 'win32') {
166211
let loginItemSettings = app.getLoginItemSettings()
167212
let openAtLogin = loginItemSettings.openAtLogin
@@ -175,11 +220,7 @@ function getTrayMenu (MicrobreaksPaused) {
175220
})
176221
}
177222

178-
trayMenu.push({
179-
type: 'separator'
180-
})
181-
182-
if (MicrobreaksPaused) {
223+
if (isPaused) {
183224
trayMenu.push({
184225
label: 'Resume',
185226
click: function () {
@@ -214,19 +255,8 @@ function getTrayMenu (MicrobreaksPaused) {
214255
]
215256
})
216257
}
217-
218258
trayMenu.push({
219259
type: 'separator'
220-
}, {
221-
label: 'About',
222-
click: function () {
223-
showAboutWindow()
224-
}
225-
}, {
226-
label: 'Settings',
227-
click: function () {
228-
showSettingsWindow()
229-
}
230260
}, {
231261
label: 'Quit',
232262
click: function () {

app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "stretchly",
3-
"version": "0.2.1",
3+
"version": "0.3.0",
44
"description": "break time reminder app",
55
"main": "main.js",
66
"repository": {

app/process.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
1-
const {ipcRenderer} = require('electron')
1+
const {ipcRenderer, shell, remote} = require('electron')
2+
let VersionChecker = require('./utils/versionChecker')
23

34
ipcRenderer.on('playSound', (event, data) => {
45
let audio = new Audio(`audio/${data}.wav`)
56
audio.play()
67
})
8+
9+
ipcRenderer.on('checkVersion', (event, data) => {
10+
if (remote.getGlobal('shared').isNewVersion) {
11+
notifyNewVersion()
12+
} else {
13+
new VersionChecker().latest(function (version) {
14+
if (data !== version) {
15+
remote.getGlobal('shared').isNewVersion = true
16+
ipcRenderer.send('update-tray')
17+
notifyNewVersion()
18+
}
19+
})
20+
}
21+
})
22+
23+
function notifyNewVersion () {
24+
let notification = new Notification('stretchly', {
25+
body: 'New version is available!'
26+
})
27+
notification.onclick = () => shell.openExternal('https://github.com/hovancik/stretchly/releases')
28+
}

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "stretchly",
3-
"version": "0.2.1",
3+
"version": "0.3.0",
44
"description": "break time reminder app",
55
"engines": {
66
"node": "6.5.0"
@@ -34,9 +34,9 @@
3434
"devDependencies": {
3535
"chai": "^3.5.0",
3636
"chai-as-promised": "^6.0.0",
37-
"electron": "^1.4.1",
38-
"electron-builder": "^7.10.2",
39-
"mocha": "^3.0.2",
37+
"electron": "^1.4.3",
38+
"electron-builder": "^7.12.2",
39+
"mocha": "^3.1.2",
4040
"spectron": "^3.4.0"
4141
},
4242
"build": {
@@ -88,7 +88,8 @@
8888
"beforeEach",
8989
"afterEach",
9090
"Audio",
91-
"fetch"
91+
"fetch",
92+
"Notification"
9293
]
9394
}
9495
}

stretchly-tray.png

5.35 KB
Loading

0 commit comments

Comments
 (0)