Files
crowd-funder-for-time-pwa/doc/plugin-fix-scheduleExactNotification-calls.md
Jose Olarte III 9902e5fac7 chore: align with daily-notification-plugin 2.0.0 (org.timesafari namespace)
- Update Android manifest, Java imports, and capacitor.plugins.json to use
  org.timesafari.dailynotification (receivers, intent action, plugin classpath)
- Update iOS Info.plist BGTaskSchedulerPermittedIdentifiers to org.timesafari.*
- Bump @timesafari/daily-notification-plugin 1.3.3 → 2.0.0 (package-lock, Podfile.lock)
- Update docs and test-notification-receiver.sh to reference new package/action names
- Lockfile: minor bumps for @expo/cli, @expo/fingerprint, @expo/router-server, babel-preset-expo
2026-03-12 17:20:45 +08:00

109 lines
3.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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/org/timesafari/dailynotification/DailyNotificationReceiver.java`
- `android/src/main/java/org/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
org.timesafari.dailynotification.NotifyReceiver.scheduleExactNotification(
context,
nextScheduledTime,
config,
false, // isStaticReminder
null, // reminderId
scheduleId,
org.timesafari.dailynotification.ScheduleSource.ROLLOVER_ON_FIRE
);
```
**Fixed call (add 8th argument):**
```java
org.timesafari.dailynotification.NotifyReceiver.scheduleExactNotification(
context,
nextScheduledTime,
config,
false, // isStaticReminder
null, // reminderId
scheduleId,
org.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
org.timesafari.dailynotification.NotifyReceiver.scheduleExactNotification(
getApplicationContext(),
nextScheduledTime,
config,
false, // isStaticReminder
null, // reminderId
scheduleId,
org.timesafari.dailynotification.ScheduleSource.ROLLOVER_ON_FIRE
);
```
**Fixed call (add 8th argument):**
```java
org.timesafari.dailynotification.NotifyReceiver.scheduleExactNotification(
getApplicationContext(),
nextScheduledTime,
config,
false, // isStaticReminder
null, // reminderId
scheduleId,
org.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.