Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added
- Yiddish and Tamil translations
- advanced option to show custom message in Preferences
- advanced option to disable app update features

### Changed
- remove flags in Welcome window
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,14 @@ Note that this will disable graphical way of opening Stretchly Preferences. To a
If you want to show tray menu even while in Strict mode, set `showTrayMenuInStrictMode` to `true`.

#### Show custom message in Preferences
If you want to show custom message in Preferences, set `customPreferencesMessage` to string of your liking. This might be useful for corporate installations.
If you want to show custom message in Preferences, set `customPreferencesMessage` to string of your liking.

This might be useful for corporate installations.

#### Disable app update functionality
If you want to disable functionality around app updates, set `disableAppUpdateFeatures` to `true`. This will make Stretchly not to check for new versions and hide related elements from the app. This value takes preference over `checkNewVersion` and `notifyNewVersion`.

This might be useful for corporate installations.

## Contributor Preferences

Expand Down
15 changes: 11 additions & 4 deletions app/break-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,17 @@ window.onload = async (event) => {
}
if (Date.now() - started < duration) {
const passedPercent = (Date.now() - started) / duration * 100
postponeElement.style.display =
await window.utils.canPostpone(postpone, passedPercent, postponePercent) ? 'flex' : 'none'
closeElement.style.display =
await window.utils.canSkip(strictMode, postpone, passedPercent, postponePercent) ? 'flex' : 'none'
if (await window.utils.canPostpone(postpone, passedPercent, postponePercent)) {
postponeElement.classList.remove('hidden')
} else {
postponeElement.classList.add('hidden')
}

if (await window.utils.canSkip(strictMode, postpone, passedPercent, postponePercent)) {
closeElement.classList.remove('hidden')
} else {
closeElement.classList.add('hidden')
}
progress.value = (100 - passedPercent) * progress.max / 100
progressTime.innerHTML = await window.utils.formatTimeRemaining(Math.trunc(duration - Date.now() + started),
await window.settings.get('language'))
Expand Down
4 changes: 2 additions & 2 deletions app/break.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
<span id='progress-time' aria-hidden="true"></span>
</div>
<div>
<a id="postpone" class="tooltip top">
<a id="postpone" class="tooltip top hidden">
<span data-i18next="break.postpone"></span>
<img src="images/breaks/break-postpone.svg" />
<span class="tiptext"></span>
</a>
<a id="close" class="tooltip top">
<a id="close" class="tooltip top hidden">
<span data-i18next="break.skip"></span>
<img src="images/breaks/break-skip.svg" />
<span class="tiptext"></span>
Expand Down
4 changes: 0 additions & 4 deletions app/css/break.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@
line-height: 18px;
}

.breaks > :nth-child(2) > a {
display: none;
}

.breaks > :nth-child(2) > a:hover {
color: #FFFF00;
}
Expand Down
4 changes: 4 additions & 0 deletions app/css/commons.css
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ body {
display: none;
}

.hidden {
display: none !important;
}

a {
cursor: pointer;
}
Expand Down
9 changes: 0 additions & 9 deletions app/css/preferences.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ body > div > :last-child {
z-index: 9;
}

body > .hidden,
.heart > .hidden {
display: none;
}

