@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.mjs
CHANGED
|
@@ -557,7 +557,7 @@ function createSecureStoreStorage() {
|
|
|
557
557
|
}
|
|
558
558
|
|
|
559
559
|
// src/provider.tsx
|
|
560
|
-
import { createContext as createContext4, useContext as useContext4, useMemo as useMemo2, useCallback as useCallback15, useState as useState16, useEffect as
|
|
560
|
+
import { createContext as createContext4, useContext as useContext4, useMemo as useMemo2, useCallback as useCallback15, useState as useState16, useEffect as useEffect11 } from "react";
|
|
561
561
|
|
|
562
562
|
// src/ui/theme.ts
|
|
563
563
|
import { createContext, useContext } from "react";
|
|
@@ -1622,7 +1622,7 @@ function ManagedWalletProvider({
|
|
|
1622
1622
|
}
|
|
1623
1623
|
|
|
1624
1624
|
// src/ui/AuthGate.tsx
|
|
1625
|
-
import React2, { useState as useState15, useEffect as
|
|
1625
|
+
import React2, { useState as useState15, useEffect as useEffect10, useRef as useRef4, useCallback as useCallback14 } from "react";
|
|
1626
1626
|
import {
|
|
1627
1627
|
View as View2,
|
|
1628
1628
|
Text as Text2,
|
|
@@ -2310,7 +2310,7 @@ function useUFCFighterDetail(athleteId) {
|
|
|
2310
2310
|
}
|
|
2311
2311
|
|
|
2312
2312
|
// src/hooks/usePushNotifications.ts
|
|
2313
|
-
import { useState as useState14, useCallback as useCallback13, useRef as useRef3, useMemo } from "react";
|
|
2313
|
+
import { useState as useState14, useCallback as useCallback13, useRef as useRef3, useMemo, useEffect as useEffect9 } from "react";
|
|
2314
2314
|
import { Platform as Platform3 } from "react-native";
|
|
2315
2315
|
function usePushNotifications() {
|
|
2316
2316
|
const { client, appName } = useDubs();
|
|
@@ -2408,16 +2408,23 @@ function usePushNotifications() {
|
|
|
2408
2408
|
if (!Notifications) return;
|
|
2409
2409
|
const { status } = await Notifications.getPermissionsAsync();
|
|
2410
2410
|
if (status !== "granted") return;
|
|
2411
|
-
setHasPermission(true);
|
|
2412
2411
|
const tokenResult = await Notifications.getExpoPushTokenAsync();
|
|
2413
2412
|
const token = tokenResult.data;
|
|
2414
|
-
setExpoPushToken(token);
|
|
2415
2413
|
await registerTokenWithServer(token);
|
|
2414
|
+
setExpoPushToken(token);
|
|
2415
|
+
setHasPermission(true);
|
|
2416
2416
|
setupAndroidChannels(Notifications);
|
|
2417
2417
|
} catch (err) {
|
|
2418
|
+
setHasPermission(false);
|
|
2418
2419
|
console.log("[usePushNotifications] Restore skipped:", err instanceof Error ? err.message : err);
|
|
2419
2420
|
}
|
|
2420
2421
|
}, [getNotificationsModule, registerTokenWithServer, setupAndroidChannels]);
|
|
2422
|
+
const didMount = useRef3(false);
|
|
2423
|
+
useEffect9(() => {
|
|
2424
|
+
if (didMount.current) return;
|
|
2425
|
+
didMount.current = true;
|
|
2426
|
+
restoreIfGranted();
|
|
2427
|
+
}, []);
|
|
2421
2428
|
return {
|
|
2422
2429
|
hasPermission,
|
|
2423
2430
|
expoPushToken,
|
|
@@ -2461,7 +2468,7 @@ function AuthGate({
|
|
|
2461
2468
|
const [registrationPhase, setRegistrationPhase] = useState15(false);
|
|
2462
2469
|
const [showPushSetup, setShowPushSetup] = useState15(false);
|
|
2463
2470
|
const [isRestoredSession, setIsRestoredSession] = useState15(false);
|
|
2464
|
-
|
|
2471
|
+
useEffect10(() => {
|
|
2465
2472
|
let cancelled = false;
|
|
2466
2473
|
(async () => {
|
|
2467
2474
|
try {
|
|
@@ -2488,15 +2495,15 @@ function AuthGate({
|
|
|
2488
2495
|
cancelled = true;
|
|
2489
2496
|
};
|
|
2490
2497
|
}, []);
|
|
2491
|
-
|
|
2498
|
+
useEffect10(() => {
|
|
2492
2499
|
if (auth.status === "needsRegistration") setRegistrationPhase(true);
|
|
2493
2500
|
}, [auth.status]);
|
|
2494
|
-
|
|
2501
|
+
useEffect10(() => {
|
|
2495
2502
|
if (auth.status === "authenticated" && registrationPhase && !isRestoredSession) {
|
|
2496
2503
|
setShowPushSetup(true);
|
|
2497
2504
|
}
|
|
2498
2505
|
}, [auth.status, registrationPhase, isRestoredSession]);
|
|
2499
|
-
|
|
2506
|
+
useEffect10(() => {
|
|
2500
2507
|
if (auth.token) onSaveToken(auth.token);
|
|
2501
2508
|
}, [auth.token]);
|
|
2502
2509
|
const retry = useCallback14(() => {
|
|
@@ -2632,7 +2639,7 @@ function DefaultRegistrationScreen({
|
|
|
2632
2639
|
const fadeAnim = useRef4(new Animated.Value(1)).current;
|
|
2633
2640
|
const slideAnim = useRef4(new Animated.Value(0)).current;
|
|
2634
2641
|
const avatarUrl = getAvatarUrl(avatarStyle, avatarSeed);
|
|
2635
|
-
|
|
2642
|
+
useEffect10(() => {
|
|
2636
2643
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
2637
2644
|
const trimmed = username.trim();
|
|
2638
2645
|
if (trimmed.length < 3) {
|
|
@@ -2892,7 +2899,7 @@ function DefaultRegistrationScreen({
|
|
|
2892
2899
|
function PushTokenRestorer() {
|
|
2893
2900
|
const push = usePushNotifications();
|
|
2894
2901
|
const restored = useRef4(false);
|
|
2895
|
-
|
|
2902
|
+
useEffect10(() => {
|
|
2896
2903
|
if (restored.current) return;
|
|
2897
2904
|
restored.current = true;
|
|
2898
2905
|
push.restoreIfGranted();
|
|
@@ -2909,7 +2916,7 @@ function PushSetupScreen({
|
|
|
2909
2916
|
const push = usePushNotifications();
|
|
2910
2917
|
const fadeAnim = useRef4(new Animated.Value(0)).current;
|
|
2911
2918
|
const slideAnim = useRef4(new Animated.Value(30)).current;
|
|
2912
|
-
|
|
2919
|
+
useEffect10(() => {
|
|
2913
2920
|
Animated.parallel([
|
|
2914
2921
|
Animated.timing(fadeAnim, { toValue: 1, duration: 300, useNativeDriver: true }),
|
|
2915
2922
|
Animated.timing(slideAnim, { toValue: 0, duration: 300, useNativeDriver: true })
|
|
@@ -3071,7 +3078,7 @@ function DubsProvider({
|
|
|
3071
3078
|
const connection = useMemo2(() => new Connection2(rpcUrl, { commitment: "confirmed" }), [rpcUrl]);
|
|
3072
3079
|
const storage = useMemo2(() => tokenStorage || createSecureStoreStorage(), [tokenStorage]);
|
|
3073
3080
|
const [uiConfig, setUiConfig] = useState16(null);
|
|
3074
|
-
|
|
3081
|
+
useEffect11(() => {
|
|
3075
3082
|
client.getAppConfig().then((config2) => {
|
|
3076
3083
|
console.log("[DubsProvider] UI config loaded:", JSON.stringify(config2));
|
|
3077
3084
|
setUiConfig(config2);
|
|
@@ -3455,7 +3462,7 @@ var styles3 = StyleSheet4.create({
|
|
|
3455
3462
|
});
|
|
3456
3463
|
|
|
3457
3464
|
// src/ui/UserProfileSheet.tsx
|
|
3458
|
-
import { useState as useState17, useEffect as
|
|
3465
|
+
import { useState as useState17, useEffect as useEffect12, useRef as useRef5, useCallback as useCallback16, useMemo as useMemo4 } from "react";
|
|
3459
3466
|
import {
|
|
3460
3467
|
View as View5,
|
|
3461
3468
|
Text as Text5,
|
|
@@ -3514,19 +3521,19 @@ function UserProfileSheet({
|
|
|
3514
3521
|
const [avatarSeed, setAvatarSeed] = useState17(parsed.seed);
|
|
3515
3522
|
const [saving, setSaving] = useState17(false);
|
|
3516
3523
|
const [error, setError] = useState17(null);
|
|
3517
|
-
|
|
3524
|
+
useEffect12(() => {
|
|
3518
3525
|
const p = parseAvatarUrl(user.avatar);
|
|
3519
3526
|
setAvatarStyle(p.style);
|
|
3520
3527
|
setAvatarSeed(p.seed);
|
|
3521
3528
|
}, [user.avatar]);
|
|
3522
|
-
|
|
3529
|
+
useEffect12(() => {
|
|
3523
3530
|
Animated2.timing(overlayOpacity, {
|
|
3524
3531
|
toValue: visible ? 1 : 0,
|
|
3525
3532
|
duration: 250,
|
|
3526
3533
|
useNativeDriver: true
|
|
3527
3534
|
}).start();
|
|
3528
3535
|
}, [visible, overlayOpacity]);
|
|
3529
|
-
|
|
3536
|
+
useEffect12(() => {
|
|
3530
3537
|
if (visible) setError(null);
|
|
3531
3538
|
}, [visible]);
|
|
3532
3539
|
const currentAvatarUrl = getAvatarUrl2(avatarStyle, avatarSeed);
|
|
@@ -3679,6 +3686,7 @@ function UserProfileSheet({
|
|
|
3679
3686
|
}
|
|
3680
3687
|
)
|
|
3681
3688
|
] }),
|
|
3689
|
+
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,
|
|
3682
3690
|
onDisconnect ? /* @__PURE__ */ jsx7(
|
|
3683
3691
|
TouchableOpacity4,
|
|
3684
3692
|
{
|
|
@@ -4347,7 +4355,7 @@ var styles9 = StyleSheet10.create({
|
|
|
4347
4355
|
});
|
|
4348
4356
|
|
|
4349
4357
|
// src/ui/game/CreateCustomGameSheet.tsx
|
|
4350
|
-
import { useState as useState21, useEffect as
|
|
4358
|
+
import { useState as useState21, useEffect as useEffect13, useRef as useRef6, useCallback as useCallback17 } from "react";
|
|
4351
4359
|
import {
|
|
4352
4360
|
View as View11,
|
|
4353
4361
|
Text as Text11,
|
|
@@ -4388,14 +4396,14 @@ function CreateCustomGameSheet({
|
|
|
4388
4396
|
const [customAmount, setCustomAmount] = useState21("");
|
|
4389
4397
|
const [isCustom, setIsCustom] = useState21(false);
|
|
4390
4398
|
const overlayOpacity = useRef6(new Animated3.Value(0)).current;
|
|
4391
|
-
|
|
4399
|
+
useEffect13(() => {
|
|
4392
4400
|
Animated3.timing(overlayOpacity, {
|
|
4393
4401
|
toValue: visible ? 1 : 0,
|
|
4394
4402
|
duration: 250,
|
|
4395
4403
|
useNativeDriver: true
|
|
4396
4404
|
}).start();
|
|
4397
4405
|
}, [visible, overlayOpacity]);
|
|
4398
|
-
|
|
4406
|
+
useEffect13(() => {
|
|
4399
4407
|
if (visible) {
|
|
4400
4408
|
setSelectedAmount(defaultAmount ?? null);
|
|
4401
4409
|
setCustomAmount("");
|
|
@@ -4403,7 +4411,7 @@ function CreateCustomGameSheet({
|
|
|
4403
4411
|
mutation.reset();
|
|
4404
4412
|
}
|
|
4405
4413
|
}, [visible]);
|
|
4406
|
-
|
|
4414
|
+
useEffect13(() => {
|
|
4407
4415
|
if (mutation.status === "success" && mutation.data) {
|
|
4408
4416
|
onSuccess?.(mutation.data);
|
|
4409
4417
|
const timer = setTimeout(() => {
|
|
@@ -4412,7 +4420,7 @@ function CreateCustomGameSheet({
|
|
|
4412
4420
|
return () => clearTimeout(timer);
|
|
4413
4421
|
}
|
|
4414
4422
|
}, [mutation.status, mutation.data]);
|
|
4415
|
-
|
|
4423
|
+
useEffect13(() => {
|
|
4416
4424
|
if (mutation.status === "error" && mutation.error) {
|
|
4417
4425
|
onError?.(mutation.error);
|
|
4418
4426
|
}
|
|
@@ -4712,7 +4720,7 @@ var styles10 = StyleSheet11.create({
|
|
|
4712
4720
|
});
|
|
4713
4721
|
|
|
4714
4722
|
// src/ui/game/JoinGameSheet.tsx
|
|
4715
|
-
import { useState as useState22, useEffect as
|
|
4723
|
+
import { useState as useState22, useEffect as useEffect14, useRef as useRef7, useCallback as useCallback18, useMemo as useMemo8 } from "react";
|
|
4716
4724
|
import {
|
|
4717
4725
|
View as View12,
|
|
4718
4726
|
Text as Text12,
|
|
@@ -4750,20 +4758,20 @@ function JoinGameSheet({
|
|
|
4750
4758
|
const isCustomGame = game.gameMode === CUSTOM_GAME_MODE;
|
|
4751
4759
|
const [selectedTeam, setSelectedTeam] = useState22(null);
|
|
4752
4760
|
const overlayOpacity = useRef7(new Animated4.Value(0)).current;
|
|
4753
|
-
|
|
4761
|
+
useEffect14(() => {
|
|
4754
4762
|
Animated4.timing(overlayOpacity, {
|
|
4755
4763
|
toValue: visible ? 1 : 0,
|
|
4756
4764
|
duration: 250,
|
|
4757
4765
|
useNativeDriver: true
|
|
4758
4766
|
}).start();
|
|
4759
4767
|
}, [visible, overlayOpacity]);
|
|
4760
|
-
|
|
4768
|
+
useEffect14(() => {
|
|
4761
4769
|
if (visible) {
|
|
4762
4770
|
setSelectedTeam(isPoolModeEnabled ? "home" : isCustomGame ? "away" : null);
|
|
4763
4771
|
mutation.reset();
|
|
4764
4772
|
}
|
|
4765
4773
|
}, [visible]);
|
|
4766
|
-
|
|
4774
|
+
useEffect14(() => {
|
|
4767
4775
|
if (mutation.status === "success" && mutation.data) {
|
|
4768
4776
|
onSuccess?.(mutation.data);
|
|
4769
4777
|
const timer = setTimeout(() => {
|
|
@@ -4772,7 +4780,7 @@ function JoinGameSheet({
|
|
|
4772
4780
|
return () => clearTimeout(timer);
|
|
4773
4781
|
}
|
|
4774
4782
|
}, [mutation.status, mutation.data]);
|
|
4775
|
-
|
|
4783
|
+
useEffect14(() => {
|
|
4776
4784
|
if (mutation.status === "error" && mutation.error) {
|
|
4777
4785
|
onError?.(mutation.error);
|
|
4778
4786
|
}
|
|
@@ -5123,7 +5131,7 @@ var styles11 = StyleSheet12.create({
|
|
|
5123
5131
|
});
|
|
5124
5132
|
|
|
5125
5133
|
// src/ui/game/ClaimPrizeSheet.tsx
|
|
5126
|
-
import { useState as useState23, useEffect as
|
|
5134
|
+
import { useState as useState23, useEffect as useEffect15, useRef as useRef8, useCallback as useCallback19 } from "react";
|
|
5127
5135
|
import {
|
|
5128
5136
|
View as View13,
|
|
5129
5137
|
Text as Text13,
|
|
@@ -5158,14 +5166,14 @@ function ClaimPrizeSheet({
|
|
|
5158
5166
|
const celebrationScale = useRef8(new Animated5.Value(0)).current;
|
|
5159
5167
|
const celebrationOpacity = useRef8(new Animated5.Value(0)).current;
|
|
5160
5168
|
const [showCelebration, setShowCelebration] = useState23(false);
|
|
5161
|
-
|
|
5169
|
+
useEffect15(() => {
|
|
5162
5170
|
Animated5.timing(overlayOpacity, {
|
|
5163
5171
|
toValue: visible ? 1 : 0,
|
|
5164
5172
|
duration: 250,
|
|
5165
5173
|
useNativeDriver: true
|
|
5166
5174
|
}).start();
|
|
5167
5175
|
}, [visible, overlayOpacity]);
|
|
5168
|
-
|
|
5176
|
+
useEffect15(() => {
|
|
5169
5177
|
if (visible) {
|
|
5170
5178
|
mutation.reset();
|
|
5171
5179
|
setShowCelebration(false);
|
|
@@ -5173,7 +5181,7 @@ function ClaimPrizeSheet({
|
|
|
5173
5181
|
celebrationOpacity.setValue(0);
|
|
5174
5182
|
}
|
|
5175
5183
|
}, [visible]);
|
|
5176
|
-
|
|
5184
|
+
useEffect15(() => {
|
|
5177
5185
|
if (mutation.status === "success" && mutation.data) {
|
|
5178
5186
|
setShowCelebration(true);
|
|
5179
5187
|
Animated5.parallel([
|
|
@@ -5196,7 +5204,7 @@ function ClaimPrizeSheet({
|
|
|
5196
5204
|
return () => clearTimeout(timer);
|
|
5197
5205
|
}
|
|
5198
5206
|
}, [mutation.status, mutation.data]);
|
|
5199
|
-
|
|
5207
|
+
useEffect15(() => {
|
|
5200
5208
|
if (mutation.status === "error" && mutation.error) {
|
|
5201
5209
|
onError?.(mutation.error);
|
|
5202
5210
|
}
|