Skip to content

Commit eb16fac

Browse files
authored
Merge pull request #110 from MrAlders0n/copilot/update-status-messages-guideline-again
Fix auto countdown not resuming after manual ping blocked during auto mode
2 parents c614352 + 8491055 commit eb16fac

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

content/wardrive.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,28 @@ function resumeAutoCountdown() {
392392
return false;
393393
}
394394

395+
/**
396+
* Handle manual ping blocked during auto mode by resuming the paused countdown
397+
* This ensures the UI returns to showing the auto countdown instead of staying stuck on the skip message
398+
*
399+
* When a manual ping is blocked during auto mode (GPS unavailable, outside geofence, or too close), this function:
400+
* 1. Attempts to resume the paused auto countdown timer with remaining time
401+
* 2. If no paused countdown exists, schedules a new auto ping
402+
* 3. Does nothing if auto mode is not running
403+
*
404+
* @returns {void}
405+
*/
406+
function handleManualPingBlockedDuringAutoMode() {
407+
if (state.running) {
408+
debugLog("Manual ping blocked during auto mode - resuming auto countdown");
409+
const resumed = resumeAutoCountdown();
410+
if (!resumed) {
411+
debugLog("No paused countdown to resume, scheduling new auto ping");
412+
scheduleNextAutoPing();
413+
}
414+
}
415+
}
416+
395417
function startRxListeningCountdown(delayMs) {
396418
debugLog(`Starting RX listening countdown: ${delayMs}ms`);
397419
state.rxListeningEndTime = Date.now() + delayMs;
@@ -1874,6 +1896,10 @@ async function sendPing(manual = false) {
18741896
if (!manual && state.running) {
18751897
scheduleNextAutoPing();
18761898
}
1899+
// For manual ping during auto mode, resume the paused countdown
1900+
if (manual) {
1901+
handleManualPingBlockedDuringAutoMode();
1902+
}
18771903
return;
18781904
}
18791905

@@ -1890,6 +1916,8 @@ async function sendPing(manual = false) {
18901916
if (manual) {
18911917
// Manual ping: show skip message that persists
18921918
setDynamicStatus("Ping skipped, outside of geofenced region", STATUS_COLORS.warning);
1919+
// If auto mode is running, resume the paused countdown
1920+
handleManualPingBlockedDuringAutoMode();
18931921
} else if (state.running) {
18941922
// Auto ping: schedule next ping and show countdown with skip message
18951923
scheduleNextAutoPing();
@@ -1910,6 +1938,8 @@ async function sendPing(manual = false) {
19101938
if (manual) {
19111939
// Manual ping: show skip message that persists
19121940
setDynamicStatus("Ping skipped, too close to last ping", STATUS_COLORS.warning);
1941+
// If auto mode is running, resume the paused countdown
1942+
handleManualPingBlockedDuringAutoMode();
19131943
} else if (state.running) {
19141944
// Auto ping: schedule next ping and show countdown with skip message
19151945
scheduleNextAutoPing();

docs/STATUS_MESSAGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,18 @@ These messages appear in the Dynamic App Status Bar. They NEVER include connecti
234234
- **Message**: `"Ping skipped, outside of geofenced region"`
235235
- **Color**: Amber (warning)
236236
- **When**: GPS coordinates outside Ottawa 150km radius
237+
- **Behavior**:
238+
- In manual mode (auto OFF): Message persists until next action
239+
- In manual mode (auto ON): Message shown briefly, then auto countdown resumes
237240
- **Source**: `content/wardrive.js:sendPing()`
238241

239242
##### Ping skipped, too close to last ping
240243
- **Message**: `"Ping skipped, too close to last ping"`
241244
- **Color**: Amber (warning)
242245
- **When**: Current location < 25m from last successful ping
246+
- **Behavior**:
247+
- In manual mode (auto OFF): Message persists until next action
248+
- In manual mode (auto ON): Message shown briefly, then auto countdown resumes
243249
- **Source**: `content/wardrive.js:sendPing()`
244250

245251
##### Wait Xs before sending another ping

0 commit comments

Comments
 (0)