fix(notifications): align dual schedule config with Android plugin + bump DNP

- buildDualScheduleConfig: set contentFetch timeout/retryAttempts/retryDelay
  (match capacitor DailyNotification networkConfig), userNotification.vibration,
  return type DualScheduleConfiguration
- @timesafari/daily-notification-plugin 2.1.1 → 2.1.3 (package-lock)
- doc: plugin feedback (contentFetch JSON, parseUserNotificationConfig optional
  fields) and Android DailyNotificationWorker duplicate scheduleId note
This commit is contained in:
Jose Olarte III
2026-03-20 21:13:50 +08:00
parent 1389a166fa
commit e121db5fcf
5 changed files with 330 additions and 22 deletions

View File

@@ -3,6 +3,15 @@
* Used for API-driven "New Activity" notifications (prefetch + notify).
*/
import type { DualScheduleConfiguration } from "@timesafari/daily-notification-plugin";
/** Matches `plugins.DailyNotification.networkConfig` in capacitor.config.ts */
const CONTENT_FETCH_NETWORK = {
timeout: 30_000,
retryAttempts: 3,
retryDelay: 1_000,
} as const;
/**
* Convert "HH:mm" (24h) to cron expression "minute hour * * *" (daily at that time).
*/
@@ -42,26 +51,9 @@ export interface DualScheduleConfigInput {
* Build plugin DualScheduleConfiguration for scheduleDualNotification().
* contentFetch runs 5 minutes before notifyTime; userNotification at notifyTime.
*/
export function buildDualScheduleConfig(input: DualScheduleConfigInput): {
contentFetch: {
enabled: boolean;
schedule: string;
callbacks: Record<string, unknown>;
};
userNotification: {
enabled: boolean;
schedule: string;
title: string;
body: string;
sound: boolean;
priority: "high" | "normal" | "low";
};
relationship?: {
autoLink: boolean;
contentTimeout: number;
fallbackBehavior: "skip" | "show_default" | "retry";
};
} {
export function buildDualScheduleConfig(
input: DualScheduleConfigInput,
): DualScheduleConfiguration {
const notifyTime = input.notifyTime || "09:00";
const fetchCron = timeToCronFiveMinutesBefore(notifyTime);
const notifyCron = timeToCron(notifyTime);
@@ -69,6 +61,9 @@ export function buildDualScheduleConfig(input: DualScheduleConfigInput): {
contentFetch: {
enabled: true,
schedule: fetchCron,
timeout: CONTENT_FETCH_NETWORK.timeout,
retryAttempts: CONTENT_FETCH_NETWORK.retryAttempts,
retryDelay: CONTENT_FETCH_NETWORK.retryDelay,
callbacks: {},
},
userNotification: {
@@ -77,6 +72,7 @@ export function buildDualScheduleConfig(input: DualScheduleConfigInput): {
title: input.title ?? "New Activity",
body: input.body ?? "Check your starred projects and offers for updates.",
sound: true,
vibration: true,
priority: "normal",
},
relationship: {