forked from trent_larson/crowd-funder-for-time-pwa
WIP: Daily notification – optional id cleanup; Android issue not fixed
- NativeNotificationService: use single stable reminder id on iOS and Android, always pass id in scheduleOptions (plugin v1.1.2+ optional cleanup). - Add doc/plugin-fix-scheduleExactNotification-calls.md for plugin repo (fix Java call sites for scheduleExactNotification 8th parameter). - package-lock.json: update lockfile. Android second-schedule issue still present; to be revisited.
This commit is contained in:
108
doc/plugin-fix-scheduleExactNotification-calls.md
Normal file
108
doc/plugin-fix-scheduleExactNotification-calls.md
Normal file
@@ -0,0 +1,108 @@
|
||||
# Plugin fix: Update Java call sites for scheduleExactNotification (8th parameter)
|
||||
|
||||
## Problem
|
||||
|
||||
After adding the 8th parameter `skipPendingIntentIdempotence: Boolean = false` to `NotifyReceiver.scheduleExactNotification()` in NotifyReceiver.kt, the Java callers still pass only 7 arguments. That causes a compilation error when building an app that depends on the plugin:
|
||||
|
||||
```
|
||||
error: method scheduleExactNotification in class NotifyReceiver cannot be applied to given types;
|
||||
required: Context,long,UserNotificationConfig,boolean,String,String,ScheduleSource,boolean
|
||||
found: Context,long,UserNotificationConfig,boolean,<null>,String,ScheduleSource
|
||||
reason: actual and formal argument lists differ in length
|
||||
```
|
||||
|
||||
**Affected files (in the plugin repo):**
|
||||
- `android/src/main/java/com/timesafari/dailynotification/DailyNotificationReceiver.java`
|
||||
- `android/src/main/java/com/timesafari/dailynotification/DailyNotificationWorker.java`
|
||||
|
||||
## Current Kotlin signature (NotifyReceiver.kt)
|
||||
|
||||
```kotlin
|
||||
fun scheduleExactNotification(
|
||||
context: Context,
|
||||
triggerAtMillis: Long,
|
||||
config: UserNotificationConfig,
|
||||
isStaticReminder: Boolean = false,
|
||||
reminderId: String? = null,
|
||||
scheduleId: String? = null,
|
||||
source: ScheduleSource = ScheduleSource.MANUAL_RESCHEDULE,
|
||||
skipPendingIntentIdempotence: Boolean = false // 8th parameter
|
||||
)
|
||||
```
|
||||
|
||||
## Required change
|
||||
|
||||
In both Java files, add the **8th argument** to every call to `NotifyReceiver.scheduleExactNotification(...)`.
|
||||
|
||||
### 1. DailyNotificationReceiver.java
|
||||
|
||||
**Location:** around line 441, inside `scheduleNextNotification()`.
|
||||
|
||||
**Current call:**
|
||||
```java
|
||||
com.timesafari.dailynotification.NotifyReceiver.scheduleExactNotification(
|
||||
context,
|
||||
nextScheduledTime,
|
||||
config,
|
||||
false, // isStaticReminder
|
||||
null, // reminderId
|
||||
scheduleId,
|
||||
com.timesafari.dailynotification.ScheduleSource.ROLLOVER_ON_FIRE
|
||||
);
|
||||
```
|
||||
|
||||
**Fixed call (add 8th argument):**
|
||||
```java
|
||||
com.timesafari.dailynotification.NotifyReceiver.scheduleExactNotification(
|
||||
context,
|
||||
nextScheduledTime,
|
||||
config,
|
||||
false, // isStaticReminder
|
||||
null, // reminderId
|
||||
scheduleId,
|
||||
com.timesafari.dailynotification.ScheduleSource.ROLLOVER_ON_FIRE,
|
||||
false // skipPendingIntentIdempotence – rollover path does not skip
|
||||
);
|
||||
```
|
||||
|
||||
### 2. DailyNotificationWorker.java
|
||||
|
||||
**Location:** around line 584, inside `scheduleNextNotification()`.
|
||||
|
||||
**Current call:**
|
||||
```java
|
||||
com.timesafari.dailynotification.NotifyReceiver.scheduleExactNotification(
|
||||
getApplicationContext(),
|
||||
nextScheduledTime,
|
||||
config,
|
||||
false, // isStaticReminder
|
||||
null, // reminderId
|
||||
scheduleId,
|
||||
com.timesafari.dailynotification.ScheduleSource.ROLLOVER_ON_FIRE
|
||||
);
|
||||
```
|
||||
|
||||
**Fixed call (add 8th argument):**
|
||||
```java
|
||||
com.timesafari.dailynotification.NotifyReceiver.scheduleExactNotification(
|
||||
getApplicationContext(),
|
||||
nextScheduledTime,
|
||||
config,
|
||||
false, // isStaticReminder
|
||||
null, // reminderId
|
||||
scheduleId,
|
||||
com.timesafari.dailynotification.ScheduleSource.ROLLOVER_ON_FIRE,
|
||||
false // skipPendingIntentIdempotence – rollover path does not skip
|
||||
);
|
||||
```
|
||||
|
||||
## Other call sites
|
||||
|
||||
Kotlin call sites (NotifyReceiver.kt, DailyNotificationPlugin.kt, ReactivationManager.kt, BootReceiver.kt) use **named parameters**, so they already get the default for `skipPendingIntentIdempotence` and do not need changes. Only the **Java** call sites use positional arguments, so only the two files above need the 8th argument added. If you add new Java call sites later, pass the 8th parameter explicitly: `false` for rollover/fire paths, `true` only where the caller has just cancelled this schedule and you intend to skip the PendingIntent idempotence check.
|
||||
|
||||
## Verification
|
||||
|
||||
After updating the plugin:
|
||||
|
||||
1. Build the plugin (e.g. `./gradlew :timesafari-daily-notification-plugin:compileDebugJavaWithJavac` or full Android build from a consuming app).
|
||||
2. Ensure there are no “actual and formal argument lists differ in length” errors.
|
||||
Reference in New Issue
Block a user