Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

avoid handling notifs if deep link (#8657)

authored by

Samuel Newman and committed by
GitHub
2c0c9bf8 2e16ef43

+8 -34
+8 -34
src/Navigation.tsx
··· 1 1 import {useCallback, useRef} from 'react' 2 + import {Linking} from 'react-native' 2 3 import * as Notifications from 'expo-notifications' 3 4 import {i18n, type MessageDescriptor} from '@lingui/core' 4 5 import {msg} from '@lingui/macro' ··· 884 885 async function handlePushNotificationEntry() { 885 886 if (!isNative) return 886 887 888 + // deep links take precedence - on android, 889 + // getLastNotificationResponseAsync returns a "notification" 890 + // that is actually a deep link. avoid handling it twice -sfn 891 + if (await Linking.getInitialURL()) { 892 + return 893 + } 894 + 887 895 /** 888 896 * The notification that caused the app to open, if applicable 889 897 */ ··· 1041 1049 } 1042 1050 } 1043 1051 1044 - function handleLink(url: string) { 1045 - let path 1046 - if (url.startsWith('/')) { 1047 - path = url 1048 - } else if (url.startsWith('http')) { 1049 - try { 1050 - path = new URL(url).pathname 1051 - } catch (e) { 1052 - console.error('Invalid url', url, e) 1053 - return 1054 - } 1055 - } else { 1056 - console.error('Invalid url', url) 1057 - return 1058 - } 1059 - 1060 - const [name, params] = router.matchPath(path) 1061 - if (isNative) { 1062 - if (name === 'Search') { 1063 - resetToTab('SearchTab') 1064 - } else if (name === 'Notifications') { 1065 - resetToTab('NotificationsTab') 1066 - } else { 1067 - resetToTab('HomeTab') 1068 - // @ts-ignore matchPath doesnt give us type-checked output -prf 1069 - navigate(name, params) 1070 - } 1071 - } else { 1072 - // @ts-ignore matchPath doesnt give us type-checked output -prf 1073 - navigate(name, params) 1074 - } 1075 - } 1076 - 1077 1052 let didInit = false 1078 1053 function logModuleInitTime() { 1079 1054 if (didInit) { ··· 1114 1089 1115 1090 export { 1116 1091 FlatNavigator, 1117 - handleLink, 1118 1092 navigate, 1119 1093 reset, 1120 1094 resetToTab,