@dubsdotapp/expo 0.2.66 → 0.2.68

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/dist/index.d.mts CHANGED
@@ -902,7 +902,11 @@ interface PushNotificationStatus {
902
902
  enabled: boolean;
903
903
  /** Whether notification permission has been granted */
904
904
  hasPermission: boolean;
905
- /** The Expo push token, if registered */
905
+ /** The push token (native FCM/APNs), if registered */
906
+ pushToken: string | null;
907
+ /**
908
+ * @deprecated Use pushToken instead. Kept for backwards compatibility.
909
+ */
906
910
  expoPushToken: string | null;
907
911
  /** Whether a registration operation is in progress */
908
912
  loading: boolean;
package/dist/index.d.ts CHANGED
@@ -902,7 +902,11 @@ interface PushNotificationStatus {
902
902
  enabled: boolean;
903
903
  /** Whether notification permission has been granted */
904
904
  hasPermission: boolean;
905
- /** The Expo push token, if registered */
905
+ /** The push token (native FCM/APNs), if registered */
906
+ pushToken: string | null;
907
+ /**
908
+ * @deprecated Use pushToken instead. Kept for backwards compatibility.
909
+ */
906
910
  expoPushToken: string | null;
907
911
  /** Whether a registration operation is in progress */
908
912
  loading: boolean;
package/dist/index.js CHANGED
@@ -95,7 +95,6 @@ if (typeof self === "undefined" && typeof globalThis !== "undefined") {
95
95
 
96
96
  // src/constants.ts
97
97
  var DEFAULT_BASE_URL = "https://dubs-server-prod-9c91d3f01199.herokuapp.com/api/developer/v1";
98
- var DUBS_EXPO_PROJECT_ID = "aaca4fc9-64be-46b2-9be2-4175cb0f59a2";
99
98
  var DEFAULT_RPC_URL = "https://api.mainnet-beta.solana.com";
100
99
  var NETWORK_CONFIG = {
101
100
  "mainnet-beta": {
@@ -2371,7 +2370,7 @@ function usePushNotifications() {
2371
2370
  const { client, appName, pushEnabled } = useDubs();
2372
2371
  const channelId = (0, import_react16.useMemo)(() => appName.toLowerCase().replace(/[^a-z0-9-]/g, ""), [appName]);
2373
2372
  const [hasPermission, setHasPermission] = (0, import_react16.useState)(false);
2374
- const [expoPushToken, setExpoPushToken] = (0, import_react16.useState)(null);
2373
+ const [pushToken, setPushToken] = (0, import_react16.useState)(null);
2375
2374
  const [loading, setLoading] = (0, import_react16.useState)(false);
2376
2375
  const [error, setError] = (0, import_react16.useState)(null);
2377
2376
  const registering = (0, import_react16.useRef)(false);
@@ -2432,11 +2431,9 @@ function usePushNotifications() {
2432
2431
  return false;
2433
2432
  }
2434
2433
  setHasPermission(true);
2435
- const tokenResult = await Notifications.getExpoPushTokenAsync({
2436
- projectId: DUBS_EXPO_PROJECT_ID
2437
- });
2434
+ const tokenResult = await Notifications.getDevicePushTokenAsync();
2438
2435
  const token = tokenResult.data;
2439
- setExpoPushToken(token);
2436
+ setPushToken(token);
2440
2437
  await registerTokenWithServer(token);
2441
2438
  setupAndroidChannels(Notifications);
2442
2439
  setLoading(false);
@@ -2452,14 +2449,14 @@ function usePushNotifications() {
2452
2449
  }
2453
2450
  }, [getNotificationsModule, registerTokenWithServer, setupAndroidChannels]);
2454
2451
  const unregister = (0, import_react16.useCallback)(async () => {
2455
- if (!expoPushToken) return;
2452
+ if (!pushToken) return;
2456
2453
  try {
2457
- await client.unregisterPushToken(expoPushToken);
2458
- setExpoPushToken(null);
2454
+ await client.unregisterPushToken(pushToken);
2455
+ setPushToken(null);
2459
2456
  } catch (err) {
2460
2457
  console.error("[usePushNotifications] Unregister error:", err);
2461
2458
  }
2462
- }, [client, expoPushToken]);
2459
+ }, [client, pushToken]);
2463
2460
  const restoreIfGranted = (0, import_react16.useCallback)(async () => {
2464
2461
  if (!pushEnabled) return;
2465
2462
  try {
@@ -2467,12 +2464,10 @@ function usePushNotifications() {
2467
2464
  if (!Notifications) return;
2468
2465
  const { status } = await Notifications.getPermissionsAsync();
2469
2466
  if (status !== "granted") return;
2470
- const tokenResult = await Notifications.getExpoPushTokenAsync({
2471
- projectId: DUBS_EXPO_PROJECT_ID
2472
- });
2467
+ const tokenResult = await Notifications.getDevicePushTokenAsync();
2473
2468
  const token = tokenResult.data;
2474
2469
  await registerTokenWithServer(token);
2475
- setExpoPushToken(token);
2470
+ setPushToken(token);
2476
2471
  setHasPermission(true);
2477
2472
  setupAndroidChannels(Notifications);
2478
2473
  } catch (err) {
@@ -2484,12 +2479,24 @@ function usePushNotifications() {
2484
2479
  (0, import_react16.useEffect)(() => {
2485
2480
  if (didMount.current) return;
2486
2481
  didMount.current = true;
2482
+ const Notifications = getNotificationsModule();
2483
+ if (Notifications) {
2484
+ Notifications.setNotificationHandler({
2485
+ handleNotification: async () => ({
2486
+ shouldShowAlert: true,
2487
+ shouldPlaySound: true,
2488
+ shouldSetBadge: false
2489
+ })
2490
+ });
2491
+ }
2487
2492
  restoreIfGranted();
2488
2493
  }, []);
2489
2494
  return {
2490
2495
  enabled: pushEnabled,
2491
2496
  hasPermission,
2492
- expoPushToken,
2497
+ pushToken,
2498
+ expoPushToken: pushToken,
2499
+ // backwards compat
2493
2500
  loading,
2494
2501
  error,
2495
2502
  register,