testing universal links handler

This commit is contained in:
Adolfo Reyna
2023-03-10 22:38:52 -06:00
parent 3f44076709
commit 7be9b89c5a
4 changed files with 104 additions and 1 deletions

6
App.js
View File

@@ -26,6 +26,7 @@ import MediaView from './components/MediaView.js';
import { useSnapshot } from 'valtio'; import { useSnapshot } from 'valtio';
import GlobalState from './contexts/GlobalState.js'; import GlobalState from './contexts/GlobalState.js';
import NewGroup from './Views/NewGroup.js'; import NewGroup from './Views/NewGroup.js';
import * as Linking2 from 'expo-linking';
import { Linking } from 'expo'; import { Linking } from 'expo';
@@ -111,6 +112,11 @@ const MainNavigation = ({route}) => {
const [notification, setNotification] = useState(false); const [notification, setNotification] = useState(false);
const notificationListener = useRef(); const notificationListener = useRef();
const responseListener = useRef(); const responseListener = useRef();
const url = Linking2.useURL();
useEffect(() => {
// Do something with url
alert(url);
}, [url]);
useEffect(() => { useEffect(() => {
registerForPushNotificationsAsync().then(async (token) => { registerForPushNotificationsAsync().then(async (token) => {

View File

@@ -4,6 +4,7 @@ import API from './../API.js';
import Post from './../components/Post.js'; import Post from './../components/Post.js';
import GlobalState from '../contexts/GlobalState.js'; import GlobalState from '../contexts/GlobalState.js';
import AsyncStorage from '@react-native-async-storage/async-storage'; import AsyncStorage from '@react-native-async-storage/async-storage';
const storeFeed = async (value) => { const storeFeed = async (value) => {

95
package-lock.json generated
View File

@@ -19,6 +19,7 @@
"expo-dev-client": "~2.0.1", "expo-dev-client": "~2.0.1",
"expo-device": "~5.0.0", "expo-device": "~5.0.0",
"expo-image-picker": "~14.0.2", "expo-image-picker": "~14.0.2",
"expo-linking": "~3.3.1",
"expo-localization": "~14.0.0", "expo-localization": "~14.0.0",
"expo-notifications": "~0.17.0", "expo-notifications": "~0.17.0",
"expo-status-bar": "~1.4.2", "expo-status-bar": "~1.4.2",
@@ -4544,6 +4545,11 @@
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.13.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.13.tgz",
"integrity": "sha512-IASpMGVcWpUsx5xBOrxMj7Bl8lqfuTY7FKAnPmu5cHkfQVWF8GulWS1jbRqA934qZL35xh5xN/+Xe/i26Bod4w==" "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": { "node_modules/@types/yargs": {
"version": "15.0.14", "version": "15.0.14",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.14.tgz", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.14.tgz",
@@ -6693,6 +6699,32 @@
"expo": "*" "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": { "node_modules/expo-localization": {
"version": "14.0.0", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/expo-localization/-/expo-localization-14.0.0.tgz", "resolved": "https://registry.npmjs.org/expo-localization/-/expo-localization-14.0.0.tgz",
@@ -9988,6 +10020,14 @@
"node": ">=0.10.0" "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": { "node_modules/object-is": {
"version": "1.1.5", "version": "1.1.5",
"resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz",
@@ -11588,6 +11628,19 @@
"url": "https://github.com/sponsors/ljharb" "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": { "node_modules/signal-exit": {
"version": "3.0.7", "version": "3.0.7",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "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", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.13.tgz",
"integrity": "sha512-IASpMGVcWpUsx5xBOrxMj7Bl8lqfuTY7FKAnPmu5cHkfQVWF8GulWS1jbRqA934qZL35xh5xN/+Xe/i26Bod4w==" "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": { "@types/yargs": {
"version": "15.0.14", "version": "15.0.14",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.14.tgz", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.14.tgz",
@@ -18186,6 +18244,28 @@
"integrity": "sha512-44ZjgLE4lnce2d40Pv8xsjMVc6R5GvgHOwZfkLYtGmgYG9TYrEJeEj5UfSeweXPL3pBFhXKfFU8xpGYMaHdP0A==", "integrity": "sha512-44ZjgLE4lnce2d40Pv8xsjMVc6R5GvgHOwZfkLYtGmgYG9TYrEJeEj5UfSeweXPL3pBFhXKfFU8xpGYMaHdP0A==",
"requires": {} "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": { "expo-localization": {
"version": "14.0.0", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/expo-localization/-/expo-localization-14.0.0.tgz", "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": { "object-is": {
"version": "1.1.5", "version": "1.1.5",
"resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", "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", "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.4.tgz",
"integrity": "sha512-8o/QEhSSRb1a5i7TFR0iM4G16Z0vYB2OQVs4G3aAFXjn3T6yEx8AZxy1PgDF7I00LZHYA3WxaSYIf5e5sAX8Rw==" "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": { "signal-exit": {
"version": "3.0.7", "version": "3.0.7",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",

View File

@@ -38,7 +38,8 @@
"react-native-web": "~0.18.7", "react-native-web": "~0.18.7",
"react-native-webview": "11.23.1", "react-native-webview": "11.23.1",
"valtio": "^1.4.0", "valtio": "^1.4.0",
"@react-native-community/netinfo": "9.3.5" "@react-native-community/netinfo": "9.3.5",
"expo-linking": "~3.3.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.19.3" "@babel/core": "^7.19.3"