refactor(android): P2.1 Batch B - complete cancelAllNotifications() delegation
- Add ScheduleHelper.cancelAlarmsForSchedules() helper method - Add ScheduleHelper.cancelAllWorkManagerJobs() helper method - Refactor cancelAllNotifications() to delegate to helpers - Keep orchestration in plugin (appropriate for multi-service coordination) Reduces plugin method from ~85 lines to ~45 lines. Batch B complete: 15 methods refactored to thin adapter pattern. Refs: docs/progress/P2.1-BATCH-B-STATE.md
This commit is contained in:
@@ -319,9 +319,15 @@ For release notes, see [CHANGELOG.md](../../CHANGELOG.md).
|
||||
- Android rolling window now uses storage as source of truth
|
||||
- iOS TTL validation now enforced before scheduling
|
||||
- iOS SQLite persistence now functional (aligns runtime with tests)
|
||||
- **P2.1 Batch B completed**: All 15 validation + delegation methods refactored
|
||||
- `cancelAllNotifications()`: Delegated alarm cancellation and WorkManager cancellation to `ScheduleHelper`
|
||||
- Added `ScheduleHelper.cancelAlarmsForSchedules()` helper method
|
||||
- Added `ScheduleHelper.cancelAllWorkManagerJobs()` helper method
|
||||
- Plugin method now orchestrates multiple services (appropriate for coordination)
|
||||
|
||||
**Related Commits/PRs:**
|
||||
- P2.1 Batch A refactoring (in progress)
|
||||
- P2.1 Batch A refactoring (complete - 7 methods)
|
||||
- P2.1 Batch B refactoring (complete - 15 methods)
|
||||
- Deep fixes: rolling window counting, TTL validation, DB persistence
|
||||
|
||||
---
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
**Phase:** P2.1 - Native Plugin Refactoring (Batch B)
|
||||
**Goal:** Refactor methods that validate input then delegate to services
|
||||
**Status:** 14 of ~15 methods completed, 1 partially refactored
|
||||
**Status:** ✅ **BATCH B COMPLETE** — 15 methods refactored
|
||||
|
||||
---
|
||||
|
||||
@@ -181,12 +181,16 @@
|
||||
|
||||
### Utilities (Orchestration + Delegation)
|
||||
|
||||
9. **`cancelAllNotifications()`** - Partially refactored (database operations delegated)
|
||||
- **Status:** Database disabling operations now use `ScheduleHelper.disableAllSchedulesByKind()`
|
||||
- **Remaining:** Complex orchestration method (alarm cancellation, WorkManager cancellation, database)
|
||||
- **Note:** Alarm cancellation and WorkManager cancellation remain in plugin (orchestration concerns)
|
||||
- **Lines removed:** ~10 lines (database disabling logic moved to helper)
|
||||
- **Helper:** `ScheduleHelper` (added disableAllSchedulesByKind method)
|
||||
9. **`cancelAllNotifications()`** - ✅ **COMPLETE**
|
||||
- **File:** `android/src/main/java/com/timesafari/dailynotification/DailyNotificationPlugin.kt`
|
||||
- **Change:** Delegated alarm cancellation and WorkManager cancellation to `ScheduleHelper`
|
||||
- **Implementation:**
|
||||
- Added `ScheduleHelper.cancelAlarmsForSchedules()` to cancel alarms for a list of schedules
|
||||
- Added `ScheduleHelper.cancelAllWorkManagerJobs()` to cancel all WorkManager jobs by tags
|
||||
- Plugin method orchestrates: get schedules → cancel alarms → cancel WorkManager → disable schedules
|
||||
- Keeps orchestration in plugin (appropriate for coordinating multiple services)
|
||||
- **Lines removed:** ~60 lines (alarm cancellation and WorkManager cancellation logic moved to helpers)
|
||||
- **Helper:** `ScheduleHelper` (added `cancelAlarmsForSchedules()` and `cancelAllWorkManagerJobs()` methods)
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user