@dubsdotapp/expo 0.2.59 → 0.2.61
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.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/usePushNotifications.ts +14 -6
- package/src/ui/UserProfileSheet.tsx +7 -0
package/dist/index.js
CHANGED
|
@@ -2462,16 +2462,23 @@ function usePushNotifications() {
|
|
|
2462
2462
|
if (!Notifications) return;
|
|
2463
2463
|
const { status } = await Notifications.getPermissionsAsync();
|
|
2464
2464
|
if (status !== "granted") return;
|
|
2465
|
-
setHasPermission(true);
|
|
2466
2465
|
const tokenResult = await Notifications.getExpoPushTokenAsync();
|
|
2467
2466
|
const token = tokenResult.data;
|
|
2468
|
-
setExpoPushToken(token);
|
|
2469
2467
|
await registerTokenWithServer(token);
|
|
2468
|
+
setExpoPushToken(token);
|
|
2469
|
+
setHasPermission(true);
|
|
2470
2470
|
setupAndroidChannels(Notifications);
|
|
2471
2471
|
} catch (err) {
|
|
2472
|
+
setHasPermission(false);
|
|
2472
2473
|
console.log("[usePushNotifications] Restore skipped:", err instanceof Error ? err.message : err);
|
|
2473
2474
|
}
|
|
2474
2475
|
}, [getNotificationsModule, registerTokenWithServer, setupAndroidChannels]);
|
|
2476
|
+
const didMount = (0, import_react16.useRef)(false);
|
|
2477
|
+
(0, import_react16.useEffect)(() => {
|
|
2478
|
+
if (didMount.current) return;
|
|
2479
|
+
didMount.current = true;
|
|
2480
|
+
restoreIfGranted();
|
|
2481
|
+
}, []);
|
|
2475
2482
|
return {
|
|
2476
2483
|
hasPermission,
|
|
2477
2484
|
expoPushToken,
|
|
@@ -3713,6 +3720,7 @@ function UserProfileSheet({
|
|
|
3713
3720
|
}
|
|
3714
3721
|
)
|
|
3715
3722
|
] }),
|
|
3723
|
+
push.error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native10.View, { style: [styles4.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native10.Text, { style: [styles4.errorText, { color: t.errorText }], children: push.error.message }) }) : null,
|
|
3716
3724
|
onDisconnect ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3717
3725
|
import_react_native10.TouchableOpacity,
|
|
3718
3726
|
{
|