Skip to content

Commit

Permalink
[fix] bring deep link handler back.
Browse files Browse the repository at this point in the history
  • Loading branch information
ronniebeggs committed Apr 24, 2024
1 parent d60ba37 commit 28a71b1
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/app/(BottomTabNavigation)/AllCases/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Linking from 'expo-linking';
import { router } from 'expo-router';
import React, { useContext, useState } from 'react';
import React, { useContext, useState, useEffect } from 'react';
import { FlatList, Text, View, TouchableOpacity } from 'react-native';

import styles from './styles';
Expand Down Expand Up @@ -60,6 +60,21 @@ function CasesScreen() {
}
}

useEffect(() => {
// will detect any incoming link requests, assuming the app is already open
Linking.addEventListener('url', handleDeepLink);
if (!url) {
// if the link opened the app, must route to the initial incoming route
getInitialUrl();
}

if (session?.user) {
registerForPushNotifications().then(async (token: string) => {
updatePushToken(session.user.id, token);
});
}
}, []);

return (
<View style={styles.container}>
<View style={styles.casesContainer}>
Expand Down

0 comments on commit 28a71b1

Please sign in to comment.