Skip to content

Commit

Permalink
Better break window loading
Browse files Browse the repository at this point in the history
  • Loading branch information
hovancik committed Feb 17, 2024
1 parent 00a8000 commit 108efe5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Schedule and Menu options not being updated after change of language
- multiple RTL UI issues
- RPM installer conflicts with other Electron apps
- improve break window loading to fix blank window

## [1.15.1] - 2023-11-19
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion app/break.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ 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 Expand Up @@ -61,5 +60,6 @@ window.onload = (event) => {
settings.get('language'))
}
}, 100)
ipcRenderer.send('long-break-loaded')

Check warning on line 63 in app/break.js

View check run for this annotation

Codecov / codecov/patch

app/break.js#L63

Added line #L63 was not covered by tests
})
}
18 changes: 12 additions & 6 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,11 @@ function startMicrobreak () {
})
// microbreakWinLocal.webContents.openDevTools()
microbreakWinLocal.once('ready-to-show', () => {
log.info('Stretchly: ready-to-show fired')

Check warning on line 787 in app/main.js

View check run for this annotation

Codecov / codecov/patch

app/main.js#L787

Added line #L787 was not covered by tests
})

ipcMain.once('mini-break-loaded', () => {
log.info('Stretchly: Mini Break window loaded')

Check warning on line 791 in app/main.js

View check run for this annotation

Codecov / codecov/patch

app/main.js#L790-L791

Added lines #L790 - L791 were not covered by tests
if (showBreaksAsRegularWindows) {
microbreakWinLocal.show()
} else {
Expand All @@ -807,6 +812,7 @@ function startMicrobreak () {
microbreakWinLocal.center()
}, 0)
}
updateTray()

Check warning on line 815 in app/main.js

View check run for this annotation

Codecov / codecov/patch

app/main.js#L815

Added line #L815 was not covered by tests
})

require('@electron/remote/main').enable(microbreakWinLocal.webContents)
Expand Down Expand Up @@ -839,9 +845,6 @@ function startMicrobreak () {
app.dock.hide()
}
}
ipcMain.on('mini-break-loaded', (event) => {
updateTray()
})
}

function startBreak () {
Expand Down Expand Up @@ -926,6 +929,11 @@ function startBreak () {
})
// breakWinLocal.webContents.openDevTools()
breakWinLocal.once('ready-to-show', () => {
log.info('Stretchly: ready-to-show fired')

Check warning on line 932 in app/main.js

View check run for this annotation

Codecov / codecov/patch

app/main.js#L932

Added line #L932 was not covered by tests
})

ipcMain.once('long-break-loaded', () => {
log.info('Stretchly: Long Break window loaded')

Check warning on line 936 in app/main.js

View check run for this annotation

Codecov / codecov/patch

app/main.js#L935-L936

Added lines #L935 - L936 were not covered by tests
if (showBreaksAsRegularWindows) {
breakWinLocal.show()
} else {
Expand All @@ -950,6 +958,7 @@ function startBreak () {
breakWinLocal.center()
}, 0)
}
updateTray()

Check warning on line 961 in app/main.js

View check run for this annotation

Codecov / codecov/patch

app/main.js#L961

Added line #L961 was not covered by tests
})

require('@electron/remote/main').enable(breakWinLocal.webContents)
Expand Down Expand Up @@ -982,9 +991,6 @@ function startBreak () {
app.dock.hide()
}
}
ipcMain.on('long-break-loaded', (event) => {
updateTray()
})
}

function breakComplete (shouldPlaySound, windows, breakType) {
Expand Down
2 changes: 1 addition & 1 deletion app/microbreak.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ 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 Expand Up @@ -58,5 +57,6 @@ window.onload = (e) => {
settings.get('language'))
}
}, 100)
ipcRenderer.send('mini-break-loaded')

Check warning on line 60 in app/microbreak.js

View check run for this annotation

Codecov / codecov/patch

app/microbreak.js#L60

Added line #L60 was not covered by tests
})
}

0 comments on commit 108efe5

Please sign in to comment.