Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32603670
D5832.1767437226.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D5832.1767437226.diff
View Options
diff --git a/native/navigation/navigation-handler.react.js b/native/navigation/navigation-handler.react.js
--- a/native/navigation/navigation-handler.react.js
+++ b/native/navigation/navigation-handler.react.js
@@ -13,6 +13,7 @@
import NavFromReduxHandler from './nav-from-redux-handler.react';
import { useIsAppLoggedIn } from './nav-selectors';
import { NavContext, type NavAction } from './navigation-context';
+import PolicyAcknowledgmentHandler from './policy-acknowledgment-handler.react';
import ThreadScreenTracker from './thread-screen-tracker.react';
const NavigationHandler: React.ComponentType<{}> = React.memo<{}>(
@@ -41,6 +42,7 @@
<LogInHandler dispatch={dispatch} />
<ThreadScreenTracker />
<ModalPruner navContext={navContext} />
+ <PolicyAcknowledgmentHandler />
{devTools}
</>
);
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;
diff --git a/native/root.react.js b/native/root.react.js
--- a/native/root.react.js
+++ b/native/root.react.js
@@ -236,6 +236,7 @@
ref={containerRef}
>
<RootNavigator />
+ <NavigationHandler />
</NavigationContainer>
);
}
@@ -262,7 +263,6 @@
/>
</PersistedStateGate>
{navigation}
- <NavigationHandler />
</ChatContextProvider>
</MarkdownContextProvider>
</ActionSheetProvider>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 3, 10:47 AM (6 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5887933
Default Alt Text
D5832.1767437226.diff (2 KB)
Attached To
Mode
D5832: [native] policy acknowledgment handler
Attached
Detach File
Event Timeline
Log In to Comment