Skip to content

Commit

Permalink
Fix break window "no text" issues (#1073)
Browse files Browse the repository at this point in the history
  • Loading branch information
hovancik authored Dec 23, 2021
1 parent 2ae7ec8 commit 9ed12ef
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- transparency not working in breaks
- command line arguments
- Turkish option in Welcome window
- no break texts and time in break window

### Changed
- updated many translations
Expand Down
4 changes: 4 additions & 0 deletions app/break.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const Utils = remote.require('./utils/utils')
const HtmlTranslate = require('./utils/htmlTranslate')
const Store = require('electron-store')
const settings = new Store()
const log = require('electron-log')
const path = require('path')
log.transports.file.resolvePath = () => path.join(remote.app.getPath('userData'), 'logs/main.log')

window.onload = (event) => {
ipcRenderer.send('send-break-data')
Expand All @@ -30,6 +33,7 @@ window.onload = (event) => {
})

ipcRenderer.once('progress', (event, started, duration, strictMode, postpone, postponePercent, backgroundColor) => {
ipcRenderer.send('long-break-loaded')
const progress = document.querySelector('#progress')
const progressTime = document.querySelector('#progress-time')
const postponeElement = document.querySelector('#postpone')
Expand Down
18 changes: 8 additions & 10 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,10 @@ function numberOfDisplays () {
function closeWindows (windowArray) {
for (const window of windowArray) {
window.hide()
if (windowArray[0] === window) {
ipcMain.removeAllListeners('send-break-data')
ipcMain.removeAllListeners('send-microbreak-data')
}
window.close()
}
return null
Expand Down Expand Up @@ -748,12 +752,9 @@ function startMicrobreak () {
if (process.platform === 'darwin') {
app.dock.hide()
}
setTimeout(() => {
ipcMain.on('mini-break-loaded', (event) => {
updateTray()
}, 500)
setTimeout(() => {
ipcMain.removeAllListeners('send-microbreak-data')
}, 2000)
})
}

function startBreak () {
Expand Down Expand Up @@ -894,12 +895,9 @@ function startBreak () {
if (process.platform === 'darwin') {
app.dock.hide()
}
setTimeout(() => {
ipcMain.on('long-break-loaded', (event) => {
updateTray()
}, 500)
setTimeout(() => {
ipcMain.removeAllListeners('send-break-data')
}, 2000)
})
}

function breakComplete (shouldPlaySound, windows) {
Expand Down
4 changes: 4 additions & 0 deletions app/microbreak.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const Utils = remote.require('./utils/utils')
const HtmlTranslate = require('./utils/htmlTranslate')
const Store = require('electron-store')
const settings = new Store()
const log = require('electron-log')
const path = require('path')
log.transports.file.resolvePath = () => path.join(remote.app.getPath('userData'), 'logs/main.log')

window.onload = (e) => {
ipcRenderer.send('send-microbreak-data')
Expand All @@ -28,6 +31,7 @@ window.onload = (e) => {
})

ipcRenderer.once('progress', (event, started, duration, strictMode, postpone, postponePercent, backgroundColor) => {
ipcRenderer.send('mini-break-loaded')
const progress = document.querySelector('#progress')
const progressTime = document.querySelector('#progress-time')
const postponeElement = document.querySelector('#postpone')
Expand Down

0 comments on commit 9ed12ef

Please sign in to comment.