From 9be7a621c5b47582d60ea486245101b0cfa5a037 Mon Sep 17 00:00:00 2001 From: kibagateaux Date: Fri, 5 Jan 2024 13:57:59 -0600 Subject: [PATCH] cleanup project code --- package.json | 3 +- src/app/_layout.tsx | 2 - src/app/inventory/_layout.tsx | 7 ++- src/assets/README.md | 1 + src/assets/avatars/red-yellow-egg.tsx | 43 +++++++++++++++ .../screens/(auth)/oauth-callback.tsx | 38 -------------- src/hooks/index.ts | 1 - src/hooks/useDeepLinks.ts | 52 ------------------- 8 files changed, 51 insertions(+), 96 deletions(-) create mode 100644 src/assets/avatars/red-yellow-egg.tsx delete mode 100644 src/components/screens/(auth)/oauth-callback.tsx delete mode 100644 src/hooks/useDeepLinks.ts diff --git a/package.json b/package.json index 4fca35e..466da2f 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,7 @@ "test:ci": "jest --ci --colors", "postinstall": "patch-package && rn-nodeify --install all --hack", "android": "APP_VARIANT=development npx expo run:android -d --variant developmentDebug", - "install:android": "source .env; APP_VARIANT=production npx eas build --local --platform android -e staging --output app.apk; adb install ./app.apk", - "deploy:secrets": "eas secret:push --scope jinni-health --env-file ./.env", + "install:android": "source .env && npx eas build --local --platform android -e $APP_VARIANT --output app.apk; adb install ./app.apk", "ios": "expo run:ios", "lint:dry": "eslint ./src/ .eslintrc.js --ext .ts,.tsx && prettier ./src/ --config .prettierrc --check", "lint:fix": "eslint ./src/ --fix .eslintrc.js --ext .ts,.tsx && prettier ./src/ --config .prettierrc --write --ignore-unknown" diff --git a/src/app/_layout.tsx b/src/app/_layout.tsx index 46baa33..0e3b1e0 100644 --- a/src/app/_layout.tsx +++ b/src/app/_layout.tsx @@ -14,8 +14,6 @@ import { WidgetConfig } from 'types/UserConfig'; import { getIconForWidget } from 'utils/rendering'; export default function HomeLayout() { - // has to be in nested _layout https://docs.expo.dev/router/reference/authentication/#after - // useDeepLinks(); const homeConfig = useHomeConfig(); const [tabConfig, setTabConfig] = useState([]); diff --git a/src/app/inventory/_layout.tsx b/src/app/inventory/_layout.tsx index e845d71..fc594e5 100644 --- a/src/app/inventory/_layout.tsx +++ b/src/app/inventory/_layout.tsx @@ -6,7 +6,12 @@ import { Stack } from 'expo-router'; export default function Layout() { return ( - + ); diff --git a/src/assets/README.md b/src/assets/README.md index 2c57545..6825ec6 100644 --- a/src/assets/README.md +++ b/src/assets/README.md @@ -3,6 +3,7 @@ https://docs.expo.dev/versions/latest/sdk/svg/ ### Convert PNG -> SVGs -> RN Component + https://svgtrace.com/png-to-svg https://react-svgr.com/playground/?native=true&typescript=true diff --git a/src/assets/avatars/red-yellow-egg.tsx b/src/assets/avatars/red-yellow-egg.tsx new file mode 100644 index 0000000..d6c113a --- /dev/null +++ b/src/assets/avatars/red-yellow-egg.tsx @@ -0,0 +1,43 @@ +import * as React from 'react'; +import Svg, { SvgProps, Path } from 'react-native-svg'; +const SvgComponent = (props: SvgProps) => ( + + + + + + + + +); +export default SvgComponent; diff --git a/src/components/screens/(auth)/oauth-callback.tsx b/src/components/screens/(auth)/oauth-callback.tsx deleted file mode 100644 index 22ce19b..0000000 --- a/src/components/screens/(auth)/oauth-callback.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import React, { useEffect } from 'react'; - -import { Text, View } from 'react-native'; - -import { useAuth } from 'contexts/AuthContext'; -// import { getSteps } from 'utils/inventory/android-health-connect'; -// import { PORTAL_DAY } from 'utils/mayanese'; - -const OauthCallback = (props) => { - console.log('oauth callback props', props); - // So this works but not entirely sure what to do now? - // think we've done first half of authorization code - // now we do second half of exchanging code for access token - // have to make a request to server to initiate? Dont necessarily need server can just do thru client - // doing through server would let us expose your data to other users e.g. let us show them ur top 10 songs (right now we could only get ur top 10 for u on ur device) - - const { player, login, anonId } = useAuth(); - console.log('oauth callback', player, anonId?._commitment); - useEffect(() => { - // getSteps({ - // startTime: PORTAL_DAY, - // endTime: '2023-10-10T23:53:15.405Z' - // }); - }); - return ( - - login({ username: 'a', password: 'b', email: 'blah@blah.blah ' })}> - Login - - - Your anon ID : - {anonId?._commitment.toString()} - - - ); -}; - -export default OauthCallback; diff --git a/src/hooks/index.ts b/src/hooks/index.ts index 110de20..fe7f6aa 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -1,4 +1,3 @@ export * from './useHomeConfig'; export * from './useInventory'; export * from './useNetworkState'; -export * from './useDeepLinks'; diff --git a/src/hooks/useDeepLinks.ts b/src/hooks/useDeepLinks.ts deleted file mode 100644 index 13c5b1d..0000000 --- a/src/hooks/useDeepLinks.ts +++ /dev/null @@ -1,52 +0,0 @@ -// import { useState, useEffect } from 'react'; -// import * as Linking from 'expo-linking'; -// import Constants from 'expo-constants'; -// import { router } from 'expo-router'; -// import * as SplashScreen from 'expo-splash-screen'; - -// const prefix = Linking.createURL('/'); -// const deepLinkScheme = Constants.expoConfig?.scheme ?? 'jinni-health'; -// const universalLinkScheme = 'https://app.jinni.health/'; - -// // OK apparently deep linking *is* working but keep for now until fully tested in prod and know its unneeded -// export const useDeepLinks = () => { -// // Prevent hiding the splash screen after the navigation has mounted. -// SplashScreen.preventAutoHideAsync(); - -// const [redirectUrl, setRedirectUri] = useState(); -// const linkedInto = Linking.useURL(); -// useEffect(() => { -// const { scheme, hostname, path } = linkedInto ? Linking.parse(linkedInto) : {}; -// const isRedirect = scheme === Constants.expoConfig?.scheme; - -// console.log('hook:deepLLink:past', redirectUrl); -// console.log('hook:deepLLink:now', linkedInto, isRedirect); -// // console.log('use deep link 2', scheme, isRedirect, hostname, '---', path ); - -// if (linkedInto !== redirectUrl && isRedirect && path) { -// const params = path -// ?.split('/') -// .reduce((obj, param) => ({ ...obj, [param]: param }), {}); - -// router.replace({ -// pathname: hostname, -// params, -// }); -// setRedirectUri(Linking.createURL(hostname, params)); -// } -// // always unmount splash screen after loading -// SplashScreen.hideAsync(); -// }, [redirectUrl, linkedInto]); -// }; - -// // TODO should we make deepLinks use query params? -// // e.g. jinni-health://?path=inventory?id=Spotify&ability=spotify-share-profile -// const mapPathToParams = (page: string, path: string) => { -// const params = path.split('/'); -// switch(page) { -// case 'inventory': -// return { id: path } -// default: -// return {} -// } -// }