Page MenuHomePhabricator

D5832.id19188.diff
No OneTemporary

D5832.id19188.diff

diff --git a/native/navigation/app-navigator.react.js b/native/navigation/app-navigator.react.js
--- a/native/navigation/app-navigator.react.js
+++ b/native/navigation/app-navigator.react.js
@@ -24,6 +24,7 @@
OverlayNavigationProp,
OverlayNavigationHelpers,
} from './overlay-navigator.react';
+import PolicyAcknowledgmentHandler from './policy-acknowledgment-handler.react';
import type { RootNavigationProp } from './root-navigator.react';
import {
TabNavigatorRouteName,
@@ -134,6 +135,9 @@
/>
</App.Navigator>
{pushHandler}
+ <PersistGate persistor={getPersistor()}>
+ <PolicyAcknowledgmentHandler />
+ </PersistGate>
</KeyboardStateContainer>
);
}
diff --git a/native/navigation/policy-acknowledgment-handler.react.js b/native/navigation/policy-acknowledgment-handler.react.js
new file mode 100644
--- /dev/null
+++ b/native/navigation/policy-acknowledgment-handler.react.js
@@ -0,0 +1,28 @@
+// @flow
+
+import { useNavigation } from '@react-navigation/native';
+import * as React from 'react';
+
+import { policyTypes } from 'lib/facts/policies';
+
+import { useSelector } from '../redux/redux-utils';
+import { TermsAndPrivacyRouteName } from './route-names';
+
+function PolicyAcknowledgmentHandler(): null {
+ const userPolicies = useSelector(state => state.userPolicies);
+ const navigation = useNavigation();
+
+ React.useEffect(() => {
+ const tosAndPrivacyState = userPolicies?.[policyTypes.tosAndPrivacyPolicy];
+ if (tosAndPrivacyState && !tosAndPrivacyState?.isAcknowledged) {
+ navigation.navigate<'TermsAndPrivacyModal'>({
+ name: TermsAndPrivacyRouteName,
+ params: { policyType: policyTypes.tosAndPrivacyPolicy },
+ });
+ }
+ }, [navigation, userPolicies]);
+
+ return null;
+}
+
+export default PolicyAcknowledgmentHandler;

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 3:22 PM (11 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2681985
Default Alt Text
D5832.id19188.diff (1 KB)

Event Timeline