@dubsdotapp/expo 0.2.64 → 0.2.66
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 +53 -38
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +20 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/usePushNotifications.ts +6 -1
- package/src/provider.tsx +14 -4
- package/src/ui/AuthGate.tsx +4 -4
- package/src/ui/UserProfileSheet.tsx +29 -27
package/dist/index.mjs
CHANGED
|
@@ -2314,7 +2314,7 @@ function useUFCFighterDetail(athleteId) {
|
|
|
2314
2314
|
import { useState as useState14, useCallback as useCallback13, useRef as useRef3, useMemo, useEffect as useEffect9 } from "react";
|
|
2315
2315
|
import { Platform as Platform3 } from "react-native";
|
|
2316
2316
|
function usePushNotifications() {
|
|
2317
|
-
const { client, appName } = useDubs();
|
|
2317
|
+
const { client, appName, pushEnabled } = useDubs();
|
|
2318
2318
|
const channelId = useMemo(() => appName.toLowerCase().replace(/[^a-z0-9-]/g, ""), [appName]);
|
|
2319
2319
|
const [hasPermission, setHasPermission] = useState14(false);
|
|
2320
2320
|
const [expoPushToken, setExpoPushToken] = useState14(null);
|
|
@@ -2355,6 +2355,7 @@ function usePushNotifications() {
|
|
|
2355
2355
|
});
|
|
2356
2356
|
}, [client, getDeviceName]);
|
|
2357
2357
|
const register = useCallback13(async () => {
|
|
2358
|
+
if (!pushEnabled) return false;
|
|
2358
2359
|
if (registering.current) return false;
|
|
2359
2360
|
registering.current = true;
|
|
2360
2361
|
setLoading(true);
|
|
@@ -2406,6 +2407,7 @@ function usePushNotifications() {
|
|
|
2406
2407
|
}
|
|
2407
2408
|
}, [client, expoPushToken]);
|
|
2408
2409
|
const restoreIfGranted = useCallback13(async () => {
|
|
2410
|
+
if (!pushEnabled) return;
|
|
2409
2411
|
try {
|
|
2410
2412
|
const Notifications = getNotificationsModule();
|
|
2411
2413
|
if (!Notifications) return;
|
|
@@ -2431,6 +2433,7 @@ function usePushNotifications() {
|
|
|
2431
2433
|
restoreIfGranted();
|
|
2432
2434
|
}, []);
|
|
2433
2435
|
return {
|
|
2436
|
+
enabled: pushEnabled,
|
|
2434
2437
|
hasPermission,
|
|
2435
2438
|
expoPushToken,
|
|
2436
2439
|
loading,
|
|
@@ -2467,7 +2470,7 @@ function AuthGate({
|
|
|
2467
2470
|
appName = "Dubs",
|
|
2468
2471
|
accentColor
|
|
2469
2472
|
}) {
|
|
2470
|
-
const { client } = useDubs();
|
|
2473
|
+
const { client, pushEnabled } = useDubs();
|
|
2471
2474
|
const auth = useAuth();
|
|
2472
2475
|
const [phase, setPhase] = useState15("init");
|
|
2473
2476
|
const [registrationPhase, setRegistrationPhase] = useState15(false);
|
|
@@ -2504,10 +2507,10 @@ function AuthGate({
|
|
|
2504
2507
|
if (auth.status === "needsRegistration") setRegistrationPhase(true);
|
|
2505
2508
|
}, [auth.status]);
|
|
2506
2509
|
useEffect10(() => {
|
|
2507
|
-
if (auth.status === "authenticated" && registrationPhase && !isRestoredSession) {
|
|
2510
|
+
if (pushEnabled && auth.status === "authenticated" && registrationPhase && !isRestoredSession) {
|
|
2508
2511
|
setShowPushSetup(true);
|
|
2509
2512
|
}
|
|
2510
|
-
}, [auth.status, registrationPhase, isRestoredSession]);
|
|
2513
|
+
}, [pushEnabled, auth.status, registrationPhase, isRestoredSession]);
|
|
2511
2514
|
useEffect10(() => {
|
|
2512
2515
|
if (auth.token) onSaveToken(auth.token);
|
|
2513
2516
|
}, [auth.token]);
|
|
@@ -2538,7 +2541,7 @@ function AuthGate({
|
|
|
2538
2541
|
);
|
|
2539
2542
|
}
|
|
2540
2543
|
return /* @__PURE__ */ jsxs2(AuthContext.Provider, { value: auth, children: [
|
|
2541
|
-
/* @__PURE__ */ jsx3(PushTokenRestorer, {}),
|
|
2544
|
+
pushEnabled && /* @__PURE__ */ jsx3(PushTokenRestorer, {}),
|
|
2542
2545
|
children
|
|
2543
2546
|
] });
|
|
2544
2547
|
}
|
|
@@ -3073,7 +3076,8 @@ function DubsProvider({
|
|
|
3073
3076
|
renderRegistration,
|
|
3074
3077
|
managed = true,
|
|
3075
3078
|
redirectUri,
|
|
3076
|
-
appUrl
|
|
3079
|
+
appUrl,
|
|
3080
|
+
pushEnabled = true
|
|
3077
3081
|
}) {
|
|
3078
3082
|
const config = NETWORK_CONFIG[network];
|
|
3079
3083
|
const baseUrl = baseUrlOverride || config.baseUrl;
|
|
@@ -3113,6 +3117,7 @@ function DubsProvider({
|
|
|
3113
3117
|
renderRegistration,
|
|
3114
3118
|
accentColor: uiConfig.accentColor,
|
|
3115
3119
|
uiConfig,
|
|
3120
|
+
pushEnabled,
|
|
3116
3121
|
children
|
|
3117
3122
|
}
|
|
3118
3123
|
) });
|
|
@@ -3143,6 +3148,7 @@ function DubsProvider({
|
|
|
3143
3148
|
renderRegistration,
|
|
3144
3149
|
accentColor: uiConfig.accentColor,
|
|
3145
3150
|
uiConfig,
|
|
3151
|
+
pushEnabled,
|
|
3146
3152
|
children
|
|
3147
3153
|
}
|
|
3148
3154
|
)
|
|
@@ -3161,6 +3167,7 @@ function ManagedInner({
|
|
|
3161
3167
|
renderRegistration,
|
|
3162
3168
|
accentColor,
|
|
3163
3169
|
uiConfig,
|
|
3170
|
+
pushEnabled,
|
|
3164
3171
|
children
|
|
3165
3172
|
}) {
|
|
3166
3173
|
const managedDisconnect = useDisconnect();
|
|
@@ -3169,8 +3176,8 @@ function ManagedInner({
|
|
|
3169
3176
|
await managedDisconnect?.();
|
|
3170
3177
|
}, [client, managedDisconnect]);
|
|
3171
3178
|
const value = useMemo2(
|
|
3172
|
-
() => ({ client, wallet, connection, appName, network, disconnect, uiConfig }),
|
|
3173
|
-
[client, wallet, connection, appName, network, disconnect, uiConfig]
|
|
3179
|
+
() => ({ client, wallet, connection, appName, network, disconnect, uiConfig, pushEnabled }),
|
|
3180
|
+
[client, wallet, connection, appName, network, disconnect, uiConfig, pushEnabled]
|
|
3174
3181
|
);
|
|
3175
3182
|
return /* @__PURE__ */ jsx4(DubsContext.Provider, { value, children: /* @__PURE__ */ jsx4(
|
|
3176
3183
|
AuthGate,
|
|
@@ -3202,6 +3209,7 @@ function ExternalWalletProvider({
|
|
|
3202
3209
|
renderRegistration,
|
|
3203
3210
|
accentColor,
|
|
3204
3211
|
uiConfig,
|
|
3212
|
+
pushEnabled,
|
|
3205
3213
|
children
|
|
3206
3214
|
}) {
|
|
3207
3215
|
const disconnect = useCallback15(async () => {
|
|
@@ -3211,8 +3219,8 @@ function ExternalWalletProvider({
|
|
|
3211
3219
|
await wallet.disconnect?.();
|
|
3212
3220
|
}, [client, storage, wallet]);
|
|
3213
3221
|
const value = useMemo2(
|
|
3214
|
-
() => ({ client, wallet, connection, appName, network, disconnect, uiConfig }),
|
|
3215
|
-
[client, wallet, connection, appName, network, disconnect, uiConfig]
|
|
3222
|
+
() => ({ client, wallet, connection, appName, network, disconnect, uiConfig, pushEnabled }),
|
|
3223
|
+
[client, wallet, connection, appName, network, disconnect, uiConfig, pushEnabled]
|
|
3216
3224
|
);
|
|
3217
3225
|
if (!managed) {
|
|
3218
3226
|
return /* @__PURE__ */ jsx4(DubsContext.Provider, { value, children });
|
|
@@ -3666,7 +3674,7 @@ function UserProfileSheet({
|
|
|
3666
3674
|
)
|
|
3667
3675
|
] }),
|
|
3668
3676
|
error ? /* @__PURE__ */ jsx7(View5, { style: [styles4.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ jsx7(Text5, { style: [styles4.errorText, { color: t.errorText }], children: error }) }) : null,
|
|
3669
|
-
/* @__PURE__ */ jsxs5(View5, { style: [styles4.notifRow, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
3677
|
+
push.enabled && /* @__PURE__ */ jsxs5(View5, { style: [styles4.notifRow, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
3670
3678
|
/* @__PURE__ */ jsxs5(View5, { style: styles4.notifLeft, children: [
|
|
3671
3679
|
/* @__PURE__ */ jsx7(Text5, { style: [styles4.notifLabel, { color: t.text }], children: "Push Notifications" }),
|
|
3672
3680
|
/* @__PURE__ */ jsx7(
|
|
@@ -3691,7 +3699,7 @@ function UserProfileSheet({
|
|
|
3691
3699
|
}
|
|
3692
3700
|
)
|
|
3693
3701
|
] }),
|
|
3694
|
-
push.error ? /* @__PURE__ */ jsx7(View5, { style: [styles4.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ jsx7(Text5, { style: [styles4.errorText, { color: t.errorText }], children: push.error.message }) }) : null,
|
|
3702
|
+
push.enabled && push.error ? /* @__PURE__ */ jsx7(View5, { style: [styles4.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ jsx7(Text5, { style: [styles4.errorText, { color: t.errorText }], children: push.error.message }) }) : null,
|
|
3695
3703
|
onDisconnect ? /* @__PURE__ */ jsx7(
|
|
3696
3704
|
TouchableOpacity4,
|
|
3697
3705
|
{
|