@dubsdotapp/expo 0.5.20 → 0.5.22
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/app.plugin.js +26 -29
- package/dist/index.d.mts +21 -3
- package/dist/index.d.ts +21 -3
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/usePushNotifications.ts +22 -3
package/package.json
CHANGED
|
@@ -3,11 +3,29 @@ import { Platform } from 'react-native';
|
|
|
3
3
|
import { useDubs } from '../provider';
|
|
4
4
|
|
|
5
5
|
export interface PushNotificationStatus {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Whether push is currently delivering to this user — the right signal for
|
|
8
|
+
* UI bindings like a "Notifications: Enabled/Disabled" toggle.
|
|
9
|
+
*
|
|
10
|
+
* Equivalent to `enabled && !!pushToken`. Goes false after `unregister()`
|
|
11
|
+
* even though OS permission is still granted. Goes true after `register()`
|
|
12
|
+
* succeeds.
|
|
13
|
+
*
|
|
14
|
+
* Use this — NOT `hasPermission` — when binding switches/toggles.
|
|
15
|
+
*/
|
|
16
|
+
isActive: boolean;
|
|
17
|
+
/** Whether push notifications are enabled in the SDK configuration (the `pushEnabled` prop on DubsProvider). */
|
|
7
18
|
enabled: boolean;
|
|
8
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Whether OS-level notification permission has been granted on this device.
|
|
21
|
+
*
|
|
22
|
+
* Note: this stays true after `unregister()` because the OS doesn't revoke
|
|
23
|
+
* permission when a server token is dropped. Useful for permission-flow
|
|
24
|
+
* prompts (e.g. "Re-enable in Settings" hint), but NOT for "is push on" UI —
|
|
25
|
+
* use `isActive` for that.
|
|
26
|
+
*/
|
|
9
27
|
hasPermission: boolean;
|
|
10
|
-
/** The push token (
|
|
28
|
+
/** The native device push token (FCM/APNs), if currently registered with the server. */
|
|
11
29
|
pushToken: string | null;
|
|
12
30
|
/**
|
|
13
31
|
* @deprecated Use pushToken instead. Kept for backwards compatibility.
|
|
@@ -188,6 +206,7 @@ export function usePushNotifications(): PushNotificationStatus {
|
|
|
188
206
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
189
207
|
|
|
190
208
|
return {
|
|
209
|
+
isActive: pushEnabled && !!pushToken,
|
|
191
210
|
enabled: pushEnabled,
|
|
192
211
|
hasPermission,
|
|
193
212
|
pushToken,
|