Skip to content

Commit

Permalink
Merge pull request #29 from hovancik/release/0.3.0
Browse files Browse the repository at this point in the history
Release version 0.3.0
  • Loading branch information
hovancik authored Oct 16, 2016
2 parents 01e12d4 + 6c64a60 commit 243e0d1
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 34 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
-

## [0.3.0] - 2016-10-15
### Added
- possibility to pause reminders for different times
- autostart for Windows and macOS
- check for latest version on About page
- check for the latest version on About page, on app start
- remind new version via notification and tray menu

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

[Unreleased]: https://github.com/hovancik/stretchly/compare/v0.2.0...HEAD
[Unreleased]: https://github.com/hovancik/stretchly/compare/v0.3.0...HEAD
[0.3.0]: https://github.com/hovancik/stretchly/compare/v0.2.1...v0.3.0
[0.2.1]: https://github.com/hovancik/stretchly/compare/v0.2.0...v0.2.1
[0.2.0]: https://github.com/hovancik/stretchly/compare/v0.1.1...v0.2.0
[0.1.1]: https://github.com/hovancik/stretchly/compare/v0.1.0...v0.1.1
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

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

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

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

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

Expand Down
1 change: 0 additions & 1 deletion app/about.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<title>About stretchly v0.2.1</title>
<link rel="stylesheet" type="text/css" href="css/app.css">
</head>
<body>
Expand Down
74 changes: 52 additions & 22 deletions app/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// process.on('uncaughtException', (...args) => console.error(...args))
const {app, BrowserWindow, Tray, Menu, ipcMain} = require('electron')
const {app, BrowserWindow, Tray, Menu, ipcMain, shell} = require('electron')
const path = require('path')
const AppSettings = require('./utils/settings')
let microbreakIdeas = require('./microbreakIdeas')
Expand All @@ -15,6 +15,11 @@ let startMicrobreakTimer
let planMicrobreakTimer
let resumeMicrobreaksTimer
let settings
let isPaused = false

global.shared = {
isNewVersion: false
}

function createTrayIcon () {
if (process.platform === 'darwin') {
Expand All @@ -23,7 +28,8 @@ function createTrayIcon () {
const iconPath = path.join(__dirname, 'images/stretchly_18x18.png')
appIcon = new Tray(iconPath)
appIcon.setToolTip('stretchly - break time reminder app')
appIcon.setContextMenu(getTrayMenu(false))
isPaused = false
appIcon.setContextMenu(getTrayMenu())
}

function startProcessWin () {
Expand All @@ -32,6 +38,18 @@ function startProcessWin () {
show: false
})
processWin.loadURL(modalPath)
processWin.webContents.on('did-finish-load', () => {
planVersionCheck()
})
}

function planVersionCheck (seconds = 1) {
setTimeout(checkVersion, seconds * 1000)
}

function checkVersion () {
processWin.webContents.send('checkVersion', `v${app.getVersion()}`)
planVersionCheck(3600 * 5)
}

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

ipcMain.on('update-tray', function (event) {
appIcon.setContextMenu(getTrayMenu())
})

let shouldQuit = app.makeSingleInstance(function (commandLine, workingDirectory) {
if (appIcon) {
// Someone tried to run a second instance
Expand Down Expand Up @@ -127,12 +149,14 @@ function pauseMicrobreaks (seconds) {
if (seconds !== 1) {
resumeMicrobreaksTimer = setTimeout(resumeMicrobreaks, seconds)
}
appIcon.setContextMenu(getTrayMenu(true))
isPaused = true
appIcon.setContextMenu(getTrayMenu())
}

function resumeMicrobreaks () {
clearTimeout(resumeMicrobreaksTimer)
appIcon.setContextMenu(getTrayMenu(false))
isPaused = false
appIcon.setContextMenu(getTrayMenu())
planMicrobreak()
}

Expand All @@ -141,7 +165,7 @@ function showAboutWindow () {
aboutWin = new BrowserWindow({
alwaysOnTop: true,
backgroundColor: settings.get('mainColor'),
title: 'About stretchly'
title: `About stretchly v${app.getVersion()}`
})
aboutWin.loadURL(modalPath)
}
Expand All @@ -159,9 +183,30 @@ function showSettingsWindow () {
})
}

function getTrayMenu (MicrobreaksPaused) {
function getTrayMenu () {
let trayMenu = []
if (global.shared.isNewVersion) {
trayMenu.push({
label: 'Download latest version',
click: function () {
shell.openExternal('https://github.com/hovancik/stretchly/releases')
}
})
}

trayMenu.push({
label: 'About',
click: function () {
showAboutWindow()
}
}, {
type: 'separator'
}, {
label: 'Settings',
click: function () {
showSettingsWindow()
}
})
if (process.platform === 'darwin' || process.platform === 'win32') {
let loginItemSettings = app.getLoginItemSettings()
let openAtLogin = loginItemSettings.openAtLogin
Expand All @@ -175,11 +220,7 @@ function getTrayMenu (MicrobreaksPaused) {
})
}

trayMenu.push({
type: 'separator'
})

if (MicrobreaksPaused) {
if (isPaused) {
trayMenu.push({
label: 'Resume',
click: function () {
Expand Down Expand Up @@ -214,19 +255,8 @@ function getTrayMenu (MicrobreaksPaused) {
]
})
}

trayMenu.push({
type: 'separator'
}, {
label: 'About',
click: function () {
showAboutWindow()
}
}, {
label: 'Settings',
click: function () {
showSettingsWindow()
}
}, {
label: 'Quit',
click: function () {
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stretchly",
"version": "0.2.1",
"version": "0.3.0",
"description": "break time reminder app",
"main": "main.js",
"repository": {
Expand Down
24 changes: 23 additions & 1 deletion app/process.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
const {ipcRenderer} = require('electron')
const {ipcRenderer, shell, remote} = require('electron')
let VersionChecker = require('./utils/versionChecker')

ipcRenderer.on('playSound', (event, data) => {
let audio = new Audio(`audio/${data}.wav`)
audio.play()
})

ipcRenderer.on('checkVersion', (event, data) => {
if (remote.getGlobal('shared').isNewVersion) {
notifyNewVersion()
} else {
new VersionChecker().latest(function (version) {
if (data !== version) {
remote.getGlobal('shared').isNewVersion = true
ipcRenderer.send('update-tray')
notifyNewVersion()
}
})
}
})

function notifyNewVersion () {
let notification = new Notification('stretchly', {
body: 'New version is available!'
})
notification.onclick = () => shell.openExternal('https://github.com/hovancik/stretchly/releases')
}
File renamed without changes.
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stretchly",
"version": "0.2.1",
"version": "0.3.0",
"description": "break time reminder app",
"engines": {
"node": "6.5.0"
Expand Down Expand Up @@ -34,9 +34,9 @@
"devDependencies": {
"chai": "^3.5.0",
"chai-as-promised": "^6.0.0",
"electron": "^1.4.1",
"electron-builder": "^7.10.2",
"mocha": "^3.0.2",
"electron": "^1.4.3",
"electron-builder": "^7.12.2",
"mocha": "^3.1.2",
"spectron": "^3.4.0"
},
"build": {
Expand Down Expand Up @@ -88,7 +88,8 @@
"beforeEach",
"afterEach",
"Audio",
"fetch"
"fetch",
"Notification"
]
}
}
Binary file modified stretchly-tray.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 243e0d1

Please sign in to comment.