about summary refs log tree commit diff
path: root/src/view/shell/createNativeStackNavigatorWithAuth.tsx
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-06-17 13:21:09 -0500
committerGitHub <noreply@github.com>2024-06-17 13:21:09 -0500
commit332524b7dec18b5e19edacdb976467d6725a5df0 (patch)
tree7e3a0256ea3b8d7e2861d4a558b7f9f7f979de96 /src/view/shell/createNativeStackNavigatorWithAuth.tsx
parentf5f3bd8130c1ba1fee4030f758a158a983ff28c5 (diff)
downloadvoidsky-332524b7dec18b5e19edacdb976467d6725a5df0.tar.zst
Add `native_pwi_disabled` feature gate experiment (#4507)
* Add native_pwi_disabled feature gate experiment

* Use const
Diffstat (limited to 'src/view/shell/createNativeStackNavigatorWithAuth.tsx')
-rw-r--r--src/view/shell/createNativeStackNavigatorWithAuth.tsx10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/view/shell/createNativeStackNavigatorWithAuth.tsx b/src/view/shell/createNativeStackNavigatorWithAuth.tsx
index 3c611351d..82dd6d22c 100644
--- a/src/view/shell/createNativeStackNavigatorWithAuth.tsx
+++ b/src/view/shell/createNativeStackNavigatorWithAuth.tsx
@@ -29,7 +29,8 @@ import {
   useLoggedOutView,
   useLoggedOutViewControls,
 } from '#/state/shell/logged-out'
-import {isWeb} from 'platform/detection'
+import {useGate} from 'lib/statsig/statsig'
+import {isNative, isWeb} from 'platform/detection'
 import {Deactivated} from '#/screens/Deactivated'
 import {Onboarding} from '#/screens/Onboarding'
 import {SignupQueued} from '#/screens/SignupQueued'
@@ -50,6 +51,7 @@ function NativeStackNavigator({
   screenOptions,
   ...rest
 }: NativeStackNavigatorProps) {
+  const gate = useGate()
   // --- this is copy and pasted from the original native stack navigator ---
   const {state, descriptors, navigation, NavigationContent} =
     useNavigationBuilder<
@@ -100,7 +102,11 @@ function NativeStackNavigator({
   const {showLoggedOut} = useLoggedOutView()
   const {setShowLoggedOut} = useLoggedOutViewControls()
   const {isMobile, isTabletOrMobile} = useWebMediaQueries()
-  if ((!PWI_ENABLED || activeRouteRequiresAuth) && !hasSession) {
+  const isNativePWIDisabled = isNative && gate('native_pwi_disabled')
+  if (
+    (!PWI_ENABLED || isNativePWIDisabled || activeRouteRequiresAuth) &&
+    !hasSession
+  ) {
     return <LoggedOut />
   }
   if (hasSession && currentAccount?.signupQueued) {