Fixed baseline tag drift issue: - docs/00-INDEX.md now references docs/progress/00-STATUS.md as canonical baseline - docs/progress/00-STATUS.md marked as canonical baseline authority Created Priority 2.1 mapping and batch planning: - docs/progress/P2.1-METHOD-SERVICE-MAP.md: Complete method-to-service mapping - docs/progress/P2.1-BATCH-1.md: First batch (pure delegation, ~15 methods) - docs/progress/P2.1-BATCH-2.md: Second batch (validation + delegation, ~20 methods) Batch 1 focuses on read-only operations (lowest risk). Batch 2 focuses on validation + delegation (medium risk). Expected reduction: ~1,650-2,000 lines across both platforms. Verification: - Baseline authority fixed ✅ - Method mapping complete ✅ - Batch plans created ✅
14 KiB
14 KiB
Priority 2.1: Method → Service Mapping
Purpose: Map plugin methods to existing services for delegation refactoring.
Owner: Development Team
Last Updated: 2025-12-23
Status: mapping
Baseline: See docs/progress/00-STATUS.md
Mapping Structure
For each plugin method, document:
- Plugin Method: Method name and signature
- Target Service: Existing service class
- Service Method: Method to call (or create if needed)
- Delegation Type:
pure|validation|glue|needs-service - Notes: Special considerations, state requirements, edge cases
Android: DailyNotificationPlugin.kt
Configuration & Setup
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
configure() |
TimeSafariIntegrationManager |
configure(...) |
glue | Needs integration manager setup |
load() |
Multiple | Various | glue | Initialization orchestration |
getDatabase() |
DailyNotificationDatabase |
getDatabase(context) |
pure | Direct access, keep as-is |
Permissions
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
checkPermissionStatus() |
PermissionManager |
checkNotificationPermission() |
pure | Direct delegation |
checkPermissions() |
PermissionManager |
checkAllPermissions() |
pure | Override, delegate to manager |
requestNotificationPermissions() |
PermissionManager |
requestNotificationPermission() |
pure | Direct delegation |
requestPermissions() |
PermissionManager |
requestAllPermissions() |
pure | Override, delegate to manager |
handleRequestPermissionsResult() |
PermissionManager |
handlePermissionResult() |
pure | Delegate result handling |
Exact Alarm (Android 12+)
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
getExactAlarmStatus() |
DailyNotificationExactAlarmManager |
getStatus() |
pure | Direct delegation |
checkExactAlarmPermission() |
DailyNotificationExactAlarmManager |
checkPermission() |
pure | Direct delegation |
requestExactAlarmPermission() |
DailyNotificationExactAlarmManager |
requestPermission() |
validation | May need activity context |
openExactAlarmSettings() |
DailyNotificationExactAlarmManager |
openSettings() |
validation | Needs activity context |
canScheduleExactAlarms() |
DailyNotificationExactAlarmManager |
canSchedule() |
pure | Private helper, move to service |
canRequestExactAlarmPermission() |
DailyNotificationExactAlarmManager |
canRequest() |
pure | Private helper, move to service |
Notification Channels
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
isChannelEnabled() |
ChannelManager |
isChannelEnabled(channelId) |
pure | Direct delegation |
openChannelSettings() |
ChannelManager |
openSettings(channelId) |
validation | Needs activity context |
Status & Health
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
getNotificationStatus() |
NotificationStatusChecker |
getComprehensiveStatus() |
pure | Direct delegation |
checkStatus() |
NotificationStatusChecker |
getComprehensiveStatus() |
pure | Alias, delegate to checker |
Scheduling
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
scheduleContentFetch() |
TimeSafariIntegrationManager |
scheduleFetch(...) |
glue | Integration orchestration |
scheduleDailyNotification() |
DailyNotificationScheduler |
schedule(...) |
validation | Input validation, then delegate |
scheduleUserNotification() |
DailyNotificationScheduler |
scheduleUserNotification(...) |
validation | Input validation, then delegate |
scheduleDualNotification() |
TimeSafariIntegrationManager |
scheduleDual(...) |
glue | Complex orchestration |
getDualScheduleStatus() |
TimeSafariIntegrationManager |
getDualStatus(...) |
pure | Direct delegation |
scheduleDailyReminder() |
DailyReminderManager |
schedule(...) |
validation | Input validation, then delegate |
isAlarmScheduled() |
DailyNotificationScheduler |
isScheduled(...) |
pure | Direct delegation |
getNextAlarmTime() |
DailyNotificationScheduler |
getNextAlarmTime() |
pure | Direct delegation |
testAlarm() |
DailyNotificationScheduler |
scheduleTest(...) |
validation | Test helper, validate input |
Content & Cache
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
getContentCache() |
DailyNotificationStorage |
getContentCache(id) |
pure | Direct delegation |
configureNativeFetcher() |
NativeNotificationContentFetcher |
registerNativeFetcher(...) |
pure | Static registry, keep as-is |
Schedule Management (CRUD)
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
getSchedules() |
DailyNotificationStorage |
getAllSchedules() |
pure | Direct delegation |
getSchedule(id) |
DailyNotificationStorage |
getSchedule(id) |
pure | Direct delegation |
getSchedulesWithStatus() |
DailyNotificationStorage |
getSchedulesWithStatus() |
glue | Combines storage + scheduler status |
createSchedule() |
DailyNotificationStorage |
createSchedule(...) |
validation | Validate input, delegate |
updateSchedule() |
DailyNotificationStorage |
updateSchedule(...) |
validation | Validate input, delegate |
deleteSchedule() |
DailyNotificationStorage |
deleteSchedule(id) |
validation | Validate input, delegate |
enableSchedule() |
DailyNotificationStorage |
enableSchedule(id, enabled) |
validation | Validate input, delegate |
Callbacks
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
registerCallback() |
DailyNotificationStorage |
registerCallback(...) |
validation | Validate input, delegate |
Utilities
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
cancelAllNotifications() |
DailyNotificationScheduler |
cancelAll() |
pure | Direct delegation |
updateStarredPlans() |
TimeSafariIntegrationManager |
updateStarredPlans(...) |
glue | Integration-specific |
injectInvalidTestData() |
DailyNotificationStorage |
injectTestData(...) |
validation | Test helper, validate input |
iOS: DailyNotificationPlugin.swift
Configuration & Setup
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
configure() |
DailyNotificationStorage |
configure(...) |
validation | Validate input, delegate |
load() |
Multiple | Various | glue | Initialization orchestration |
setupBackgroundTasks() |
DailyNotificationBackgroundTaskManager |
registerTasks() |
pure | Direct delegation |
Permissions
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
checkPermissionStatus() |
UNUserNotificationCenter |
getNotificationSettings() |
validation | Parse settings, format response |
requestNotificationPermissions() |
UNUserNotificationCenter |
requestAuthorization(...) |
validation | Handle async result |
getNotificationPermissionStatus() |
UNUserNotificationCenter |
getNotificationSettings() |
validation | Parse settings, format response |
requestNotificationPermission() |
UNUserNotificationCenter |
requestAuthorization(...) |
validation | Handle async result |
Background Tasks
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
getBackgroundTaskStatus() |
DailyNotificationBackgroundTaskManager |
getStatus() |
pure | Direct delegation |
handleBackgroundFetch() |
DailyNotificationBackgroundTaskManager |
handleFetch(task) |
glue | Task completion handling |
handleBackgroundNotify() |
DailyNotificationBackgroundTaskManager |
handleNotify(task) |
glue | Task completion handling |
checkForMissedBGTask() |
DailyNotificationBackgroundTaskManager |
checkMissed() |
pure | Direct delegation |
scheduleBackgroundFetch(config) |
DailyNotificationBackgroundTaskManager |
scheduleFetch(...) |
validation | Validate config, delegate |
scheduleBackgroundFetch(time) |
DailyNotificationBackgroundTaskManager |
scheduleFetch(time) |
pure | Direct delegation |
Scheduling
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
scheduleContentFetch() |
DailyNotificationScheduler |
scheduleFetch(...) |
validation | Validate input, delegate |
scheduleUserNotification() |
DailyNotificationScheduler |
scheduleUserNotification(...) |
validation | Validate input, delegate |
scheduleDualNotification() |
DailyNotificationScheduler |
scheduleDual(...) |
glue | Complex orchestration |
getDualScheduleStatus() |
DailyNotificationScheduler |
getDualStatus(...) |
pure | Direct delegation |
scheduleDailyReminder() |
DailyNotificationStorage |
storeReminder(...) |
validation | Validate input, delegate |
cancelDailyReminder() |
DailyNotificationStorage |
removeReminder(id) |
validation | Validate input, delegate |
getScheduledReminders() |
DailyNotificationStorage |
getReminders() |
pure | Direct delegation |
updateDailyReminder() |
DailyNotificationStorage |
updateReminder(...) |
validation | Validate input, delegate |
scheduleDailyNotification() |
DailyNotificationScheduler |
schedule(...) |
validation | Validate input, delegate |
getNextScheduledNotificationTime() |
DailyNotificationScheduler |
getNextTime() |
pure | Direct delegation |
calculateNextScheduledTime() |
DailyNotificationScheduler |
calculateNextTime(...) |
pure | Private helper, move to service |
Content & History
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
getLastNotification() |
DailyNotificationStorage |
getLastNotification() |
pure | Direct delegation |
getPendingNotifications() |
UNUserNotificationCenter |
getPendingNotificationRequests() |
validation | Parse requests, format response |
Status & Health
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
getNotificationStatus() |
DailyNotificationStateActor |
getStatus() |
glue | Combines multiple sources |
getHealthStatus() |
DailyNotificationStateActor |
getHealthStatus() |
pure | Private helper, move to service |
Settings & Channels
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
isChannelEnabled() |
UNUserNotificationCenter |
getNotificationSettings() |
validation | Parse settings, check channel |
openChannelSettings() |
UIApplication |
openSettingsURLString |
validation | Needs app context |
openNotificationSettings() |
UIApplication |
openSettingsURLString |
validation | Needs app context |
openBackgroundAppRefreshSettings() |
UIApplication |
openSettingsURLString |
validation | Needs app context |
updateSettings() |
DailyNotificationStorage |
updateSettings(...) |
validation | Validate input, delegate |
Utilities
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
cancelAllNotifications() |
UNUserNotificationCenter |
removeAllPendingNotificationRequests() |
pure | Direct delegation |
handleNotificationDelivery() |
DailyNotificationReactivationManager |
handleDelivery(...) |
glue | Notification observer |
processRollover() |
DailyNotificationReactivationManager |
processRollover(...) |
glue | Private helper, move to service |
formatTime() |
Utility | formatTime(timestamp) |
pure | Private helper, move to utility |
Storage Helpers (UserDefaults)
| Plugin Method | Target Service | Service Method | Type | Notes |
|---|---|---|---|---|
storeReminderInUserDefaults() |
DailyNotificationStorage |
storeReminder(...) |
pure | Private helper, delegate |
removeReminderFromUserDefaults() |
DailyNotificationStorage |
removeReminder(id) |
pure | Private helper, delegate |
getRemindersFromUserDefaults() |
DailyNotificationStorage |
getReminders() |
pure | Private helper, delegate |
updateReminderInUserDefaults() |
DailyNotificationStorage |
updateReminder(...) |
pure | Private helper, delegate |
Delegation Type Definitions
- pure: Direct delegation, no transformation needed
- validation: Input validation required before delegation
- glue: Orchestrates multiple services or handles platform-specific wiring
- needs-service: Service method doesn't exist yet, needs to be created
Next Steps
- ✅ Mapping complete (this document)
- ⏭️ Review mapping for accuracy
- ⏭️ Identify first two refactor batches (see
P2.1-BATCH-1.mdandP2.1-BATCH-2.md) - ⏭️ Begin Batch 1 implementation