From 3802fbd5d7f7c9ca70060f53af993356d946483d Mon Sep 17 00:00:00 2001
From: ankit-thanekar007 <ankit.thanekar007@gmail.com>
Date: Mon, 29 Mar 2021 12:45:36 -0700
Subject: TOU and PP updates

---
 src/screens/profile/SettingsCell.tsx | 41 ++++++++++++++++++++++++++++++++----
 1 file changed, 37 insertions(+), 4 deletions(-)

(limited to 'src/screens/profile/SettingsCell.tsx')

diff --git a/src/screens/profile/SettingsCell.tsx b/src/screens/profile/SettingsCell.tsx
index 29dcc691..f5360242 100644
--- a/src/screens/profile/SettingsCell.tsx
+++ b/src/screens/profile/SettingsCell.tsx
@@ -3,11 +3,15 @@ import React from 'react';
 import {
   Alert,
   Image,
+  Linking,
   StyleSheet,
   Text,
   TouchableOpacity,
   View,
 } from 'react-native';
+import InAppBrowser from 'react-native-inappbrowser-reborn';
+import {TAGG_PURPLE} from '../../constants';
+import {COMMUNITY_GUIDELINES, PRIVACY_POLICY} from '../../constants/api';
 import {ERROR_ATTEMPT_EDIT_SP} from '../../constants/strings';
 import {normalize, SCREEN_WIDTH} from '../../utils/layouts';
 
@@ -43,7 +47,7 @@ const SettingsCell: React.FC<SettingsCellProps> = ({
         navigateTo('AccountTypeScreen', {});
         break;
       case 'Blocked Accounts':
-        navigateTo('Blocked Accounts', {});
+        //TODO:
         break;
       case 'Suggested People Profile':
         goToUpdateSPProfile();
@@ -51,17 +55,42 @@ const SettingsCell: React.FC<SettingsCellProps> = ({
       case 'Privacy':
         navigateTo('PrivacyScreen', {});
         break;
-      case 'Terms of use':
-        //TODO:
+      case 'Community Guidelines':
+        openTaggLink(COMMUNITY_GUIDELINES);
         break;
       case 'Privacy Policy':
-        //TODO:
+        openTaggLink(PRIVACY_POLICY);
         break;
       default:
         break;
     }
   };
 
+  const openTaggLink = async (url: string) => {
+    try {
+      if (await InAppBrowser.isAvailable()) {
+        await InAppBrowser.open(url, {
+          dismissButtonStyle: 'cancel',
+          preferredBarTintColor: TAGG_PURPLE,
+          preferredControlTintColor: 'white',
+          animated: true,
+          modalPresentationStyle: 'fullScreen',
+          modalTransitionStyle: 'coverVertical',
+          modalEnabled: true,
+          enableBarCollapsing: false,
+          animations: {
+            startEnter: 'slide_in_right',
+            startExit: 'slide_out_left',
+            endEnter: 'slide_in_left',
+            endExit: 'slide_out_right',
+          },
+        });
+      } else Linking.openURL(url);
+    } catch (error) {
+      Alert.alert(error.message);
+    }
+  };
+
   const navigateTo = (screen: string, options: object) => {
     navigation.navigate(screen, options);
   };
@@ -108,6 +137,10 @@ const styles = StyleSheet.create({
     color: 'white',
   },
   subtitleStyles: {color: '#C4C4C4', marginRight: 13},
+  tc: {
+    marginVertical: '5%',
+    top: '8%',
+  },
 });
 
 export default SettingsCell;
-- 
cgit v1.2.3-70-g09d2

