From 7be9b89c5ac09cbaeba0a4524fe04df4e6e64861 Mon Sep 17 00:00:00 2001 From: Adolfo Reyna Date: Fri, 10 Mar 2023 22:38:52 -0600 Subject: [PATCH] testing universal links handler --- App.js | 6 +++ Views/Feed.js | 1 + package-lock.json | 95 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 3 +- 4 files changed, 104 insertions(+), 1 deletion(-) diff --git a/App.js b/App.js index a6dd67b..7989aff 100644 --- a/App.js +++ b/App.js @@ -26,6 +26,7 @@ import MediaView from './components/MediaView.js'; import { useSnapshot } from 'valtio'; import GlobalState from './contexts/GlobalState.js'; import NewGroup from './Views/NewGroup.js'; +import * as Linking2 from 'expo-linking'; import { Linking } from 'expo'; @@ -111,6 +112,11 @@ const MainNavigation = ({route}) => { const [notification, setNotification] = useState(false); const notificationListener = useRef(); const responseListener = useRef(); + const url = Linking2.useURL(); + useEffect(() => { + // Do something with url + alert(url); + }, [url]); useEffect(() => { registerForPushNotificationsAsync().then(async (token) => { diff --git a/Views/Feed.js b/Views/Feed.js index dc31607..35ec2b6 100644 --- a/Views/Feed.js +++ b/Views/Feed.js @@ -4,6 +4,7 @@ import API from './../API.js'; import Post from './../components/Post.js'; import GlobalState from '../contexts/GlobalState.js'; + import AsyncStorage from '@react-native-async-storage/async-storage'; const storeFeed = async (value) => { diff --git a/package-lock.json b/package-lock.json index 2c68666..b25bc58 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "expo-dev-client": "~2.0.1", "expo-device": "~5.0.0", "expo-image-picker": "~14.0.2", + "expo-linking": "~3.3.1", "expo-localization": "~14.0.0", "expo-notifications": "~0.17.0", "expo-status-bar": "~1.4.2", @@ -4544,6 +4545,11 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.13.tgz", "integrity": "sha512-IASpMGVcWpUsx5xBOrxMj7Bl8lqfuTY7FKAnPmu5cHkfQVWF8GulWS1jbRqA934qZL35xh5xN/+Xe/i26Bod4w==" }, + "node_modules/@types/qs": { + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", + "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==" + }, "node_modules/@types/yargs": { "version": "15.0.14", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.14.tgz", @@ -6693,6 +6699,32 @@ "expo": "*" } }, + "node_modules/expo-linking": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/expo-linking/-/expo-linking-3.3.1.tgz", + "integrity": "sha512-T3VIZMyZhkBOpHIyfT514rweGZZMbdg1vwavsfAkm6BFJ8G0iNVGbYMTpoUiQ9xdA0ARCcZbXFFb+WhqEUITgQ==", + "dependencies": { + "@types/qs": "^6.5.3", + "expo-constants": "~14.0.0", + "invariant": "^2.2.4", + "qs": "^6.9.1", + "url-parse": "^1.5.9" + } + }, + "node_modules/expo-linking/node_modules/qs": { + "version": "6.11.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.1.tgz", + "integrity": "sha512-0wsrzgTz/kAVIeuxSjnpGC56rzYtr6JT/2BwEvMaPhFIoYa1aGO8LbzuU1R0uUYQkLpWBTOj0l/CLAJB64J6nQ==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/expo-localization": { "version": "14.0.0", "resolved": "https://registry.npmjs.org/expo-localization/-/expo-localization-14.0.0.tgz", @@ -9988,6 +10020,14 @@ "node": ">=0.10.0" } }, + "node_modules/object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/object-is": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", @@ -11588,6 +11628,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -16523,6 +16576,11 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.13.tgz", "integrity": "sha512-IASpMGVcWpUsx5xBOrxMj7Bl8lqfuTY7FKAnPmu5cHkfQVWF8GulWS1jbRqA934qZL35xh5xN/+Xe/i26Bod4w==" }, + "@types/qs": { + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", + "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==" + }, "@types/yargs": { "version": "15.0.14", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.14.tgz", @@ -18186,6 +18244,28 @@ "integrity": "sha512-44ZjgLE4lnce2d40Pv8xsjMVc6R5GvgHOwZfkLYtGmgYG9TYrEJeEj5UfSeweXPL3pBFhXKfFU8xpGYMaHdP0A==", "requires": {} }, + "expo-linking": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/expo-linking/-/expo-linking-3.3.1.tgz", + "integrity": "sha512-T3VIZMyZhkBOpHIyfT514rweGZZMbdg1vwavsfAkm6BFJ8G0iNVGbYMTpoUiQ9xdA0ARCcZbXFFb+WhqEUITgQ==", + "requires": { + "@types/qs": "^6.5.3", + "expo-constants": "~14.0.0", + "invariant": "^2.2.4", + "qs": "^6.9.1", + "url-parse": "^1.5.9" + }, + "dependencies": { + "qs": { + "version": "6.11.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.1.tgz", + "integrity": "sha512-0wsrzgTz/kAVIeuxSjnpGC56rzYtr6JT/2BwEvMaPhFIoYa1aGO8LbzuU1R0uUYQkLpWBTOj0l/CLAJB64J6nQ==", + "requires": { + "side-channel": "^1.0.4" + } + } + } + }, "expo-localization": { "version": "14.0.0", "resolved": "https://registry.npmjs.org/expo-localization/-/expo-localization-14.0.0.tgz", @@ -20726,6 +20806,11 @@ } } }, + "object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==" + }, "object-is": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", @@ -21934,6 +22019,16 @@ "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.4.tgz", "integrity": "sha512-8o/QEhSSRb1a5i7TFR0iM4G16Z0vYB2OQVs4G3aAFXjn3T6yEx8AZxy1PgDF7I00LZHYA3WxaSYIf5e5sAX8Rw==" }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, "signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", diff --git a/package.json b/package.json index 65368fc..935e4ec 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ "react-native-web": "~0.18.7", "react-native-webview": "11.23.1", "valtio": "^1.4.0", - "@react-native-community/netinfo": "9.3.5" + "@react-native-community/netinfo": "9.3.5", + "expo-linking": "~3.3.1" }, "devDependencies": { "@babel/core": "^7.19.3"