@dubsdotapp/expo 0.5.18 → 0.5.20

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.mjs CHANGED
@@ -3356,7 +3356,7 @@ function AuthGate({
3356
3356
  appName = "Dubs",
3357
3357
  accentColor
3358
3358
  }) {
3359
- const { client, pushEnabled } = useDubs();
3359
+ const { client, pushEnabled, uiConfig } = useDubs();
3360
3360
  const auth = useAuth();
3361
3361
  const [phase, setPhase] = useState26("init");
3362
3362
  const [registrationPhase, setRegistrationPhase] = useState26(false);
@@ -3393,10 +3393,10 @@ function AuthGate({
3393
3393
  if (auth.status === "needsRegistration") setRegistrationPhase(true);
3394
3394
  }, [auth.status]);
3395
3395
  useEffect17(() => {
3396
- if (pushEnabled && auth.status === "authenticated" && registrationPhase && !isRestoredSession) {
3396
+ if (pushEnabled && uiConfig.pushConfigured?.android && auth.status === "authenticated" && registrationPhase && !isRestoredSession) {
3397
3397
  setShowPushSetup(true);
3398
3398
  }
3399
- }, [pushEnabled, auth.status, registrationPhase, isRestoredSession]);
3399
+ }, [pushEnabled, uiConfig.pushConfigured?.android, auth.status, registrationPhase, isRestoredSession]);
3400
3400
  useEffect17(() => {
3401
3401
  if (auth.token) onSaveToken(auth.token);
3402
3402
  }, [auth.token]);
@@ -3415,23 +3415,14 @@ function AuthGate({
3415
3415
  if (renderLoading) return /* @__PURE__ */ jsx4(Fragment2, { children: renderLoading("authenticating") });
3416
3416
  return /* @__PURE__ */ jsx4(DefaultLoadingScreen, { status: "authenticating", appName, accentColor });
3417
3417
  }
3418
- if (auth.status === "authenticated") {
3419
- if (showPushSetup) {
3420
- return /* @__PURE__ */ jsx4(
3421
- PushSetupScreen,
3422
- {
3423
- accentColor,
3424
- appName,
3425
- onComplete: () => setShowPushSetup(false)
3426
- }
3427
- );
3428
- }
3418
+ const inRegistrationFlow = registrationPhase && (auth.status === "needsRegistration" || auth.status === "registering" || auth.status === "authenticated" && showPushSetup);
3419
+ if (auth.status === "authenticated" && !inRegistrationFlow) {
3429
3420
  return /* @__PURE__ */ jsxs3(AuthContext.Provider, { value: auth, children: [
3430
3421
  pushEnabled && /* @__PURE__ */ jsx4(PushTokenRestorer, {}),
3431
3422
  children
3432
3423
  ] });
3433
3424
  }
3434
- if (registrationPhase) {
3425
+ if (inRegistrationFlow) {
3435
3426
  const isRegistering = auth.status === "registering";
3436
3427
  const regError = auth.status === "error" ? auth.error : null;
3437
3428
  if (renderRegistration) {
@@ -3445,7 +3436,9 @@ function AuthGate({
3445
3436
  error: regError,
3446
3437
  client,
3447
3438
  appName,
3448
- accentColor
3439
+ accentColor,
3440
+ pushStepActive: showPushSetup,
3441
+ onPushComplete: () => setShowPushSetup(false)
3449
3442
  }
3450
3443
  );
3451
3444
  }
@@ -3525,10 +3518,13 @@ function DefaultRegistrationScreen({
3525
3518
  error,
3526
3519
  client,
3527
3520
  appName,
3528
- accentColor
3521
+ accentColor,
3522
+ pushStepActive,
3523
+ onPushComplete
3529
3524
  }) {
3530
3525
  const t = useDubsTheme();
3531
3526
  const accent = accentColor || t.accent;
3527
+ const push = usePushNotifications();
3532
3528
  const [step, setStep] = useState26(0);
3533
3529
  const [avatarSeed, setAvatarSeed] = useState26(generateSeed);
3534
3530
  const [avatarStyle, setAvatarStyle] = useState26("adventurer");
@@ -3764,6 +3760,58 @@ function DefaultRegistrationScreen({
3764
3760
  )
3765
3761
  ] })
3766
3762
  ] });
