Commit Graph

4 Commits

Author SHA1 Message Date
徐翔宇
3fb2c5c2a8 fix: pomodoro paused-in-break fraction + notif status wired to store
Two P0 issues from 2026-05-19 code review:

1. PomodoroView progress ring used pomodoroFocusMin*60 as denominator
   in paused state. If the user paused mid-break, ring rendered 80%
   done when the underlying break was actually 40% done. Now the
   store exposes pomodoroPhaseTotalSec which reads pausedPhase to
   pick the right denominator.

2. WorkerNotificationCenter set its own isAuthorized but never wrote
   WorkerStore.notificationsAuthorized — the top-bar notif status dot
   stayed dim even after the user authorized. Refactored into a single
   applyAuthorized helper that writes both.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 17:54:28 +08:00
徐翔宇
8022abca76 docs: add 2026-05-19 product + code review
- product-review.md: 5 个 tab 拆评,"摸鱼侠"名字 vs 功能 mismatch
  与 P0 上架前必修项(下班瞬间无事件 / 喝水无提醒 / 版本号硬编码)
- code-review.md: 13 文件审视,标出 PomodoroView paused-in-break
  fraction 算错、notifAuthorized 未 wire 致状态 dot 永 dim 等 P0 项;
  亮点是 wallclock-based pomodoro + input-idle sit accumulator

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 17:34:56 +08:00
徐翔宇
0cff83fc38 feat: v0.2.0 — sleep-aware timers + auto-loop pomodoro
Core change: both timers stop lying when the Mac sleeps or the user
walks away. Old code measured wallclock from a stored "start"
timestamp, so 4 hours of lid-closed showed up as 4 hours of "sitting"
and a 25-minute focus could quietly stretch across multiple hours
because Timer.scheduledTimer pauses during sleep.

What changed:

- Sit timer now reads CGEventSource HID idle to count only seconds
  with real input activity. New Sources/engine/SystemIdle.swift
  iterates the user-input event types and takes the min. Idle ≥ 5
  min resets the accumulator (counts as a real break). Tick-gap >
  30 s flags a sleep/wake and clears too — covers the case where
  the user unlocks and idle resets to ~0 instantly.

- Pomodoro switched from "decrement counter every second" to a
  wallclock end-time. Persisted to UserDefaults so quit/relaunch
  recovers correctly: still-running phases keep counting; phases
  whose end-time has already passed get caught up (one focus
  credited if missed) and the timer returns to idle.

- Auto-loop with classic 4-pack rhythm: focus → short break →
  focus → … on the 4th focus a long break (default 15 min) replaces
  the short break, then the cycle resets. Default ON; toggle pill
  in the settings row turns it off when the user wants manual
  restarts.

- New cycle-progress dot row (●●○○) next to the phase badge so
  the user can see where they are in the 4-pack at a glance.

- SitView tip text rewritten to reflect the new semantics: "只统计
  你真正在键盘前的时间。离开 5 分钟以上自动归零,午休/会议不会被
  算进去。"

User-facing wins:
- Closing the lid for lunch no longer fakes 90 minutes of sitting.
- A 25-min focus that survives a sleep cycle ends accurately.
- Start a focus once, the rhythm runs all morning.
2026-04-30 11:23:09 +08:00
徐翔宇
959580c55e v0.1.0: initial 摸鱼侠 — Worker Toolkit plugin for MioIsland
Office-survival toolkit. Five tabs in the notch:
- 🍅 番茄钟: 25/5 focus/break with circular ring timer + tally.
- 🪑 久坐: count-up since last break, dock-bounce alert at 45min.
- 💧 喝水: animated cup, daily goal tracking with progress dots.
- 🏃 下班: H:M:S countdown to clock-out hour with gradient bar.
- 🎉 周末: 天/时/分 to next Saturday + rotating 打工语录.

100% local. UNUserNotificationCenter for alerts, dock-bounce
fallback when authorization denied. UserDefaults persistence.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 20:21:12 +08:00