about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-06-13 20:52:40 -0500
committerPaul Frazee <pfrazee@gmail.com>2022-06-13 20:52:40 -0500
commit012af05ab8a26e34d99eb619ab58ef7dd07e5646 (patch)
treea01bdfa58e19e7ea2390aa24ff063f6a5f9e8565 /src
parentfaddda83f04b46bcdaab5c225cab696fc7a820cd (diff)
downloadvoidsky-012af05ab8a26e34d99eb619ab58ef7dd07e5646.tar.zst
Add universal links (iOS)
Diffstat (limited to 'src')
-rw-r--r--src/routes/index.tsx15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/routes/index.tsx b/src/routes/index.tsx
index a8a92e54f..5084473ec 100644
--- a/src/routes/index.tsx
+++ b/src/routes/index.tsx
@@ -1,5 +1,5 @@
-import React from 'react'
-import {Text} from 'react-native'
+import React, {useEffect} from 'react'
+import {Text, Linking} from 'react-native'
 import {
   NavigationContainer,
   LinkingOptions,
@@ -24,6 +24,7 @@ import {NotFound} from '../screens/NotFound'
 const linking: LinkingOptions<RootTabsParamList> = {
   prefixes: [
     'http://localhost:3000', // local dev
+    'https://pubsq.pfrazee.com', // test server (universal links only)
   ],
   config: {
     screens: {
@@ -59,6 +60,16 @@ const HIDE_TAB = {tabBarButton: () => null}
 export const Root = observer(() => {
   const store = useStores()
 
+  useEffect(() => {
+    console.log('Initial link setup')
+    Linking.getInitialURL().then((url: string | null) => {
+      console.log('Initial url', url)
+    })
+    Linking.addEventListener('url', ({url}) => {
+      console.log('Deep link opened with', url)
+    })
+  }, [])
+
   // hide the tabbar on desktop web
   const tabBar = platform.isDesktopWeb ? () => null : undefined