@chipmobilesdk/rn-notification 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +184 -0
- package/README.md +108 -16
- package/lib/commonjs/advanced.js +139 -0
- package/lib/commonjs/advanced.js.map +1 -0
- package/lib/commonjs/channel/migrate.js +246 -0
- package/lib/commonjs/channel/migrate.js.map +1 -0
- package/lib/commonjs/channel/tone-map.js +120 -0
- package/lib/commonjs/channel/tone-map.js.map +1 -0
- package/lib/commonjs/channel/validate-tone.js +61 -0
- package/lib/commonjs/channel/validate-tone.js.map +1 -0
- package/lib/commonjs/contract/channel.js +52 -0
- package/lib/commonjs/contract/channel.js.map +1 -0
- package/lib/commonjs/contract/diagnostics.js +25 -0
- package/lib/commonjs/contract/diagnostics.js.map +1 -0
- package/lib/commonjs/contract/errors.js +126 -0
- package/lib/commonjs/contract/errors.js.map +1 -0
- package/lib/commonjs/contract/hash.js +35 -0
- package/lib/commonjs/contract/hash.js.map +1 -0
- package/lib/commonjs/contract/index.js +94 -0
- package/lib/commonjs/contract/index.js.map +1 -0
- package/lib/commonjs/contract/interaction.js +37 -0
- package/lib/commonjs/contract/interaction.js.map +1 -0
- package/lib/commonjs/contract/notification.js +42 -0
- package/lib/commonjs/contract/notification.js.map +1 -0
- package/lib/commonjs/contract/permission.js +2 -0
- package/lib/commonjs/contract/permission.js.map +1 -0
- package/lib/commonjs/contract/reconcile.js +6 -0
- package/lib/commonjs/contract/reconcile.js.map +1 -0
- package/lib/commonjs/contract/recurrence.js +53 -0
- package/lib/commonjs/contract/recurrence.js.map +1 -0
- package/lib/commonjs/diagnostics/burst.js +89 -0
- package/lib/commonjs/diagnostics/burst.js.map +1 -0
- package/lib/commonjs/diagnostics/events.js +63 -0
- package/lib/commonjs/diagnostics/events.js.map +1 -0
- package/lib/commonjs/diagnostics/redact.js +48 -0
- package/lib/commonjs/diagnostics/redact.js.map +1 -0
- package/lib/commonjs/diagnostics/snapshot.js +68 -0
- package/lib/commonjs/diagnostics/snapshot.js.map +1 -0
- package/lib/commonjs/engine/adapter.js +6 -0
- package/lib/commonjs/engine/adapter.js.map +1 -0
- package/lib/commonjs/engine/codec.js +84 -0
- package/lib/commonjs/engine/codec.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/events.js +148 -0
- package/lib/commonjs/engine/notify-kit/events.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/module.js +119 -0
- package/lib/commonjs/engine/notify-kit/module.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/platform/android.js +159 -0
- package/lib/commonjs/engine/notify-kit/platform/android.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/platform/index.js +57 -0
- package/lib/commonjs/engine/notify-kit/platform/index.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/platform/ios.js +54 -0
- package/lib/commonjs/engine/notify-kit/platform/ios.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/platform/types.js +6 -0
- package/lib/commonjs/engine/notify-kit/platform/types.js.map +1 -0
- package/lib/commonjs/engine/notify-kit-engine.js +260 -0
- package/lib/commonjs/engine/notify-kit-engine.js.map +1 -0
- package/lib/commonjs/index.js +367 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/initialize.js +187 -0
- package/lib/commonjs/initialize.js.map +1 -0
- package/lib/commonjs/interaction/index.js +120 -0
- package/lib/commonjs/interaction/index.js.map +1 -0
- package/lib/commonjs/maintenance/cycle.js +108 -0
- package/lib/commonjs/maintenance/cycle.js.map +1 -0
- package/lib/commonjs/maintenance/permission-refresh.js +39 -0
- package/lib/commonjs/maintenance/permission-refresh.js.map +1 -0
- package/lib/commonjs/maintenance/reanchor.js +99 -0
- package/lib/commonjs/maintenance/reanchor.js.map +1 -0
- package/lib/commonjs/maintenance/toggle.js +50 -0
- package/lib/commonjs/maintenance/toggle.js.map +1 -0
- package/lib/commonjs/maintenance/verify.js +70 -0
- package/lib/commonjs/maintenance/verify.js.map +1 -0
- package/lib/commonjs/maintenance/window-refresh.js +53 -0
- package/lib/commonjs/maintenance/window-refresh.js.map +1 -0
- package/lib/commonjs/notifications.js +161 -0
- package/lib/commonjs/notifications.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/permission/index.js +182 -0
- package/lib/commonjs/permission/index.js.map +1 -0
- package/lib/commonjs/permission/state.js +92 -0
- package/lib/commonjs/permission/state.js.map +1 -0
- package/lib/commonjs/push/envelope.js +141 -0
- package/lib/commonjs/push/envelope.js.map +1 -0
- package/lib/commonjs/push/fcm-provider.js +122 -0
- package/lib/commonjs/push/fcm-provider.js.map +1 -0
- package/lib/commonjs/push/gate.js +162 -0
- package/lib/commonjs/push/gate.js.map +1 -0
- package/lib/commonjs/push/index.js +47 -0
- package/lib/commonjs/push/index.js.map +1 -0
- package/lib/commonjs/push/instructions.js +101 -0
- package/lib/commonjs/push/instructions.js.map +1 -0
- package/lib/commonjs/push/provider-adapter.js +6 -0
- package/lib/commonjs/push/provider-adapter.js.map +1 -0
- package/lib/commonjs/push/signout.js +55 -0
- package/lib/commonjs/push/signout.js.map +1 -0
- package/lib/commonjs/reconcile/chunk.js +49 -0
- package/lib/commonjs/reconcile/chunk.js.map +1 -0
- package/lib/commonjs/reconcile/diff.js +105 -0
- package/lib/commonjs/reconcile/diff.js.map +1 -0
- package/lib/commonjs/reconcile/duplicates.js +60 -0
- package/lib/commonjs/reconcile/duplicates.js.map +1 -0
- package/lib/commonjs/reconcile/index.js +164 -0
- package/lib/commonjs/reconcile/index.js.map +1 -0
- package/lib/commonjs/reconcile/truncate.js +50 -0
- package/lib/commonjs/reconcile/truncate.js.map +1 -0
- package/lib/commonjs/recurrence/clock-guard.js +65 -0
- package/lib/commonjs/recurrence/clock-guard.js.map +1 -0
- package/lib/commonjs/recurrence/expand.js +254 -0
- package/lib/commonjs/recurrence/expand.js.map +1 -0
- package/lib/commonjs/recurrence/index.js +212 -0
- package/lib/commonjs/recurrence/index.js.map +1 -0
- package/lib/commonjs/repeat/expiry.js +41 -0
- package/lib/commonjs/repeat/expiry.js.map +1 -0
- package/lib/commonjs/repeat/index.js +100 -0
- package/lib/commonjs/repeat/index.js.map +1 -0
- package/lib/commonjs/repeat/marker.js +58 -0
- package/lib/commonjs/repeat/marker.js.map +1 -0
- package/lib/commonjs/repeat/place.js +83 -0
- package/lib/commonjs/repeat/place.js.map +1 -0
- package/lib/commonjs/schedule/anchor.js +243 -0
- package/lib/commonjs/schedule/anchor.js.map +1 -0
- package/lib/commonjs/schedule/index.js +142 -0
- package/lib/commonjs/schedule/index.js.map +1 -0
- package/lib/commonjs/schedule/partition.js +59 -0
- package/lib/commonjs/schedule/partition.js.map +1 -0
- package/lib/commonjs/schedule/resolve-moment.js +72 -0
- package/lib/commonjs/schedule/resolve-moment.js.map +1 -0
- package/lib/commonjs/schedule/validate-content.js +101 -0
- package/lib/commonjs/schedule/validate-content.js.map +1 -0
- package/lib/commonjs/schedule/validate-identifier.js +126 -0
- package/lib/commonjs/schedule/validate-identifier.js.map +1 -0
- package/lib/commonjs/schedule/writer.js +44 -0
- package/lib/commonjs/schedule/writer.js.map +1 -0
- package/lib/commonjs/state/caps.js +101 -0
- package/lib/commonjs/state/caps.js.map +1 -0
- package/lib/commonjs/state/dedup-ledger.js +39 -0
- package/lib/commonjs/state/dedup-ledger.js.map +1 -0
- package/lib/commonjs/state/interaction-buffer.js +98 -0
- package/lib/commonjs/state/interaction-buffer.js.map +1 -0
- package/lib/commonjs/state/mmkv-store.js +75 -0
- package/lib/commonjs/state/mmkv-store.js.map +1 -0
- package/lib/commonjs/state/permission-history.js +64 -0
- package/lib/commonjs/state/permission-history.js.map +1 -0
- package/lib/commonjs/state/record.js +269 -0
- package/lib/commonjs/state/record.js.map +1 -0
- package/lib/commonjs/state/reset.js +37 -0
- package/lib/commonjs/state/reset.js.map +1 -0
- package/lib/commonjs/state/series-ledger.js +71 -0
- package/lib/commonjs/state/series-ledger.js.map +1 -0
- package/lib/commonjs/state/store.js +39 -0
- package/lib/commonjs/state/store.js.map +1 -0
- package/lib/commonjs/testing/conformance/index.js +218 -0
- package/lib/commonjs/testing/conformance/index.js.map +1 -0
- package/lib/commonjs/testing/fake-engine.js +338 -0
- package/lib/commonjs/testing/fake-engine.js.map +1 -0
- package/lib/commonjs/testing/fake-provider.js +93 -0
- package/lib/commonjs/testing/fake-provider.js.map +1 -0
- package/lib/commonjs/testing/faults.js +59 -0
- package/lib/commonjs/testing/faults.js.map +1 -0
- package/lib/commonjs/testing/index.js +54 -0
- package/lib/commonjs/testing/index.js.map +1 -0
- package/lib/commonjs/testing/measure.js +298 -0
- package/lib/commonjs/testing/measure.js.map +1 -0
- package/lib/module/advanced.js +29 -0
- package/lib/module/advanced.js.map +1 -0
- package/lib/module/channel/migrate.js +242 -0
- package/lib/module/channel/migrate.js.map +1 -0
- package/lib/module/channel/tone-map.js +112 -0
- package/lib/module/channel/tone-map.js.map +1 -0
- package/lib/module/channel/validate-tone.js +57 -0
- package/lib/module/channel/validate-tone.js.map +1 -0
- package/lib/module/contract/channel.js +48 -0
- package/lib/module/contract/channel.js.map +1 -0
- package/lib/module/contract/diagnostics.js +21 -0
- package/lib/module/contract/diagnostics.js.map +1 -0
- package/lib/module/contract/errors.js +119 -0
- package/lib/module/contract/errors.js.map +1 -0
- package/lib/module/contract/hash.js +29 -0
- package/lib/module/contract/hash.js.map +1 -0
- package/lib/module/contract/index.js +13 -0
- package/lib/module/contract/index.js.map +1 -0
- package/lib/module/contract/interaction.js +33 -0
- package/lib/module/contract/interaction.js.map +1 -0
- package/lib/module/contract/notification.js +38 -0
- package/lib/module/contract/notification.js.map +1 -0
- package/lib/module/contract/permission.js +2 -0
- package/lib/module/contract/permission.js.map +1 -0
- package/lib/module/contract/reconcile.js +4 -0
- package/lib/module/contract/reconcile.js.map +1 -0
- package/lib/module/contract/recurrence.js +49 -0
- package/lib/module/contract/recurrence.js.map +1 -0
- package/lib/module/diagnostics/burst.js +85 -0
- package/lib/module/diagnostics/burst.js.map +1 -0
- package/lib/module/diagnostics/events.js +58 -0
- package/lib/module/diagnostics/events.js.map +1 -0
- package/lib/module/diagnostics/redact.js +44 -0
- package/lib/module/diagnostics/redact.js.map +1 -0
- package/lib/module/diagnostics/snapshot.js +64 -0
- package/lib/module/diagnostics/snapshot.js.map +1 -0
- package/lib/module/engine/adapter.js +4 -0
- package/lib/module/engine/adapter.js.map +1 -0
- package/lib/module/engine/codec.js +79 -0
- package/lib/module/engine/codec.js.map +1 -0
- package/lib/module/engine/notify-kit/events.js +139 -0
- package/lib/module/engine/notify-kit/events.js.map +1 -0
- package/lib/module/engine/notify-kit/module.js +113 -0
- package/lib/module/engine/notify-kit/module.js.map +1 -0
- package/lib/module/engine/notify-kit/platform/android.js +155 -0
- package/lib/module/engine/notify-kit/platform/android.js.map +1 -0
- package/lib/module/engine/notify-kit/platform/index.js +51 -0
- package/lib/module/engine/notify-kit/platform/index.js.map +1 -0
- package/lib/module/engine/notify-kit/platform/ios.js +49 -0
- package/lib/module/engine/notify-kit/platform/ios.js.map +1 -0
- package/lib/module/engine/notify-kit/platform/types.js +4 -0
- package/lib/module/engine/notify-kit/platform/types.js.map +1 -0
- package/lib/module/engine/notify-kit-engine.js +257 -0
- package/lib/module/engine/notify-kit-engine.js.map +1 -0
- package/lib/module/index.js +98 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/initialize.js +182 -0
- package/lib/module/initialize.js.map +1 -0
- package/lib/module/interaction/index.js +116 -0
- package/lib/module/interaction/index.js.map +1 -0
- package/lib/module/maintenance/cycle.js +102 -0
- package/lib/module/maintenance/cycle.js.map +1 -0
- package/lib/module/maintenance/permission-refresh.js +34 -0
- package/lib/module/maintenance/permission-refresh.js.map +1 -0
- package/lib/module/maintenance/reanchor.js +94 -0
- package/lib/module/maintenance/reanchor.js.map +1 -0
- package/lib/module/maintenance/toggle.js +45 -0
- package/lib/module/maintenance/toggle.js.map +1 -0
- package/lib/module/maintenance/verify.js +65 -0
- package/lib/module/maintenance/verify.js.map +1 -0
- package/lib/module/maintenance/window-refresh.js +48 -0
- package/lib/module/maintenance/window-refresh.js.map +1 -0
- package/lib/module/notifications.js +157 -0
- package/lib/module/notifications.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/permission/index.js +178 -0
- package/lib/module/permission/index.js.map +1 -0
- package/lib/module/permission/state.js +83 -0
- package/lib/module/permission/state.js.map +1 -0
- package/lib/module/push/envelope.js +137 -0
- package/lib/module/push/envelope.js.map +1 -0
- package/lib/module/push/fcm-provider.js +119 -0
- package/lib/module/push/fcm-provider.js.map +1 -0
- package/lib/module/push/gate.js +158 -0
- package/lib/module/push/gate.js.map +1 -0
- package/lib/module/push/index.js +16 -0
- package/lib/module/push/index.js.map +1 -0
- package/lib/module/push/instructions.js +97 -0
- package/lib/module/push/instructions.js.map +1 -0
- package/lib/module/push/provider-adapter.js +4 -0
- package/lib/module/push/provider-adapter.js.map +1 -0
- package/lib/module/push/signout.js +51 -0
- package/lib/module/push/signout.js.map +1 -0
- package/lib/module/reconcile/chunk.js +43 -0
- package/lib/module/reconcile/chunk.js.map +1 -0
- package/lib/module/reconcile/diff.js +101 -0
- package/lib/module/reconcile/diff.js.map +1 -0
- package/lib/module/reconcile/duplicates.js +56 -0
- package/lib/module/reconcile/duplicates.js.map +1 -0
- package/lib/module/reconcile/index.js +161 -0
- package/lib/module/reconcile/index.js.map +1 -0
- package/lib/module/reconcile/truncate.js +46 -0
- package/lib/module/reconcile/truncate.js.map +1 -0
- package/lib/module/recurrence/clock-guard.js +60 -0
- package/lib/module/recurrence/clock-guard.js.map +1 -0
- package/lib/module/recurrence/expand.js +248 -0
- package/lib/module/recurrence/expand.js.map +1 -0
- package/lib/module/recurrence/index.js +208 -0
- package/lib/module/recurrence/index.js.map +1 -0
- package/lib/module/repeat/expiry.js +37 -0
- package/lib/module/repeat/expiry.js.map +1 -0
- package/lib/module/repeat/index.js +67 -0
- package/lib/module/repeat/index.js.map +1 -0
- package/lib/module/repeat/marker.js +51 -0
- package/lib/module/repeat/marker.js.map +1 -0
- package/lib/module/repeat/place.js +79 -0
- package/lib/module/repeat/place.js.map +1 -0
- package/lib/module/schedule/anchor.js +234 -0
- package/lib/module/schedule/anchor.js.map +1 -0
- package/lib/module/schedule/index.js +137 -0
- package/lib/module/schedule/index.js.map +1 -0
- package/lib/module/schedule/partition.js +53 -0
- package/lib/module/schedule/partition.js.map +1 -0
- package/lib/module/schedule/resolve-moment.js +66 -0
- package/lib/module/schedule/resolve-moment.js.map +1 -0
- package/lib/module/schedule/validate-content.js +95 -0
- package/lib/module/schedule/validate-content.js.map +1 -0
- package/lib/module/schedule/validate-identifier.js +119 -0
- package/lib/module/schedule/validate-identifier.js.map +1 -0
- package/lib/module/schedule/writer.js +40 -0
- package/lib/module/schedule/writer.js.map +1 -0
- package/lib/module/state/caps.js +96 -0
- package/lib/module/state/caps.js.map +1 -0
- package/lib/module/state/dedup-ledger.js +34 -0
- package/lib/module/state/dedup-ledger.js.map +1 -0
- package/lib/module/state/interaction-buffer.js +92 -0
- package/lib/module/state/interaction-buffer.js.map +1 -0
- package/lib/module/state/mmkv-store.js +71 -0
- package/lib/module/state/mmkv-store.js.map +1 -0
- package/lib/module/state/permission-history.js +56 -0
- package/lib/module/state/permission-history.js.map +1 -0
- package/lib/module/state/record.js +264 -0
- package/lib/module/state/record.js.map +1 -0
- package/lib/module/state/reset.js +32 -0
- package/lib/module/state/reset.js.map +1 -0
- package/lib/module/state/series-ledger.js +62 -0
- package/lib/module/state/series-ledger.js.map +1 -0
- package/lib/module/state/store.js +35 -0
- package/lib/module/state/store.js.map +1 -0
- package/lib/module/testing/conformance/index.js +214 -0
- package/lib/module/testing/conformance/index.js.map +1 -0
- package/lib/module/testing/fake-engine.js +335 -0
- package/lib/module/testing/fake-engine.js.map +1 -0
- package/lib/module/testing/fake-provider.js +89 -0
- package/lib/module/testing/fake-provider.js.map +1 -0
- package/lib/module/testing/faults.js +55 -0
- package/lib/module/testing/faults.js.map +1 -0
- package/lib/module/testing/index.js +19 -0
- package/lib/module/testing/index.js.map +1 -0
- package/lib/module/testing/measure.js +294 -0
- package/lib/module/testing/measure.js.map +1 -0
- package/lib/typescript/commonjs/advanced.d.ts +36 -0
- package/lib/typescript/commonjs/advanced.d.ts.map +1 -0
- package/lib/typescript/commonjs/channel/migrate.d.ts +38 -0
- package/lib/typescript/commonjs/channel/migrate.d.ts.map +1 -0
- package/lib/typescript/commonjs/channel/tone-map.d.ts +34 -0
- package/lib/typescript/commonjs/channel/tone-map.d.ts.map +1 -0
- package/lib/typescript/commonjs/channel/validate-tone.d.ts +23 -0
- package/lib/typescript/commonjs/channel/validate-tone.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/channel.d.ts +185 -0
- package/lib/typescript/commonjs/contract/channel.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/diagnostics.d.ts +92 -0
- package/lib/typescript/commonjs/contract/diagnostics.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/errors.d.ts +91 -0
- package/lib/typescript/commonjs/contract/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/hash.d.ts +14 -0
- package/lib/typescript/commonjs/contract/hash.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/index.d.ts +10 -0
- package/lib/typescript/commonjs/contract/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/interaction.d.ts +53 -0
- package/lib/typescript/commonjs/contract/interaction.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/notification.d.ts +110 -0
- package/lib/typescript/commonjs/contract/notification.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/permission.d.ts +49 -0
- package/lib/typescript/commonjs/contract/permission.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/reconcile.d.ts +82 -0
- package/lib/typescript/commonjs/contract/reconcile.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/recurrence.d.ts +118 -0
- package/lib/typescript/commonjs/contract/recurrence.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/burst.d.ts +39 -0
- package/lib/typescript/commonjs/diagnostics/burst.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/events.d.ts +28 -0
- package/lib/typescript/commonjs/diagnostics/events.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/redact.d.ts +22 -0
- package/lib/typescript/commonjs/diagnostics/redact.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/snapshot.d.ts +40 -0
- package/lib/typescript/commonjs/diagnostics/snapshot.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/adapter.d.ts +172 -0
- package/lib/typescript/commonjs/engine/adapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/codec.d.ts +20 -0
- package/lib/typescript/commonjs/engine/codec.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/events.d.ts +37 -0
- package/lib/typescript/commonjs/engine/notify-kit/events.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/module.d.ts +103 -0
- package/lib/typescript/commonjs/engine/notify-kit/module.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/android.d.ts +3 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/android.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/index.d.ts +12 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/ios.d.ts +3 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/ios.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/types.d.ts +33 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit-engine.d.ts +25 -0
- package/lib/typescript/commonjs/engine/notify-kit-engine.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +106 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/initialize.d.ts +74 -0
- package/lib/typescript/commonjs/initialize.d.ts.map +1 -0
- package/lib/typescript/commonjs/interaction/index.d.ts +53 -0
- package/lib/typescript/commonjs/interaction/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/cycle.d.ts +77 -0
- package/lib/typescript/commonjs/maintenance/cycle.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/permission-refresh.d.ts +19 -0
- package/lib/typescript/commonjs/maintenance/permission-refresh.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/reanchor.d.ts +26 -0
- package/lib/typescript/commonjs/maintenance/reanchor.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/toggle.d.ts +35 -0
- package/lib/typescript/commonjs/maintenance/toggle.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/verify.d.ts +32 -0
- package/lib/typescript/commonjs/maintenance/verify.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/window-refresh.d.ts +29 -0
- package/lib/typescript/commonjs/maintenance/window-refresh.d.ts.map +1 -0
- package/lib/typescript/commonjs/notifications.d.ts +78 -0
- package/lib/typescript/commonjs/notifications.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/permission/index.d.ts +57 -0
- package/lib/typescript/commonjs/permission/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/permission/state.d.ts +41 -0
- package/lib/typescript/commonjs/permission/state.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/envelope.d.ts +33 -0
- package/lib/typescript/commonjs/push/envelope.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/fcm-provider.d.ts +43 -0
- package/lib/typescript/commonjs/push/fcm-provider.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/gate.d.ts +57 -0
- package/lib/typescript/commonjs/push/gate.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/index.d.ts +19 -0
- package/lib/typescript/commonjs/push/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/instructions.d.ts +45 -0
- package/lib/typescript/commonjs/push/instructions.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/provider-adapter.d.ts +50 -0
- package/lib/typescript/commonjs/push/provider-adapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/signout.d.ts +33 -0
- package/lib/typescript/commonjs/push/signout.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/chunk.d.ts +24 -0
- package/lib/typescript/commonjs/reconcile/chunk.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/diff.d.ts +54 -0
- package/lib/typescript/commonjs/reconcile/diff.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/duplicates.d.ts +32 -0
- package/lib/typescript/commonjs/reconcile/duplicates.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/index.d.ts +35 -0
- package/lib/typescript/commonjs/reconcile/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/truncate.d.ts +26 -0
- package/lib/typescript/commonjs/reconcile/truncate.d.ts.map +1 -0
- package/lib/typescript/commonjs/recurrence/clock-guard.d.ts +37 -0
- package/lib/typescript/commonjs/recurrence/clock-guard.d.ts.map +1 -0
- package/lib/typescript/commonjs/recurrence/expand.d.ts +75 -0
- package/lib/typescript/commonjs/recurrence/expand.d.ts.map +1 -0
- package/lib/typescript/commonjs/recurrence/index.d.ts +40 -0
- package/lib/typescript/commonjs/recurrence/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/repeat/expiry.d.ts +23 -0
- package/lib/typescript/commonjs/repeat/expiry.d.ts.map +1 -0
- package/lib/typescript/commonjs/repeat/index.d.ts +49 -0
- package/lib/typescript/commonjs/repeat/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/repeat/marker.d.ts +36 -0
- package/lib/typescript/commonjs/repeat/marker.d.ts.map +1 -0
- package/lib/typescript/commonjs/repeat/place.d.ts +39 -0
- package/lib/typescript/commonjs/repeat/place.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/anchor.d.ts +118 -0
- package/lib/typescript/commonjs/schedule/anchor.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/index.d.ts +40 -0
- package/lib/typescript/commonjs/schedule/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/partition.d.ts +29 -0
- package/lib/typescript/commonjs/schedule/partition.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/resolve-moment.d.ts +35 -0
- package/lib/typescript/commonjs/schedule/resolve-moment.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/validate-content.d.ts +42 -0
- package/lib/typescript/commonjs/schedule/validate-content.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/validate-identifier.d.ts +30 -0
- package/lib/typescript/commonjs/schedule/validate-identifier.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/writer.d.ts +36 -0
- package/lib/typescript/commonjs/schedule/writer.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/caps.d.ts +51 -0
- package/lib/typescript/commonjs/state/caps.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/dedup-ledger.d.ts +21 -0
- package/lib/typescript/commonjs/state/dedup-ledger.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/interaction-buffer.d.ts +30 -0
- package/lib/typescript/commonjs/state/interaction-buffer.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/mmkv-store.d.ts +33 -0
- package/lib/typescript/commonjs/state/mmkv-store.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/permission-history.d.ts +20 -0
- package/lib/typescript/commonjs/state/permission-history.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/record.d.ts +134 -0
- package/lib/typescript/commonjs/state/record.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/reset.d.ts +22 -0
- package/lib/typescript/commonjs/state/reset.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/series-ledger.d.ts +47 -0
- package/lib/typescript/commonjs/state/series-ledger.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/store.d.ts +20 -0
- package/lib/typescript/commonjs/state/store.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/index.d.ts +32 -0
- package/lib/typescript/commonjs/testing/conformance/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/fake-engine.d.ts +91 -0
- package/lib/typescript/commonjs/testing/fake-engine.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/fake-provider.d.ts +35 -0
- package/lib/typescript/commonjs/testing/fake-provider.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/faults.d.ts +38 -0
- package/lib/typescript/commonjs/testing/faults.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/index.d.ts +22 -0
- package/lib/typescript/commonjs/testing/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/measure.d.ts +59 -0
- package/lib/typescript/commonjs/testing/measure.d.ts.map +1 -0
- package/lib/typescript/module/advanced.d.ts +36 -0
- package/lib/typescript/module/advanced.d.ts.map +1 -0
- package/lib/typescript/module/channel/migrate.d.ts +38 -0
- package/lib/typescript/module/channel/migrate.d.ts.map +1 -0
- package/lib/typescript/module/channel/tone-map.d.ts +34 -0
- package/lib/typescript/module/channel/tone-map.d.ts.map +1 -0
- package/lib/typescript/module/channel/validate-tone.d.ts +23 -0
- package/lib/typescript/module/channel/validate-tone.d.ts.map +1 -0
- package/lib/typescript/module/contract/channel.d.ts +185 -0
- package/lib/typescript/module/contract/channel.d.ts.map +1 -0
- package/lib/typescript/module/contract/diagnostics.d.ts +92 -0
- package/lib/typescript/module/contract/diagnostics.d.ts.map +1 -0
- package/lib/typescript/module/contract/errors.d.ts +91 -0
- package/lib/typescript/module/contract/errors.d.ts.map +1 -0
- package/lib/typescript/module/contract/hash.d.ts +14 -0
- package/lib/typescript/module/contract/hash.d.ts.map +1 -0
- package/lib/typescript/module/contract/index.d.ts +10 -0
- package/lib/typescript/module/contract/index.d.ts.map +1 -0
- package/lib/typescript/module/contract/interaction.d.ts +53 -0
- package/lib/typescript/module/contract/interaction.d.ts.map +1 -0
- package/lib/typescript/module/contract/notification.d.ts +110 -0
- package/lib/typescript/module/contract/notification.d.ts.map +1 -0
- package/lib/typescript/module/contract/permission.d.ts +49 -0
- package/lib/typescript/module/contract/permission.d.ts.map +1 -0
- package/lib/typescript/module/contract/reconcile.d.ts +82 -0
- package/lib/typescript/module/contract/reconcile.d.ts.map +1 -0
- package/lib/typescript/module/contract/recurrence.d.ts +118 -0
- package/lib/typescript/module/contract/recurrence.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/burst.d.ts +39 -0
- package/lib/typescript/module/diagnostics/burst.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/events.d.ts +28 -0
- package/lib/typescript/module/diagnostics/events.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/redact.d.ts +22 -0
- package/lib/typescript/module/diagnostics/redact.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/snapshot.d.ts +40 -0
- package/lib/typescript/module/diagnostics/snapshot.d.ts.map +1 -0
- package/lib/typescript/module/engine/adapter.d.ts +172 -0
- package/lib/typescript/module/engine/adapter.d.ts.map +1 -0
- package/lib/typescript/module/engine/codec.d.ts +20 -0
- package/lib/typescript/module/engine/codec.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/events.d.ts +37 -0
- package/lib/typescript/module/engine/notify-kit/events.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/module.d.ts +103 -0
- package/lib/typescript/module/engine/notify-kit/module.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/platform/android.d.ts +3 -0
- package/lib/typescript/module/engine/notify-kit/platform/android.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/platform/index.d.ts +12 -0
- package/lib/typescript/module/engine/notify-kit/platform/index.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/platform/ios.d.ts +3 -0
- package/lib/typescript/module/engine/notify-kit/platform/ios.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/platform/types.d.ts +33 -0
- package/lib/typescript/module/engine/notify-kit/platform/types.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit-engine.d.ts +25 -0
- package/lib/typescript/module/engine/notify-kit-engine.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +106 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/initialize.d.ts +74 -0
- package/lib/typescript/module/initialize.d.ts.map +1 -0
- package/lib/typescript/module/interaction/index.d.ts +53 -0
- package/lib/typescript/module/interaction/index.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/cycle.d.ts +77 -0
- package/lib/typescript/module/maintenance/cycle.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/permission-refresh.d.ts +19 -0
- package/lib/typescript/module/maintenance/permission-refresh.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/reanchor.d.ts +26 -0
- package/lib/typescript/module/maintenance/reanchor.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/toggle.d.ts +35 -0
- package/lib/typescript/module/maintenance/toggle.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/verify.d.ts +32 -0
- package/lib/typescript/module/maintenance/verify.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/window-refresh.d.ts +29 -0
- package/lib/typescript/module/maintenance/window-refresh.d.ts.map +1 -0
- package/lib/typescript/module/notifications.d.ts +78 -0
- package/lib/typescript/module/notifications.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/permission/index.d.ts +57 -0
- package/lib/typescript/module/permission/index.d.ts.map +1 -0
- package/lib/typescript/module/permission/state.d.ts +41 -0
- package/lib/typescript/module/permission/state.d.ts.map +1 -0
- package/lib/typescript/module/push/envelope.d.ts +33 -0
- package/lib/typescript/module/push/envelope.d.ts.map +1 -0
- package/lib/typescript/module/push/fcm-provider.d.ts +43 -0
- package/lib/typescript/module/push/fcm-provider.d.ts.map +1 -0
- package/lib/typescript/module/push/gate.d.ts +57 -0
- package/lib/typescript/module/push/gate.d.ts.map +1 -0
- package/lib/typescript/module/push/index.d.ts +19 -0
- package/lib/typescript/module/push/index.d.ts.map +1 -0
- package/lib/typescript/module/push/instructions.d.ts +45 -0
- package/lib/typescript/module/push/instructions.d.ts.map +1 -0
- package/lib/typescript/module/push/provider-adapter.d.ts +50 -0
- package/lib/typescript/module/push/provider-adapter.d.ts.map +1 -0
- package/lib/typescript/module/push/signout.d.ts +33 -0
- package/lib/typescript/module/push/signout.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/chunk.d.ts +24 -0
- package/lib/typescript/module/reconcile/chunk.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/diff.d.ts +54 -0
- package/lib/typescript/module/reconcile/diff.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/duplicates.d.ts +32 -0
- package/lib/typescript/module/reconcile/duplicates.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/index.d.ts +35 -0
- package/lib/typescript/module/reconcile/index.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/truncate.d.ts +26 -0
- package/lib/typescript/module/reconcile/truncate.d.ts.map +1 -0
- package/lib/typescript/module/recurrence/clock-guard.d.ts +37 -0
- package/lib/typescript/module/recurrence/clock-guard.d.ts.map +1 -0
- package/lib/typescript/module/recurrence/expand.d.ts +75 -0
- package/lib/typescript/module/recurrence/expand.d.ts.map +1 -0
- package/lib/typescript/module/recurrence/index.d.ts +40 -0
- package/lib/typescript/module/recurrence/index.d.ts.map +1 -0
- package/lib/typescript/module/repeat/expiry.d.ts +23 -0
- package/lib/typescript/module/repeat/expiry.d.ts.map +1 -0
- package/lib/typescript/module/repeat/index.d.ts +49 -0
- package/lib/typescript/module/repeat/index.d.ts.map +1 -0
- package/lib/typescript/module/repeat/marker.d.ts +36 -0
- package/lib/typescript/module/repeat/marker.d.ts.map +1 -0
- package/lib/typescript/module/repeat/place.d.ts +39 -0
- package/lib/typescript/module/repeat/place.d.ts.map +1 -0
- package/lib/typescript/module/schedule/anchor.d.ts +118 -0
- package/lib/typescript/module/schedule/anchor.d.ts.map +1 -0
- package/lib/typescript/module/schedule/index.d.ts +40 -0
- package/lib/typescript/module/schedule/index.d.ts.map +1 -0
- package/lib/typescript/module/schedule/partition.d.ts +29 -0
- package/lib/typescript/module/schedule/partition.d.ts.map +1 -0
- package/lib/typescript/module/schedule/resolve-moment.d.ts +35 -0
- package/lib/typescript/module/schedule/resolve-moment.d.ts.map +1 -0
- package/lib/typescript/module/schedule/validate-content.d.ts +42 -0
- package/lib/typescript/module/schedule/validate-content.d.ts.map +1 -0
- package/lib/typescript/module/schedule/validate-identifier.d.ts +30 -0
- package/lib/typescript/module/schedule/validate-identifier.d.ts.map +1 -0
- package/lib/typescript/module/schedule/writer.d.ts +36 -0
- package/lib/typescript/module/schedule/writer.d.ts.map +1 -0
- package/lib/typescript/module/state/caps.d.ts +51 -0
- package/lib/typescript/module/state/caps.d.ts.map +1 -0
- package/lib/typescript/module/state/dedup-ledger.d.ts +21 -0
- package/lib/typescript/module/state/dedup-ledger.d.ts.map +1 -0
- package/lib/typescript/module/state/interaction-buffer.d.ts +30 -0
- package/lib/typescript/module/state/interaction-buffer.d.ts.map +1 -0
- package/lib/typescript/module/state/mmkv-store.d.ts +33 -0
- package/lib/typescript/module/state/mmkv-store.d.ts.map +1 -0
- package/lib/typescript/module/state/permission-history.d.ts +20 -0
- package/lib/typescript/module/state/permission-history.d.ts.map +1 -0
- package/lib/typescript/module/state/record.d.ts +134 -0
- package/lib/typescript/module/state/record.d.ts.map +1 -0
- package/lib/typescript/module/state/reset.d.ts +22 -0
- package/lib/typescript/module/state/reset.d.ts.map +1 -0
- package/lib/typescript/module/state/series-ledger.d.ts +47 -0
- package/lib/typescript/module/state/series-ledger.d.ts.map +1 -0
- package/lib/typescript/module/state/store.d.ts +20 -0
- package/lib/typescript/module/state/store.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/index.d.ts +32 -0
- package/lib/typescript/module/testing/conformance/index.d.ts.map +1 -0
- package/lib/typescript/module/testing/fake-engine.d.ts +91 -0
- package/lib/typescript/module/testing/fake-engine.d.ts.map +1 -0
- package/lib/typescript/module/testing/fake-provider.d.ts +35 -0
- package/lib/typescript/module/testing/fake-provider.d.ts.map +1 -0
- package/lib/typescript/module/testing/faults.d.ts +38 -0
- package/lib/typescript/module/testing/faults.d.ts.map +1 -0
- package/lib/typescript/module/testing/index.d.ts +22 -0
- package/lib/typescript/module/testing/index.d.ts.map +1 -0
- package/lib/typescript/module/testing/measure.d.ts +59 -0
- package/lib/typescript/module/testing/measure.d.ts.map +1 -0
- package/package.json +74 -23
- package/skills/sdk-rn-notification/SKILL.md +6 -5
- package/src/advanced.ts +35 -0
- package/src/channel/migrate.ts +176 -158
- package/src/channel/tone-map.ts +2 -10
- package/src/contract/errors.ts +7 -0
- package/src/contract/hash.ts +26 -0
- package/src/engine/adapter.ts +21 -1
- package/src/engine/notify-kit/events.ts +155 -0
- package/src/engine/notify-kit/module.ts +148 -0
- package/src/engine/notify-kit/platform/android.ts +172 -0
- package/src/engine/notify-kit/platform/index.ts +55 -0
- package/src/engine/notify-kit/platform/ios.ts +54 -0
- package/src/engine/notify-kit/platform/types.ts +40 -0
- package/src/engine/notify-kit-engine.ts +96 -477
- package/src/index.ts +9 -0
- package/src/notifications.ts +195 -0
- package/src/permission/index.ts +65 -4
- package/src/push/fcm-provider.ts +14 -4
- package/src/push/gate.ts +27 -5
- package/src/reconcile/diff.ts +38 -27
- package/src/reconcile/index.ts +13 -4
- package/src/recurrence/index.ts +2 -1
- package/src/repeat/expiry.ts +2 -6
- package/src/repeat/index.ts +45 -1
- package/src/repeat/marker.ts +1 -22
- package/src/repeat/place.ts +74 -35
- package/src/schedule/index.ts +10 -4
- package/src/schedule/partition.ts +0 -19
- package/src/schedule/validate-identifier.ts +8 -6
- package/src/schedule/writer.ts +13 -4
- package/src/state/caps.ts +28 -3
- package/src/state/permission-history.ts +25 -0
- package/src/state/record.ts +110 -20
- package/src/testing/fake-engine.ts +17 -1
package/src/engine/adapter.ts
CHANGED
|
@@ -105,6 +105,12 @@ export interface NotificationEngineAdapter {
|
|
|
105
105
|
|
|
106
106
|
/** Full detail, so callers can diff rather than merely count. */
|
|
107
107
|
getPending(): Promise<readonly PendingEntry[]>;
|
|
108
|
+
/**
|
|
109
|
+
* The identifiers of pending entries, without their payloads (NOT-08).
|
|
110
|
+
* Optional: an engine without a cheap way to list them leaves it out and the
|
|
111
|
+
* package reads `getPending()` instead.
|
|
112
|
+
*/
|
|
113
|
+
pendingIds?(): Promise<readonly string[]>;
|
|
108
114
|
|
|
109
115
|
/**
|
|
110
116
|
* Applies a channel or category declaration.
|
|
@@ -119,6 +125,12 @@ export interface NotificationEngineAdapter {
|
|
|
119
125
|
declareGroups(groups: readonly ChannelGroup[]): Promise<void>;
|
|
120
126
|
/** Channel ids the platform currently holds, which re-declaration cannot reveal. */
|
|
121
127
|
listDeclaredChannels(): Promise<readonly string[]>;
|
|
128
|
+
/**
|
|
129
|
+
* Runs `work` with the declared channels read once and kept current as `work`
|
|
130
|
+
* declares and retires them (NOT-08). Optional; without it each declaration
|
|
131
|
+
* reads the channel list itself.
|
|
132
|
+
*/
|
|
133
|
+
withChannelSnapshot?<T>(work: () => Promise<T>): Promise<T>;
|
|
122
134
|
|
|
123
135
|
getPermission(kind: PermissionKind): Promise<PermissionState>;
|
|
124
136
|
requestPermission(kind: PermissionKind): Promise<PermissionState>;
|
|
@@ -165,7 +177,15 @@ export interface NotificationEngineAdapter {
|
|
|
165
177
|
* a consumer's behalf, which is why it is a documented setup step rather than
|
|
166
178
|
* an internal detail — and why its absence is reported rather than guessed at.
|
|
167
179
|
*/
|
|
168
|
-
registerBackgroundDeliveryHandler(
|
|
180
|
+
registerBackgroundDeliveryHandler(
|
|
181
|
+
handler: (event: DeliveryEvent) => Promise<void>,
|
|
182
|
+
/**
|
|
183
|
+
* Taps, actions and dismissals that arrive while the app is not in front
|
|
184
|
+
* (0.6.0). The engine has one background handler per process, so interactions
|
|
185
|
+
* travel through this registration too; without it they were dropped.
|
|
186
|
+
*/
|
|
187
|
+
onInteraction?: (event: InteractionEvent) => Promise<void>,
|
|
188
|
+
): void;
|
|
169
189
|
|
|
170
190
|
/** Whether a background delivery handler has been registered in this process. */
|
|
171
191
|
hasBackgroundDeliveryHandler(): boolean;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading what the engine hands back: pending entries, interactions, deliveries
|
|
3
|
+
* and authorization values, turned into the package's own shapes.
|
|
4
|
+
*
|
|
5
|
+
* Pure functions of the raw value and a clock, so they are testable without an
|
|
6
|
+
* engine and shared by the foreground, background and cold-start paths.
|
|
7
|
+
*/
|
|
8
|
+
import type { PendingEntry } from '../../contract/notification';
|
|
9
|
+
import type { PermissionState } from '../../contract/permission';
|
|
10
|
+
import type { InteractionEvent } from '../../contract/interaction';
|
|
11
|
+
import { isRepeatStopId } from '../../repeat/marker';
|
|
12
|
+
import type { DeliveryEvent, RepeatStop } from '../adapter';
|
|
13
|
+
import { unpackData } from '../codec';
|
|
14
|
+
import {
|
|
15
|
+
EVENT_TYPE_ACTION_PRESS,
|
|
16
|
+
EVENT_TYPE_DELIVERED,
|
|
17
|
+
EVENT_TYPE_DISMISSED,
|
|
18
|
+
EVENT_TYPE_PRESS,
|
|
19
|
+
} from './module';
|
|
20
|
+
|
|
21
|
+
type Raw = Record<string, unknown>;
|
|
22
|
+
|
|
23
|
+
const bag = (value: unknown): Raw => (value ?? {}) as Raw;
|
|
24
|
+
const dataOf = (notification: Raw): Record<string, string> =>
|
|
25
|
+
(notification.data ?? {}) as Record<string, string>;
|
|
26
|
+
|
|
27
|
+
/** Reads a stop marker back out of a pending entry's data bag, if it is one. */
|
|
28
|
+
export function unpackRepeatStop(id: string, data: Record<string, string>): RepeatStop | undefined {
|
|
29
|
+
if (!isRepeatStopId(id)) return undefined;
|
|
30
|
+
const targetId = data.__cms_stop_target;
|
|
31
|
+
const dueAt = Number.parseInt(data.__cms_stop_due ?? '', 10);
|
|
32
|
+
if (typeof targetId !== 'string' || !Number.isFinite(dueAt)) return undefined;
|
|
33
|
+
return { markerId: id, targetId, dueAt };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function unpackEntry(raw: Raw, now: () => number): PendingEntry | undefined {
|
|
37
|
+
const notification = bag(raw.notification);
|
|
38
|
+
const trigger = bag(raw.trigger);
|
|
39
|
+
const id = notification.id;
|
|
40
|
+
if (typeof id !== 'string') return undefined;
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
id,
|
|
44
|
+
resolvedAt: typeof trigger.timestamp === 'number' ? trigger.timestamp : now(),
|
|
45
|
+
content: {
|
|
46
|
+
title: typeof notification.title === 'string' ? notification.title : '',
|
|
47
|
+
body: typeof notification.body === 'string' ? notification.body : '',
|
|
48
|
+
subtitle: typeof notification.subtitle === 'string' ? notification.subtitle : undefined,
|
|
49
|
+
},
|
|
50
|
+
...unpackData(dataOf(notification)),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Every stop marker among the engine's pending triggers. */
|
|
55
|
+
export function unpackRepeatStops(raw: readonly Raw[]): RepeatStop[] {
|
|
56
|
+
const stops: RepeatStop[] = [];
|
|
57
|
+
for (const entry of raw) {
|
|
58
|
+
const notification = bag(entry.notification);
|
|
59
|
+
const id = notification.id;
|
|
60
|
+
if (typeof id !== 'string') continue;
|
|
61
|
+
const stop = unpackRepeatStop(id, dataOf(notification));
|
|
62
|
+
if (stop !== undefined) stops.push(stop);
|
|
63
|
+
}
|
|
64
|
+
return stops;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* An interaction, or undefined for anything that is not one.
|
|
69
|
+
*
|
|
70
|
+
* Only a dismissal or a press is an interaction. Everything else the engine
|
|
71
|
+
* emits on this channel — delivery, trigger creation, channel blocking — is not,
|
|
72
|
+
* and reporting it as one would cancel a notification the user never touched.
|
|
73
|
+
*/
|
|
74
|
+
export function toInteraction(raw: Raw, now: () => number): InteractionEvent | undefined {
|
|
75
|
+
const eventType = raw.type;
|
|
76
|
+
if (
|
|
77
|
+
eventType !== EVENT_TYPE_DISMISSED &&
|
|
78
|
+
eventType !== EVENT_TYPE_PRESS &&
|
|
79
|
+
eventType !== EVENT_TYPE_ACTION_PRESS
|
|
80
|
+
) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const detail = bag(raw.detail);
|
|
85
|
+
const notification = bag(detail.notification);
|
|
86
|
+
const pressAction = bag(detail.pressAction);
|
|
87
|
+
const id = notification.id;
|
|
88
|
+
if (typeof id !== 'string') return undefined;
|
|
89
|
+
|
|
90
|
+
const data = dataOf(notification);
|
|
91
|
+
const actionId = typeof pressAction.id === 'string' ? pressAction.id : undefined;
|
|
92
|
+
// `default` is the engine's own press-action id for tapping the body, so it is
|
|
93
|
+
// a tap rather than a named action.
|
|
94
|
+
const isNamedAction = actionId !== undefined && actionId !== 'default';
|
|
95
|
+
let kind: InteractionEvent['kind'];
|
|
96
|
+
if (eventType === EVENT_TYPE_DISMISSED) {
|
|
97
|
+
kind = 'dismiss';
|
|
98
|
+
} else if (isNamedAction) {
|
|
99
|
+
kind = 'action';
|
|
100
|
+
} else {
|
|
101
|
+
kind = 'tap';
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
kind,
|
|
106
|
+
notificationId: id,
|
|
107
|
+
actionId: isNamedAction ? actionId : undefined,
|
|
108
|
+
inputText: typeof detail.input === 'string' ? detail.input : undefined,
|
|
109
|
+
// The one decoder for the data bag, so routing is parsed the same way here
|
|
110
|
+
// and when reading the pending set back (NOT-18).
|
|
111
|
+
routing: unpackData(data).routing,
|
|
112
|
+
ownerTag: data.__cms_owner,
|
|
113
|
+
occurredAt: now(),
|
|
114
|
+
appState: 'foreground',
|
|
115
|
+
wasBuffered: false,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** A delivery, or undefined for anything that is not one. */
|
|
120
|
+
export function toDelivery(raw: Raw, now: () => number): DeliveryEvent | undefined {
|
|
121
|
+
if (raw.type !== EVENT_TYPE_DELIVERED) return undefined;
|
|
122
|
+
|
|
123
|
+
const notification = bag(bag(raw.detail).notification);
|
|
124
|
+
const id = notification.id;
|
|
125
|
+
if (typeof id !== 'string') return undefined;
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
notificationId: id,
|
|
129
|
+
occurredAt: now(),
|
|
130
|
+
repeatStop: unpackRepeatStop(id, dataOf(notification)),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Maps engine authorization values onto our six-state model.
|
|
136
|
+
*
|
|
137
|
+
* `notAsked` and `denied` must stay distinguishable — being able to read state
|
|
138
|
+
* without prompting is worthless if the two collapse. `provisional` is its own
|
|
139
|
+
* state on both edges, never folded into granted or denied.
|
|
140
|
+
*/
|
|
141
|
+
export function toPermissionState(raw: unknown): PermissionState {
|
|
142
|
+
switch (raw) {
|
|
143
|
+
case 1:
|
|
144
|
+
case 'authorized':
|
|
145
|
+
return 'granted';
|
|
146
|
+
case 2:
|
|
147
|
+
case 'provisional':
|
|
148
|
+
return 'provisional';
|
|
149
|
+
case 0:
|
|
150
|
+
case 'denied':
|
|
151
|
+
return 'denied';
|
|
152
|
+
default:
|
|
153
|
+
return 'notAsked';
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The slice of `react-native-notify-kit` this package uses, and how it is loaded.
|
|
3
|
+
*
|
|
4
|
+
* Every import of the engine is confined to this file. The module is required
|
|
5
|
+
* lazily so the package loads in Jest and in any environment without the native
|
|
6
|
+
* module; an absent engine is reported through the normal diagnostic path
|
|
7
|
+
* rather than crashing at import time.
|
|
8
|
+
*/
|
|
9
|
+
import { lazyPeer } from '@chipmobilesdk/rn-core';
|
|
10
|
+
|
|
11
|
+
import { DIAGNOSTIC_CODES, NotificationError } from '../../contract/errors';
|
|
12
|
+
|
|
13
|
+
/** Both platforms bound background execution for a silent payload or background action. */
|
|
14
|
+
export const BACKGROUND_WINDOW_MS = 30_000;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The engine's own enum values, mirrored as literals.
|
|
18
|
+
*
|
|
19
|
+
* These are **numeric** enums in the engine's type definitions, and its native
|
|
20
|
+
* validator rejects the string names — `importance: 'default'` fails with
|
|
21
|
+
* "expected a valid Importance". Mirroring them here rather than importing the
|
|
22
|
+
* enums keeps the engine out of the module graph, which is what lets the
|
|
23
|
+
* package load without the native module present.
|
|
24
|
+
*
|
|
25
|
+
* The package's own `ResolvedTone` deliberately stays platform-neutral strings;
|
|
26
|
+
* translating to the engine's representation is this adapter's job and nobody
|
|
27
|
+
* else's.
|
|
28
|
+
*/
|
|
29
|
+
export const ANDROID_IMPORTANCE = {
|
|
30
|
+
none: 0,
|
|
31
|
+
min: 1,
|
|
32
|
+
low: 2,
|
|
33
|
+
default: 3,
|
|
34
|
+
high: 4,
|
|
35
|
+
} as const;
|
|
36
|
+
|
|
37
|
+
/** `TriggerType.TIMESTAMP`. */
|
|
38
|
+
export const TRIGGER_TYPE_TIMESTAMP = 0;
|
|
39
|
+
|
|
40
|
+
/** `AlarmType.SET_EXACT_AND_ALLOW_WHILE_IDLE` — exact delivery, survives Doze. */
|
|
41
|
+
export const ALARM_TYPE_EXACT_AND_ALLOW_WHILE_IDLE = 3;
|
|
42
|
+
|
|
43
|
+
/** `AlarmType.SET_AND_ALLOW_WHILE_IDLE` — the approximate degradation of the above. */
|
|
44
|
+
export const ALARM_TYPE_INEXACT_AND_ALLOW_WHILE_IDLE = 1;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* `EventType` values that represent a real user interaction.
|
|
48
|
+
*
|
|
49
|
+
* The engine emits far more than interactions on this channel — `DELIVERED`,
|
|
50
|
+
* `TRIGGER_NOTIFICATION_CREATED`, `CHANNEL_BLOCKED` and others all arrive here.
|
|
51
|
+
* Treating anything that is not a dismissal as a press would report a
|
|
52
|
+
* notification *arriving* while the app is open as the user having tapped it,
|
|
53
|
+
* and the interaction path cancels on tap — so the notification would vanish
|
|
54
|
+
* from the tray in front of the user, unread.
|
|
55
|
+
*/
|
|
56
|
+
export const EVENT_TYPE_DISMISSED = 0;
|
|
57
|
+
export const EVENT_TYPE_PRESS = 1;
|
|
58
|
+
export const EVENT_TYPE_ACTION_PRESS = 2;
|
|
59
|
+
|
|
60
|
+
/** `EventType.DELIVERED` — an arrival, which is emphatically not an interaction. */
|
|
61
|
+
export const EVENT_TYPE_DELIVERED = 3;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* `AndroidCategory.ALARM`, the engine's marking for a time-sensitive alert.
|
|
65
|
+
*
|
|
66
|
+
* A per-notification property, not channel configuration — which is why
|
|
67
|
+
* declaring `timeSensitive` on an existing tone never obliges a version bump.
|
|
68
|
+
*/
|
|
69
|
+
export const ANDROID_CATEGORY_ALARM = 'alarm';
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The channel stop markers are posted on.
|
|
73
|
+
*
|
|
74
|
+
* A marker exists to be delivered and immediately removed, so it is given the
|
|
75
|
+
* quietest configuration the platform offers: minimum importance, no sound, no
|
|
76
|
+
* vibration. Its version is fixed because nothing about it is consumer-declared,
|
|
77
|
+
* so it never migrates.
|
|
78
|
+
*/
|
|
79
|
+
export const MARKER_CHANNEL_ID = 'cms.internal.stop.v1';
|
|
80
|
+
|
|
81
|
+
/** Minimal shape used from the engine, so its full surface never leaks into typing. */
|
|
82
|
+
export interface NotifyKitModule {
|
|
83
|
+
createChannel(channel: Record<string, unknown>): Promise<string>;
|
|
84
|
+
deleteChannel(channelId: string): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Labels come back with the id. That is what makes a label refresh decidable
|
|
87
|
+
* against the device rather than against a ledger of our own — and a ledger
|
|
88
|
+
* drifts after a restore, a reinstall, or a change the user made themselves.
|
|
89
|
+
*/
|
|
90
|
+
getChannels(): Promise<{ id: string; name?: string; description?: string }[]>;
|
|
91
|
+
createChannelGroup(group: Record<string, unknown>): Promise<string>;
|
|
92
|
+
createTriggerNotification(
|
|
93
|
+
notification: Record<string, unknown>,
|
|
94
|
+
trigger: Record<string, unknown>,
|
|
95
|
+
): Promise<string>;
|
|
96
|
+
displayNotification(notification: Record<string, unknown>): Promise<string>;
|
|
97
|
+
getDisplayedNotifications(): Promise<Record<string, unknown>[]>;
|
|
98
|
+
cancelNotification(id: string): Promise<void>;
|
|
99
|
+
cancelAllNotifications(): Promise<void>;
|
|
100
|
+
getTriggerNotifications(): Promise<Record<string, unknown>[]>;
|
|
101
|
+
/** Identifiers only. Optional, because not every release of the binding has it. */
|
|
102
|
+
getTriggerNotificationIds?(): Promise<string[]>;
|
|
103
|
+
onBackgroundEvent(handler: (event: Record<string, unknown>) => Promise<void>): void;
|
|
104
|
+
requestPermission(options?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
105
|
+
getNotificationSettings(): Promise<Record<string, unknown>>;
|
|
106
|
+
openNotificationSettings(): Promise<void>;
|
|
107
|
+
openAlarmPermissionSettings(): Promise<void>;
|
|
108
|
+
isBatteryOptimizationEnabled(): Promise<boolean>;
|
|
109
|
+
onForegroundEvent(handler: (event: Record<string, unknown>) => void): () => void;
|
|
110
|
+
getInitialNotification(): Promise<Record<string, unknown> | null>;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Drops keys whose value is `undefined`.
|
|
115
|
+
*
|
|
116
|
+
* The engine validates its arguments by key presence, not by value: passing
|
|
117
|
+
* `{ groupId: undefined }` fails with "expected a string value", while omitting
|
|
118
|
+
* the key entirely is accepted. JavaScript treats the two as interchangeable
|
|
119
|
+
* almost everywhere, which is exactly why this is easy to get wrong — and why
|
|
120
|
+
* it only surfaces on a real device, where the native validator runs.
|
|
121
|
+
*/
|
|
122
|
+
export function compact<T extends Record<string, unknown>>(value: T): Partial<T> {
|
|
123
|
+
const output: Record<string, unknown> = {};
|
|
124
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
125
|
+
if (entry !== undefined) output[key] = entry;
|
|
126
|
+
}
|
|
127
|
+
return output as Partial<T>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const notifyKit = lazyPeer('react-native-notify-kit', () => {
|
|
131
|
+
// Inside `try`, so Metro bundles an app that leaves this optional peer out.
|
|
132
|
+
try {
|
|
133
|
+
return require('react-native-notify-kit') as { default: NotifyKitModule };
|
|
134
|
+
} catch (cause) {
|
|
135
|
+
throw cause;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export function loadEngine(): NotifyKitModule {
|
|
140
|
+
return notifyKit.require(
|
|
141
|
+
(_peer, cause) =>
|
|
142
|
+
new NotificationError(
|
|
143
|
+
DIAGNOSTIC_CODES.PUSH_UNAVAILABLE,
|
|
144
|
+
'react-native-notify-kit is not installed or its native module is not linked. Install it as a peer dependency and rebuild the app.',
|
|
145
|
+
{ reason: cause instanceof Error ? cause.name : 'unknown' },
|
|
146
|
+
),
|
|
147
|
+
).default;
|
|
148
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Android: channels, exact alarms, battery optimisation, looping alerts.
|
|
3
|
+
*/
|
|
4
|
+
import type { RestrictionReport } from '../../../contract/permission';
|
|
5
|
+
import { toPermissionState } from '../events';
|
|
6
|
+
import { ANDROID_IMPORTANCE, BACKGROUND_WINDOW_MS, MARKER_CHANNEL_ID, compact } from '../module';
|
|
7
|
+
import type { NotifyKitPlatform, PlatformContext } from './types';
|
|
8
|
+
|
|
9
|
+
/** Android has no hard pending ceiling like iOS; this bound keeps behavior predictable. */
|
|
10
|
+
const ANDROID_PENDING_BUDGET = 500;
|
|
11
|
+
/** Android 13: the first version with a runtime display permission. */
|
|
12
|
+
const DISPLAY_PERMISSION_API = 33;
|
|
13
|
+
/** Android 12: the first version that gates exact alarms. */
|
|
14
|
+
const EXACT_ALARM_API = 31;
|
|
15
|
+
|
|
16
|
+
type DeclaredChannel = { id: string; name?: string; description?: string };
|
|
17
|
+
|
|
18
|
+
export function createAndroidPlatform({ engine, apiLevel }: PlatformContext): NotifyKitPlatform {
|
|
19
|
+
let markerChannelReady = false;
|
|
20
|
+
/** The declared channels for the duration of one `withChannelSnapshot` (NOT-08). */
|
|
21
|
+
let channelSnapshot: DeclaredChannel[] | undefined;
|
|
22
|
+
const declaredChannels = async (): Promise<DeclaredChannel[]> =>
|
|
23
|
+
channelSnapshot ?? engine().getChannels();
|
|
24
|
+
// An unknown API level is treated as current: gating is the safe assumption.
|
|
25
|
+
const atLeast = (level: number): boolean => (apiLevel() ?? Number.POSITIVE_INFINITY) >= level;
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
capabilities: () => ({
|
|
29
|
+
pendingCeiling: ANDROID_PENDING_BUDGET,
|
|
30
|
+
supportsExactAlarms: true,
|
|
31
|
+
supportsChannels: true,
|
|
32
|
+
supportsTextInputActions: true,
|
|
33
|
+
supportsDoNotDisturbBypass: true,
|
|
34
|
+
supportsRepeatingAlert: true,
|
|
35
|
+
backgroundWindowMs: BACKGROUND_WINDOW_MS,
|
|
36
|
+
}),
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Lazily rather than at initialization, so an app that never declares a
|
|
40
|
+
* repeating tone never grows an extra entry in the user's notification
|
|
41
|
+
* settings for a feature it does not use.
|
|
42
|
+
*/
|
|
43
|
+
async ensureMarkerChannel() {
|
|
44
|
+
if (markerChannelReady) return;
|
|
45
|
+
await engine().createChannel({
|
|
46
|
+
id: MARKER_CHANNEL_ID,
|
|
47
|
+
name: 'Background maintenance',
|
|
48
|
+
description:
|
|
49
|
+
'Used briefly to end a repeating alert. Notifications here are removed immediately.',
|
|
50
|
+
importance: ANDROID_IMPORTANCE.min,
|
|
51
|
+
vibration: false,
|
|
52
|
+
badge: false,
|
|
53
|
+
});
|
|
54
|
+
markerChannelReady = true;
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
async withChannelSnapshot(work) {
|
|
58
|
+
if (channelSnapshot !== undefined) {
|
|
59
|
+
return work();
|
|
60
|
+
}
|
|
61
|
+
channelSnapshot = await engine().getChannels();
|
|
62
|
+
try {
|
|
63
|
+
return await work();
|
|
64
|
+
} finally {
|
|
65
|
+
channelSnapshot = undefined;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
async declareTone(tone) {
|
|
70
|
+
const existing = await declaredChannels();
|
|
71
|
+
const held = existing.find(channel => channel.id === tone.android.channelId);
|
|
72
|
+
const remember = () => {
|
|
73
|
+
channelSnapshot = channelSnapshot
|
|
74
|
+
?.filter(channel => channel.id !== tone.android.channelId)
|
|
75
|
+
.concat({
|
|
76
|
+
id: tone.android.channelId,
|
|
77
|
+
name: tone.android.name,
|
|
78
|
+
description: tone.android.description,
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const payload = compact({
|
|
83
|
+
id: tone.android.channelId,
|
|
84
|
+
// The consumer's declared label, not the tone identifier. Passing the
|
|
85
|
+
// identifier here is what put a technical string in front of users on
|
|
86
|
+
// the one screen these labels exist to serve.
|
|
87
|
+
name: tone.android.name,
|
|
88
|
+
description: tone.android.description,
|
|
89
|
+
importance: ANDROID_IMPORTANCE[tone.android.importance],
|
|
90
|
+
sound: tone.android.sound,
|
|
91
|
+
vibration: tone.android.vibration,
|
|
92
|
+
badge: tone.android.badge,
|
|
93
|
+
bypassDnd: tone.android.bypassDnd,
|
|
94
|
+
groupId: tone.android.groupId,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
if (held === undefined) {
|
|
98
|
+
await engine().createChannel(payload);
|
|
99
|
+
remember();
|
|
100
|
+
return 'created';
|
|
101
|
+
}
|
|
102
|
+
if (held.name === tone.android.name && held.description === tone.android.description) {
|
|
103
|
+
// Nothing to say to the platform. Skipping the call is what keeps an
|
|
104
|
+
// unchanged configuration genuinely free, which reconciliation
|
|
105
|
+
// idempotence depends on.
|
|
106
|
+
return 'unchanged';
|
|
107
|
+
}
|
|
108
|
+
// Android accepts a re-declaration of an existing channel and applies only
|
|
109
|
+
// the name and description, ignoring importance, sound, vibration and DND
|
|
110
|
+
// — because those belong to the user once the channel exists. That refusal
|
|
111
|
+
// is the guarantee: the platform declines to overwrite the user's settings.
|
|
112
|
+
await engine().createChannel(payload);
|
|
113
|
+
remember();
|
|
114
|
+
return 'labelsRefreshed';
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
async retireTone(channelId) {
|
|
118
|
+
const existing = await declaredChannels();
|
|
119
|
+
if (!existing.some(channel => channel.id === channelId)) return false;
|
|
120
|
+
await engine().deleteChannel(channelId);
|
|
121
|
+
channelSnapshot = channelSnapshot?.filter(channel => channel.id !== channelId);
|
|
122
|
+
return true;
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
async declareGroups(groups) {
|
|
126
|
+
for (const group of groups) {
|
|
127
|
+
await engine().createChannelGroup(
|
|
128
|
+
compact({ id: group.id, name: group.name, description: group.description }),
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
async listDeclaredChannels() {
|
|
134
|
+
return (await declaredChannels()).map(channel => channel.id);
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
permissionFrom(kind, settings) {
|
|
138
|
+
if (kind === 'display') {
|
|
139
|
+
// Android below 13 has no runtime display permission at all.
|
|
140
|
+
return atLeast(DISPLAY_PERMISSION_API)
|
|
141
|
+
? toPermissionState(settings.authorizationStatus)
|
|
142
|
+
: 'notRequired';
|
|
143
|
+
}
|
|
144
|
+
// Before Android 12 the concept does not apply: "not required", not "denied".
|
|
145
|
+
if (!atLeast(EXACT_ALARM_API)) {
|
|
146
|
+
return 'notRequired';
|
|
147
|
+
}
|
|
148
|
+
const android = (settings.android ?? {}) as Record<string, unknown>;
|
|
149
|
+
return android.alarm === 1 ? 'granted' : 'denied';
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
gatesExactAlarms: () => atLeast(EXACT_ALARM_API),
|
|
153
|
+
|
|
154
|
+
async restrictions(now) {
|
|
155
|
+
let batteryOptimization: RestrictionReport['batteryOptimization'] = 'unknown';
|
|
156
|
+
try {
|
|
157
|
+
batteryOptimization = (await engine().isBatteryOptimizationEnabled())
|
|
158
|
+
? 'restricted'
|
|
159
|
+
: 'unrestricted';
|
|
160
|
+
} catch {
|
|
161
|
+
batteryOptimization = 'unknown';
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
batteryOptimization,
|
|
165
|
+
// No standard API exposes vendor auto-start policy, and guessing would
|
|
166
|
+
// be worse than admitting it. `unknown` is a first-class answer here.
|
|
167
|
+
autoStart: 'unknown',
|
|
168
|
+
readAt: now(),
|
|
169
|
+
};
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one place this package asks which platform it is on (IOS-08).
|
|
3
|
+
*
|
|
4
|
+
* rn-core's `currentPlatform()` decides the OS; the Android API level is read
|
|
5
|
+
* from React Native lazily, when asked, so the module loads without it.
|
|
6
|
+
*/
|
|
7
|
+
import { currentPlatform, lazyPeer } from '@chipmobilesdk/rn-core';
|
|
8
|
+
|
|
9
|
+
import type { PlatformInfo } from '../../../permission/state';
|
|
10
|
+
import type { NotifyKitModule } from '../module';
|
|
11
|
+
import { createAndroidPlatform } from './android';
|
|
12
|
+
import { createIosPlatform } from './ios';
|
|
13
|
+
import type { NotifyKitPlatform } from './types';
|
|
14
|
+
|
|
15
|
+
export type { NotifyKitPlatform } from './types';
|
|
16
|
+
|
|
17
|
+
type ReactNativeSlice = { Platform?: { Version?: unknown } };
|
|
18
|
+
|
|
19
|
+
const reactNative = lazyPeer<ReactNativeSlice>('react-native', () => {
|
|
20
|
+
try {
|
|
21
|
+
return require('react-native') as ReactNativeSlice;
|
|
22
|
+
} catch (cause) {
|
|
23
|
+
throw cause;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/** The running OS and, on Android, its API level. */
|
|
28
|
+
export function detectPlatform(): PlatformInfo {
|
|
29
|
+
const os = currentPlatform();
|
|
30
|
+
if (os !== 'android') {
|
|
31
|
+
return { os: os === 'ios' ? 'ios' : 'other' };
|
|
32
|
+
}
|
|
33
|
+
const result = reactNative.get();
|
|
34
|
+
const version = result.ok ? result.module.Platform?.Version : undefined;
|
|
35
|
+
return { os, apiLevel: typeof version === 'number' ? version : undefined };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The strategy for `platform`, or for the running one. Only Android gets the
|
|
40
|
+
* Android strategy; anywhere else nothing channel- or alarm-specific is called.
|
|
41
|
+
*/
|
|
42
|
+
export function createNotifyKitPlatform(
|
|
43
|
+
engine: () => NotifyKitModule,
|
|
44
|
+
platform?: PlatformInfo,
|
|
45
|
+
): NotifyKitPlatform {
|
|
46
|
+
const os = platform?.os ?? detectPlatform().os;
|
|
47
|
+
if (os !== 'android') {
|
|
48
|
+
return createIosPlatform();
|
|
49
|
+
}
|
|
50
|
+
return createAndroidPlatform({
|
|
51
|
+
engine,
|
|
52
|
+
// Read when asked rather than once, so it follows the device (and a test).
|
|
53
|
+
apiLevel: () => (platform ? platform.apiLevel : detectPlatform().apiLevel),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* iOS: no channels, no exact-alarm gate, a hard ceiling of 64 pending
|
|
3
|
+
* notifications. Categories are declared per request rather than up front.
|
|
4
|
+
*/
|
|
5
|
+
import { toPermissionState } from '../events';
|
|
6
|
+
import { BACKGROUND_WINDOW_MS } from '../module';
|
|
7
|
+
import type { NotifyKitPlatform } from './types';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* iOS keeps only the 64 soonest pending notifications and silently discards the
|
|
11
|
+
* rest. This number is the entire reason truncation must be computed and
|
|
12
|
+
* reported by the package rather than left to the platform.
|
|
13
|
+
*/
|
|
14
|
+
const IOS_PENDING_CEILING = 64;
|
|
15
|
+
|
|
16
|
+
export function createIosPlatform(): NotifyKitPlatform {
|
|
17
|
+
return {
|
|
18
|
+
capabilities: () => ({
|
|
19
|
+
pendingCeiling: IOS_PENDING_CEILING,
|
|
20
|
+
supportsExactAlarms: false,
|
|
21
|
+
supportsChannels: false,
|
|
22
|
+
supportsTextInputActions: true,
|
|
23
|
+
supportsDoNotDisturbBypass: false,
|
|
24
|
+
// iOS exposes no looping-sound API. The one alert level that overrides the
|
|
25
|
+
// mute switch is entitlement-gated by Apple, and does not loop either — so
|
|
26
|
+
// there is nothing to partially support, and a partial emulation would be
|
|
27
|
+
// worse than an honest refusal.
|
|
28
|
+
supportsRepeatingAlert: false,
|
|
29
|
+
backgroundWindowMs: BACKGROUND_WINDOW_MS,
|
|
30
|
+
}),
|
|
31
|
+
|
|
32
|
+
// No marker is ever placed where alerts cannot repeat.
|
|
33
|
+
async ensureMarkerChannel() {},
|
|
34
|
+
|
|
35
|
+
withChannelSnapshot: work => work(),
|
|
36
|
+
// Categories are declared at request time rather than up front.
|
|
37
|
+
declareTone: async () => 'unchanged',
|
|
38
|
+
retireTone: async () => false,
|
|
39
|
+
async declareGroups() {},
|
|
40
|
+
listDeclaredChannels: async () => [],
|
|
41
|
+
|
|
42
|
+
permissionFrom: (kind, settings) =>
|
|
43
|
+
// Exact alarms are an Android concept: "not required", not "denied".
|
|
44
|
+
kind === 'display' ? toPermissionState(settings.authorizationStatus) : 'notRequired',
|
|
45
|
+
|
|
46
|
+
gatesExactAlarms: () => false,
|
|
47
|
+
|
|
48
|
+
restrictions: async now => ({
|
|
49
|
+
batteryOptimization: 'unrestricted',
|
|
50
|
+
autoStart: 'unrestricted',
|
|
51
|
+
readAt: now(),
|
|
52
|
+
}),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What differs between Android and iOS in the notify-kit engine (NOT-18, IOS-08).
|
|
3
|
+
*
|
|
4
|
+
* The engine picks one implementation when it is created and never branches on
|
|
5
|
+
* the OS again. Changing iOS behaviour touches `ios.ts` only, and the Android
|
|
6
|
+
* file that runs in production stays as it is.
|
|
7
|
+
*/
|
|
8
|
+
import type { ChannelGroup, ResolvedTone } from '../../../contract/channel';
|
|
9
|
+
import type {
|
|
10
|
+
PermissionKind,
|
|
11
|
+
PermissionState,
|
|
12
|
+
RestrictionReport,
|
|
13
|
+
} from '../../../contract/permission';
|
|
14
|
+
import type { EngineCapabilities, ToneDeclarationOutcome } from '../../adapter';
|
|
15
|
+
import type { NotifyKitModule } from '../module';
|
|
16
|
+
|
|
17
|
+
export interface NotifyKitPlatform {
|
|
18
|
+
capabilities(): EngineCapabilities;
|
|
19
|
+
/** Creates the channel stop markers are posted on, the first time one is needed. */
|
|
20
|
+
ensureMarkerChannel(): Promise<void>;
|
|
21
|
+
|
|
22
|
+
withChannelSnapshot<T>(work: () => Promise<T>): Promise<T>;
|
|
23
|
+
declareTone(tone: ResolvedTone): Promise<ToneDeclarationOutcome>;
|
|
24
|
+
retireTone(channelId: string): Promise<boolean>;
|
|
25
|
+
declareGroups(groups: readonly ChannelGroup[]): Promise<void>;
|
|
26
|
+
listDeclaredChannels(): Promise<readonly string[]>;
|
|
27
|
+
|
|
28
|
+
/** The state of `kind`, from the engine's settings as just read. */
|
|
29
|
+
permissionFrom(kind: PermissionKind, settings: Record<string, unknown>): PermissionState;
|
|
30
|
+
/** Whether exact alarms are a capability the user grants here. */
|
|
31
|
+
gatesExactAlarms(): boolean;
|
|
32
|
+
restrictions(now: () => number): Promise<RestrictionReport>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface PlatformContext {
|
|
36
|
+
/** The engine module, resolved lazily. */
|
|
37
|
+
readonly engine: () => NotifyKitModule;
|
|
38
|
+
/** Android API level, read when asked; undefined elsewhere or when unknown. */
|
|
39
|
+
readonly apiLevel: () => number | undefined;
|
|
40
|
+
}
|