3763
+ useEffect17(() => {
3764
+ if (pushStepActive && step !== 3) {
3765
+ animateToStep(3);
3766
+ }
3767
+ }, [pushStepActive]);
3768
+ const handleEnablePush = async () => {
3769
+ try {
3770
+ await push.register();
3771
+ } catch {
3772
+ }
3773
+ onPushComplete?.();
3774
+ };
3775
+ const renderPushStep = () => /* @__PURE__ */ jsxs3(View3, { style: s.stepContainer, children: [
3776
+ /* @__PURE__ */ jsxs3(View3, { style: s.stepTop, children: [
3777
+ /* @__PURE__ */ jsx4(Text3, { style: [s.title, { color: t.text }], children: "Enable Notifications" }),
3778
+ /* @__PURE__ */ jsx4(Text3, { style: [s.subtitle, { color: t.textMuted }], children: "Stay in the loop with real-time updates" }),
3779
+ /* @__PURE__ */ jsx4(StepIndicator, { currentStep: 3 }),
3780
+ /* @__PURE__ */ jsx4(View3, { style: pushStyles.iconContainer, children: /* @__PURE__ */ jsx4(View3, { style: [pushStyles.bellCircle, { backgroundColor: accent + "20" }], children: /* @__PURE__ */ jsx4(Text3, { style: [pushStyles.bellIcon, { color: accent }], children: "\u{1F514}" }) }) }),
3781
+ /* @__PURE__ */ jsxs3(View3, { style: pushStyles.benefitsList, children: [
3782
+ /* @__PURE__ */ jsx4(Text3, { style: [pushStyles.benefitsHeader, { color: t.text }], children: "Get real-time updates when:" }),
3783
+ [
3784
+ "A fight you picked on goes LIVE",
3785
+ "Your pick wins or loses",
3786
+ "Final results and rankings"
3787
+ ].map((item, i) => /* @__PURE__ */ jsxs3(View3, { style: pushStyles.benefitRow, children: [
3788
+ /* @__PURE__ */ jsx4(View3, { style: [pushStyles.bulletDot, { backgroundColor: accent }] }),
3789
+ /* @__PURE__ */ jsx4(Text3, { style: [pushStyles.benefitText, { color: t.textMuted }], children: item })
3790
+ ] }, i))
3791
+ ] })
3792
+ ] }),
3793
+ /* @__PURE__ */ jsxs3(View3, { style: s.bottomRow, children: [
3794
+ /* @__PURE__ */ jsx4(
3795
+ TouchableOpacity3,
3796
+ {
3797
+ style: [s.secondaryBtn, { borderColor: t.border }],
3798
+ onPress: onPushComplete,
3799
+ activeOpacity: 0.7,
3800
+ children: /* @__PURE__ */ jsx4(Text3, { style: [s.secondaryBtnText, { color: t.textMuted }], children: "Maybe Later" })
3801
+ }
3802
+ ),
3803
+ /* @__PURE__ */ jsx4(
3804
+ TouchableOpacity3,
3805
+ {
3806
+ style: [s.primaryBtn, { backgroundColor: accent, flex: 1, opacity: push.loading ? 0.7 : 1 }],
3807
+ onPress: handleEnablePush,
3808
+ disabled: push.loading,
3809
+ activeOpacity: 0.8,
3810
+ children: push.loading ? /* @__PURE__ */ jsx4(ActivityIndicator2, { color: "#FFFFFF", size: "small" }) : /* @__PURE__ */ jsx4(Text3, { style: s.primaryBtnText, children: "Enable Notifications" })
3811
+ }
3812
+ )
3813
+ ] })
3814
+ ] });
3767
3815
  const renderStep = () => {
3768
3816
  switch (step) {
3769
3817
  case 0:
@@ -3772,6 +3820,8 @@ function DefaultRegistrationScreen({
3772
3820
  return renderUsernameStep();
3773
3821
  case 2:
3774
3822
  return renderReferralStep();
3823
+ case 3:
3824
+ return renderPushStep();
3775
3825
  default:
3776
3826
  return null;
3777
3827
  }
@@ -3812,77 +3862,6 @@ function PushTokenRestorer() {
3812
3862
  }, []);
3813
3863
  return null;
3814
3864
  }
3815
- function PushSetupScreen({
3816
- accentColor,
3817
- appName,
3818
- onComplete
3819
- }) {
3820
- const t = useDubsTheme();
3821
- const accent = accentColor || t.accent;
3822
- const push = usePushNotifications();
3823
- const fadeAnim = useRef6(new Animated.Value(0)).current;
3824
- const slideAnim = useRef6(new Animated.Value(30)).current;
3825
- useEffect17(() => {
3826
- Animated.parallel([
3827
- Animated.timing(fadeAnim, { toValue: 1, duration: 300, useNativeDriver: true }),
3828
- Animated.timing(slideAnim, { toValue: 0, duration: 300, useNativeDriver: true })
3829
- ]).start();
3830
- }, [fadeAnim, slideAnim]);
3831
- const handleEnable = async () => {
3832
- await push.register();
3833
- onComplete();
3834
- };
3835
- const benefits = [
3836
- "A fight you picked on goes LIVE",
3837
- "Your pick wins or loses",
3838
- "Final results and rankings"
3839
- ];
3840
- return /* @__PURE__ */ jsx4(View3, { style: [s.container, { backgroundColor: t.background }], children: /* @__PURE__ */ jsxs3(
3841
- Animated.View,
3842
- {
3843
- style: [
3844
- s.stepContainer,
3845
- { opacity: fadeAnim, transform: [{ translateY: slideAnim }] }
3846
- ],
3847
- children: [
3848
- /* @__PURE__ */ jsxs3(View3, { style: s.stepTop, children: [
3849
- /* @__PURE__ */ jsx4(Text3, { style: [s.title, { color: t.text }], children: "Enable Notifications" }),
3850
- /* @__PURE__ */ jsx4(Text3, { style: [s.subtitle, { color: t.textMuted }], children: "Stay in the loop with real-time updates" }),
3851
- /* @__PURE__ */ jsx4(StepIndicator, { currentStep: 3 }),
3852
- /* @__PURE__ */ jsx4(View3, { style: pushStyles.iconContainer, children: /* @__PURE__ */ jsx4(View3, { style: [pushStyles.bellCircle, { backgroundColor: accent + "20" }], children: /* @__PURE__ */ jsx4(Text3, { style: [pushStyles.bellIcon, { color: accent }], children: "\u{1F514}" }) }) }),
3853
- /* @__PURE__ */ jsxs3(View3, { style: pushStyles.benefitsList, children: [
3854
- /* @__PURE__ */ jsx4(Text3, { style: [pushStyles.benefitsHeader, { color: t.text }], children: "Get real-time updates when:" }),
3855
- benefits.map((item, i) => /* @__PURE__ */ jsxs3(View3, { style: pushStyles.benefitRow, children: [
3856
- /* @__PURE__ */ jsx4(View3, { style: [pushStyles.bulletDot, { backgroundColor: accent }] }),
3857
- /* @__PURE__ */ jsx4(Text3, { style: [pushStyles.benefitText, { color: t.textMuted }], children: item })
3858
- ] }, i))
3859
- ] })
3860
- ] }),
3861
- /* @__PURE__ */ jsxs3(View3, { style: s.bottomRow, children: [
3862
- /* @__PURE__ */ jsx4(
3863
- TouchableOpacity3,
3864
- {
3865
- style: [s.secondaryBtn, { borderColor: t.border }],
3866
- onPress: onComplete,
3867
- activeOpacity: 0.7,
3868
- children: /* @__PURE__ */ jsx4(Text3, { style: [s.secondaryBtnText, { color: t.textMuted }], children: "Maybe Later" })
3869
- }
3870
- ),
3871
- /* @__PURE__ */ jsx4(
3872
- TouchableOpacity3,
3873
- {
3874
- style: [s.primaryBtn, { backgroundColor: accent, flex: 1, opacity: push.loading ? 0.7 : 1 }],
3875
- onPress: handleEnable,
3876
- disabled: push.loading,
3877
- activeOpacity: 0.8,
3878
- children: push.loading ? /* @__PURE__ */ jsx4(ActivityIndicator2, { color: "#FFFFFF", size: "small" }) : /* @__PURE__ */ jsx4(Text3, { style: s.primaryBtnText, children: "Enable Notifications" })
3879
- }
3880
- )
3881
- ] })
3882
- ]
3883
- }
3884
- ) });
3885
- }
3886
3865
  var pushStyles = StyleSheet3.create({
3887
3866
  iconContainer: { alignItems: "center", marginVertical: 24 },
3888
3867
  bellCircle: { width: 100, height: 100, borderRadius: 50, justifyContent: "center", alignItems: "center" },