From 2e0ab15e5bbc304c3a4e2009bc7112938f04566d Mon Sep 17 00:00:00 2001 From: Ty Fiero Date: Thu, 25 Apr 2024 16:18:18 -0700 Subject: [PATCH] More changes --- .../source/clients/ios/react-native/App.tsx | 28 +++++++++++-------- .../ios/react-native/package-lock.json | 9 ++++++ .../clients/ios/react-native/package.json | 5 ++-- .../ios/react-native/src/screens/Main.tsx | 20 ++++++++++--- 4 files changed, 44 insertions(+), 18 deletions(-) diff --git a/software/source/clients/ios/react-native/App.tsx b/software/source/clients/ios/react-native/App.tsx index 5fa7a05..171108e 100644 --- a/software/source/clients/ios/react-native/App.tsx +++ b/software/source/clients/ios/react-native/App.tsx @@ -4,23 +4,27 @@ import { createNativeStackNavigator } from "@react-navigation/native-stack"; import HomeScreen from "./src/screens/HomeScreen"; import CameraScreen from "./src/screens/Camera"; import Main from "./src/screens/Main"; +import { StatusBar } from "expo-status-bar"; const Stack = createNativeStackNavigator(); function App() { return ( - - - - - - - + <> + + + + + + + + + ); } diff --git a/software/source/clients/ios/react-native/package-lock.json b/software/source/clients/ios/react-native/package-lock.json index e78cdd4..47618dc 100644 --- a/software/source/clients/ios/react-native/package-lock.json +++ b/software/source/clients/ios/react-native/package-lock.json @@ -15,6 +15,7 @@ "expo-barcode-scanner": "~12.9.3", "expo-camera": "~14.0.5", "expo-haptics": "~12.8.1", + "expo-permissions": "^14.4.0", "expo-status-bar": "~1.11.1", "react": "18.2.0", "react-native": "0.73.4", @@ -7865,6 +7866,14 @@ "invariant": "^2.2.4" } }, + "node_modules/expo-permissions": { + "version": "14.4.0", + "resolved": "https://registry.npmjs.org/expo-permissions/-/expo-permissions-14.4.0.tgz", + "integrity": "sha512-oAcnJ7dlZhpBydK73cwomA2xofizayVUz+FW5REl7dMu7MYyeN/3aqhlpZ3mYddrxvG161bqu97MQr01UixUnw==", + "peerDependencies": { + "expo": "*" + } + }, "node_modules/expo-status-bar": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/expo-status-bar/-/expo-status-bar-1.11.1.tgz", diff --git a/software/source/clients/ios/react-native/package.json b/software/source/clients/ios/react-native/package.json index 6d5cbe2..1b0d566 100644 --- a/software/source/clients/ios/react-native/package.json +++ b/software/source/clients/ios/react-native/package.json @@ -16,6 +16,8 @@ "expo-av": "~13.10.5", "expo-barcode-scanner": "~12.9.3", "expo-camera": "~14.0.5", + "expo-haptics": "~12.8.1", + "expo-permissions": "^14.4.0", "expo-status-bar": "~1.11.1", "react": "18.2.0", "react-native": "0.73.4", @@ -24,8 +26,7 @@ "react-native-safe-area-context": "4.8.2", "react-native-screens": "~3.29.0", "text-encoding": "^0.7.0", - "zustand": "^4.5.2", - "expo-haptics": "~12.8.1" + "zustand": "^4.5.2" }, "devDependencies": { "@babel/core": "^7.20.0", diff --git a/software/source/clients/ios/react-native/src/screens/Main.tsx b/software/source/clients/ios/react-native/src/screens/Main.tsx index 08519b4..ba6991d 100644 --- a/software/source/clients/ios/react-native/src/screens/Main.tsx +++ b/software/source/clients/ios/react-native/src/screens/Main.tsx @@ -4,11 +4,11 @@ import * as FileSystem from "expo-file-system"; import { AVPlaybackStatus, AVPlaybackStatusSuccess, Audio } from "expo-av"; import { polyfill as polyfillEncoding } from "react-native-polyfill-globals/src/encoding"; import { create } from "zustand"; -import useStore from "../lib/state"; +import useStore from "../utils/state"; import { Animated } from "react-native"; import * as Haptics from "expo-haptics"; -import useSoundEffect from "../lib/useSoundEffect"; -import IconImage from "../../assets/qr.png"; +import useSoundEffect from "../utils/useSoundEffect"; +// import IconImage from "../../assets/qr.png"; import { useNavigation } from "@react-navigation/native"; interface MainProps { @@ -132,7 +132,7 @@ const Main: React.FC = ({ route }) => { }, [audioQueue, sound, soundUriMap]); const _onPlayBackStatusUpdate = useCallback( - async (status) => { + async (status: any) => { if (status.didJustFinish) { await sound?.unloadAsync(); soundUriMap.delete(sound); @@ -232,6 +232,14 @@ const Main: React.FC = ({ route }) => { }; }, [scannedData]); + useEffect(() => { + console.log("Permission Response:", permissionResponse); + if (permissionResponse?.status !== "granted") { + console.log("Requesting permission.."); + requestPermission(); + } + }, []); + const startRecording = useCallback(async () => { if (recording) { console.log("A recording is already in progress."); @@ -239,6 +247,10 @@ const Main: React.FC = ({ route }) => { } try { + console.log("🌶️🌶️🌶️🌶️🌶️🌶️🌶️🌶️🌶️🌶️"); + + console.log(permissionResponse); + if ( permissionResponse !== null && permissionResponse.status !== `granted`