.settings {
display: grid;
font-size: 13px;
Expand Down Expand Up @@ -367,10 +362,6 @@ body[dir=rtl] .about > :nth-child(4) > div {
margin: auto 20px;
}

.about > .debug > :first-child {
display: none;
}

.heart {
display: grid;
font-size: 18px;
Expand Down
4 changes: 3 additions & 1 deletion app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ function createSyncPreferencesWindow () {
}

function planVersionCheck (seconds = 1) {
if (settings.get('disableAppUpdateFeatures')) return
if (updateChecker) {
clearInterval(updateChecker)
updateChecker = null
Expand All @@ -550,6 +551,7 @@ function planVersionCheck (seconds = 1) {
}

function checkVersion () {
if (settings.get('disableAppUpdateFeatures')) return
if (settings.get('checkNewVersion')) {
processWin.webContents.send('check-version',
`v${app.getVersion()}`,
Expand Down Expand Up @@ -1126,7 +1128,7 @@ function updateTray () {
function getTrayMenuTemplate () {
const trayMenu = []

if (global.isNewVersion) {
if (!settings.get('disableAppUpdateFeatures') && global.isNewVersion) {
trayMenu.push({
label: i18next.t('main.downloadLatestVersion'),
click: function () {
Expand Down
15 changes: 11 additions & 4 deletions app/microbreak-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,17 @@ window.onload = async (event) => {
}
if (Date.now() - started < duration) {
const passedPercent = (Date.now() - started) / duration * 100
postponeElement.style.display =
await window.utils.canPostpone(postpone, passedPercent, postponePercent) ? 'flex' : 'none'
closeElement.style.display =
await window.utils.canSkip(strictMode, postpone, passedPercent, postponePercent) ? 'flex' : 'none'
if (await window.utils.canPostpone(postpone, passedPercent, postponePercent)) {
postponeElement.classList.remove('hidden')
} else {
postponeElement.classList.add('hidden')
}

if (await window.utils.canSkip(strictMode, postpone, passedPercent, postponePercent)) {
closeElement.classList.remove('hidden')
} else {
closeElement.classList.add('hidden')
}
progress.value = (100 - passedPercent) * progress.max / 100
progressTime.innerHTML = await window.utils.formatTimeRemaining(Math.trunc(duration - Date.now() + started),
await window.settings.get('language'))
Expand Down
4 changes: 2 additions & 2 deletions app/microbreak.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
<span id='progress-time' aria-hidden="true"></span>
</div>
<div>
<a id="postpone" class="tooltip top">
<a id="postpone" class="tooltip top hidden">
<span data-i18next="break.postpone"></span>
<img src="images/breaks/break-postpone.svg" />
<span class="tiptext"></span>
</a>
<a id="close" class="tooltip top">
<a id="close" class="tooltip top hidden">
<span data-i18next="break.skip"></span>
<img src="images/breaks/break-skip.svg" />
<span class="tiptext"></span>
Expand Down
31 changes: 16 additions & 15 deletions app/preferences-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ let eventsAttached = false
window.onload = async (e) => {
const bounds = await window.stretchly.getWindowBounds()
const settings = await window.settings.currentSettings()
if (settings.disableAppUpdateFeatures) {
document.querySelector('#checkNewVersion').closest('div').classList.add('hidden')
}

new HtmlTranslate(document).translate()
setWindowHeight()
Expand Down Expand Up @@ -59,10 +62,10 @@ window.onload = async (e) => {
postponesnumber, settingsfile, logsfile, doNotDisturb
] = await window.stretchly.showDebug()
const debugInfo = document.querySelector('.debug > :first-child')
if (debugInfo.style.display === 'block') {
debugInfo.style.display = 'none'
if (!debugInfo.classList.contains('hidden')) {
debugInfo.classList.add('hidden')
} else {
debugInfo.style.display = 'block'
debugInfo.classList.remove('hidden')
document.querySelector('#reference').innerHTML = reference
document.querySelector('#timeleft').innerHTML = timeleft
document.querySelector('#breakNumber').innerHTML = breaknumber
Expand Down Expand Up @@ -227,10 +230,6 @@ window.onload = async (e) => {
}
})

if (!settings.checkNewVersion) {
document.querySelector('#notifyNewVersion').closest('div').style.display = 'none'
}

setWindowHeight()

document.querySelectorAll('.enabletype').forEach((element) => {
Expand Down Expand Up @@ -281,14 +280,16 @@ window.onload = async (e) => {
})

document.querySelector('.version').innerHTML = await window.stretchly.getVersion()
versionChecker.latest()
.then(version => {
document.querySelector('.latestVersion').innerHTML = version.replace('v', '')
})
.catch(exception => {
console.error(exception)
document.querySelector('.latestVersion').innerHTML = 'N/A'
})
if (!settings.disableAppUpdateFeatures) {
versionChecker.latest()
.then(version => {
document.querySelector('.latestVersion').innerHTML = version.replace('v', '')
})
.catch(exception => {
console.error(exception)
document.querySelector('.latestVersion').innerHTML = 'N/A'
})
}
Comment thread
hovancik marked this conversation as resolved.

function setWindowHeight () {
const classes = document.querySelector('body').classList
Expand Down
2 changes: 1 addition & 1 deletion app/preferences.html
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@
</div>
</div>
<div class="debug">
<div>
<div class="hidden">
<p id="to-copy">
breakPlanner: {reference: <span id="reference"></span>,
timeleft: <span id="timeleft"></span>,
Expand Down
3 changes: 2 additions & 1 deletion app/utils/defaultSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@ export default {
skipToNextLongBreakShortcut: '',
resetBreaksShortcut: '',
showTrayMenuInStrictMode: false,
customPreferencesMessage: ''
customPreferencesMessage: '',
disableAppUpdateFeatures: false
}
Loading