Skip to content

Commit 50715de

Browse files
committed
fix time adjustment quit and custom dialog in dark
1 parent 5fcf0da commit 50715de

File tree

3 files changed

+39
-8
lines changed

3 files changed

+39
-8
lines changed

main.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,11 @@ function alarmSet() {
176176
function relaunchSolution() {
177177
fullScreenProtection = false;
178178
if (win != null) {
179-
win.setKiosk(false);
179+
if (!isLoose) {
180+
win.setKiosk(false);
181+
} else {
182+
setFullScreenMode(false);
183+
}
180184
win.hide();
181185
}
182186

@@ -2384,6 +2388,10 @@ ipcMain.on('floating-destroy', function (event, message) {
23842388
floatingDestroyer(message ? message : "");
23852389
});
23862390

2391+
ipcMain.on('exit-fullscreen', function (event, message) {
2392+
setFullScreenMode(false);
2393+
});
2394+
23872395
ipcMain.on('only-one-min-left', function () {
23882396
if (!fullScreenProtection)
23892397
notificationSolution(i18n.__('only-one-min-left'), i18n.__('only-one-min-left-msg'), "non-important")

supporter.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ function isInDark() {
8989
'#dialog-msg {color: #ccc;}' +
9090
'.dropdown-default {color: #aaa;}' +
9191
'.dropdown-toggle::before {color: #aaa;}' +
92+
'#fullscreen-custom-dialog {background-color: #191919;}' +
9293
'</style>'
9394
);
9495
} else {

timer.html

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ <h3>
459459

460460
function backer() {
461461
call('floating-destroy');
462+
call('exit-fullscreen');
462463
store.set("just-back", true);
463464
timingData.set("last-recorded-minutes-left", -1);
464465
timingData.set("last-recorded-hours-left", -1);
@@ -594,9 +595,12 @@ <h3>
594595
$("#mistake-button").addClass("disabled").css("pointer-events", "none").css("opacity", "0.5");
595596
}
596597

597-
// Set initial state for time adjustment dropdown based on preferences
598+
// Set initial state for time adjustment dropdown based on preferences and focused mode
598599
const disableTimeAdjustValue = store.get('disable-time-adjust');
599-
if (isFeatureDisabled(disableTimeAdjustValue, methodFromStart)) {
600+
const isFocusedMode = (methodFromStart === 1 && workTimeFocused) || (methodFromStart === 2 && restTimeFocused);
601+
const isLooseMode = methodFromStart === 3;
602+
603+
if (isFeatureDisabled(disableTimeAdjustValue, methodFromStart) || (isFocusedMode && !isLooseMode)) {
600604
$("#time-adjust-dropdown").hide();
601605
}
602606

@@ -920,7 +924,10 @@ <h3>
920924
}
921925

922926
// Handle time adjustment dropdown visibility for rest mode
923-
if (isFeatureDisabled(store.get('disable-time-adjust'), 2)) {
927+
const isRestFocusedMode = restTimeFocused;
928+
const isLooseMode = methodFromStart === 3;
929+
930+
if (isFeatureDisabled(store.get('disable-time-adjust'), 2) || (isRestFocusedMode && !isLooseMode)) {
924931
$("#time-adjust-dropdown").hide();
925932
} else {
926933
$("#time-adjust-dropdown").show();
@@ -988,7 +995,10 @@ <h3>
988995
}
989996

990997
// Handle time adjustment dropdown visibility for work mode
991-
if (isFeatureDisabled(store.get('disable-time-adjust'), 1)) {
998+
const isWorkFocusedMode = workTimeFocused;
999+
const isLooseMode = methodFromStart === 3;
1000+
1001+
if (isFeatureDisabled(store.get('disable-time-adjust'), 1) || (isWorkFocusedMode && !isLooseMode)) {
9921002
$("#time-adjust-dropdown").hide();
9931003
} else {
9941004
$("#time-adjust-dropdown").show();
@@ -1075,13 +1085,25 @@ <h3>
10751085
// adjust time according to mode
10761086
if (method === 1) {
10771087
// working mode: adjust work time
1078-
1079-
workTime = Math.max(10000, workTime + ms);
1088+
workTime = workTime + ms;
10801089
} else {
10811090
// rest mode: adjust rest time
1082-
restTime = Math.max(10000, restTime + ms);
1091+
restTime = restTime + ms;
10831092
}
10841093
lastRecordedProgress = -1;
1094+
1095+
// Check if timer should end immediately after adjustment
1096+
if (workTime <= 0 || restTime <= 0) {
1097+
// End the timer immediately
1098+
ender();
1099+
} else {
1100+
// Ensure minimum time is 10 seconds if not ending
1101+
if (method === 1) {
1102+
workTime = Math.max(10000, workTime);
1103+
} else {
1104+
restTime = Math.max(10000, restTime);
1105+
}
1106+
}
10851107
}
10861108

10871109
function shouldLongBreak() {

0 commit comments

Comments
 (0)