docs(ios): add testing instructions for rollover interval
Add inline comments and documentation explaining how to temporarily change rollover notification intervals from 24 hours to 2 minutes for testing purposes. Comments specify exact line numbers and values to change, making it easy to switch between production and testing modes without losing context. Changes: - Add TESTING section to calculateNextScheduledTime() documentation - Add inline TESTING comments at three change points: * Calendar date addition (24 hours → 2 minutes) * Fallback time calculation (24 hours → 2 minutes) * Duplicate prevention threshold (1 hour → 1 minute) All code remains at production settings (24-hour intervals).
This commit is contained in:
@@ -389,6 +389,10 @@ class DailyNotificationScheduler {
|
||||
*
|
||||
* @param currentScheduledTime Current scheduled time in milliseconds
|
||||
* @return Next scheduled time in milliseconds (24 hours later)
|
||||
*
|
||||
* TESTING: To test with shorter intervals (e.g., 2 minutes), change:
|
||||
* - Line ~404: `.hour, value: 24` → `.minute, value: 2`
|
||||
* - Line ~407: `(24 * 60 * 60 * 1000)` → `(2 * 60 * 1000)`
|
||||
*/
|
||||
func calculateNextScheduledTime(_ currentScheduledTime: Int64) -> Int64 {
|
||||
let calendar = Calendar.current
|
||||
@@ -396,8 +400,10 @@ class DailyNotificationScheduler {
|
||||
let currentTimeStr = formatTime(currentScheduledTime)
|
||||
|
||||
// Add 24 hours (handles DST transitions automatically)
|
||||
// TESTING: Change `.hour, value: 24` to `.minute, value: 2` for 2-minute testing
|
||||
guard let nextDate = calendar.date(byAdding: .hour, value: 24, to: currentDate) else {
|
||||
// Fallback to simple 24-hour addition if calendar calculation fails
|
||||
// TESTING: Change `(24 * 60 * 60 * 1000)` to `(2 * 60 * 1000)` for 2-minute testing
|
||||
let fallbackTime = currentScheduledTime + (24 * 60 * 60 * 1000)
|
||||
let fallbackTimeStr = formatTime(fallbackTime)
|
||||
NSLog("DNP-ROLLOVER: DST_CALC_FAILED current=\(currentTimeStr) using_fallback=\(fallbackTimeStr)")
|
||||
@@ -456,6 +462,7 @@ class DailyNotificationScheduler {
|
||||
let lastRolloverTime = await storage.getLastRolloverTime(for: content.id)
|
||||
|
||||
// If rollover was processed recently (< 1 hour ago), skip
|
||||
// TESTING: Change `(60 * 60 * 1000)` to `(60 * 1000)` for 1-minute threshold when testing with 2-minute intervals
|
||||
if let lastTime = lastRolloverTime,
|
||||
(currentTime - lastTime) < (60 * 60 * 1000) {
|
||||
let lastTimeStr = formatTime(lastTime)
|
||||
|
||||
Reference in New Issue
Block a user