Skip to content

feat: hold-to-delete (3s) for sessions & logs; proximity wake lock on Android#137

Merged
gfauredev merged 2 commits intomainfrom
copilot/remove-delete-modal-require-hold
Apr 8, 2026
Merged

feat: hold-to-delete (3s) for sessions & logs; proximity wake lock on Android#137
gfauredev merged 2 commits intomainfrom
copilot/remove-delete-modal-require-hold

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

Replaces the session delete confirmation modal with a 3-second hold-to-delete pattern. Applies the same UX to active-session exercise log delete buttons. On Android, acquires PROXIMITY_SCREEN_OFF_WAKE_LOCK while a session is active over the lock screen, so pocketing the phone turns off the screen and disables touch without user interaction.

Hold-to-Delete

  • New HoldDeleteButton component (src/components/hold_delete.rs) wraps 🗑️ in a div.hold-del with an SVG stroke-dashoffset progress ring
  • onpointerdown spawns an async task: 30 × 100 ms ticks, updating a progress signal; onpointerup/onpointerleave bump a generation counter to cancel the task and show a toast hint
  • Race-safe via generation counter — rapid press/release cycles are handled correctly
  • SessionCard modal (backdrop + <dialog>) removed; CompletedExerciseLog immediate delete replaced
  • hold-to-delete-hint translation key added to en, fr, es
  • .hold-del CSS added to _component.scss (relative wrapper + rotating SVG ring)

Android Proximity Wake Lock

  • static PROXIMITY_WAKE_LOCK: Mutex<Option<GlobalRef>> added alongside the existing SCREEN_WAKE_LOCK
  • set_active_session_lock_screen(true) now also acquires PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK (0x20): Android automatically dims the screen and blocks touch when proximity fires, restores both when pocket is cleared
  • set_active_session_lock_screen(false) releases both the screen and proximity wake locks

Engineering Principles

  • PR only contains changes strictly related to the requested feature or fix,
    scope is focused (no unrelated dependency updates or formatting)
  • This code totally respects README's Engineering Principles

CI/CD Readiness

  • Branch follows Conventional Branch: feat/…, fix/…, refactor/…, …
  • Code is formatted with dx fmt; cargo fmt
  • All checks pass, nix flake checks succeeds without warnings
    • Code compiles, dx build with necessary platform flags succeeds
    • cargo clippy -- -D warnings -W clippy::all -W clippy::pedantic
      produces zero warnings
    • All unit tests pass without warnings
      cargo llvm-cov nextest --ignore-filename-regex '(src/components/|\.cargo/registry/|nix/store)'
    • End-to-end tests pass maestro test --headless maestro/web
      maestro test --headless maestro/android

Copilot AI and others added 2 commits April 8, 2026 17:22
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

📊 Coverage Report

Lines: 3754/5005 (75.004995004995%)

⏱️ Tests: 255 tests in 0.585s

FilenameFunction CoverageLine CoverageRegion CoverageBranch Coverage
main.rs
  22.00% (11/50)
  58.94% (155/263)
  60.56% (218/360)
- (0/0)
models/analytics.rs
   0.00% (0/6)
   0.00% (0/34)
   0.00% (0/46)
- (0/0)
models/enums.rs
 100.00% (28/28)
 100.00% (147/147)
 100.00% (337/337)
- (0/0)
models/exercise.rs
  92.00% (46/50)
  92.10% (548/595)
  91.01% (749/823)
- (0/0)
models/log.rs
 100.00% (12/12)
 100.00% (118/118)
 100.00% (144/144)
- (0/0)
models/mod.rs
 100.00% (11/11)
 100.00% (68/68)
 100.00% (98/98)
- (0/0)
models/session.rs
  72.22% (13/18)
  84.36% (151/179)
  83.33% (210/252)
- (0/0)
models/units.rs
 100.00% (28/28)
 100.00% (167/167)
  98.88% (353/357)
- (0/0)
services/app_state.rs
   1.89% (1/53)
   2.54% (11/433)
   2.32% (15/646)
- (0/0)
services/exercise_db.rs
  88.81% (127/143)
  90.30% (1210/1340)
  89.61% (1924/2147)
- (0/0)
services/exercise_loader.rs
   0.00% (0/14)
   0.00% (0/100)
   0.00% (0/135)
- (0/0)
services/native_queue.rs
   0.00% (0/15)
   0.00% (0/145)
   0.00% (0/197)
- (0/0)
services/notifications.rs
   0.00% (0/3)
   0.00% (0/9)
   0.00% (0/10)
- (0/0)
services/service_worker.rs
 100.00% (2/2)
 100.00% (6/6)
 100.00% (6/6)
- (0/0)
services/storage.rs
  63.77% (88/138)
  80.97% (766/946)
  83.53% (1187/1421)
- (0/0)
services/wake_lock.rs
 100.00% (2/2)
 100.00% (5/5)
 100.00% (5/5)
- (0/0)
utils.rs
  89.61% (69/77)
  89.33% (402/450)
  90.14% (640/710)
- (0/0)
Totals
  67.38% (438/650)
  75.00% (3754/5005)
  76.50% (5886/7694)
- (0/0)

@gfauredev gfauredev merged commit 14b41c3 into main Apr 8, 2026
8 checks passed
@gfauredev gfauredev deleted the copilot/remove-delete-modal-require-hold branch April 8, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants