diff --git a/android/gradle.properties b/android/gradle.properties index 41b173c..5fb8e3d 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -54,3 +54,5 @@ EX_DEV_CLIENT_NETWORK_INSPECTOR=true # Use legacy packaging to compress native libraries in the resulting APK. expo.useLegacyPackaging=false + +VisionCamera_enableCodeScanner=true \ No newline at end of file diff --git a/ios/app/Info.plist b/ios/app/Info.plist index 17df501..c1f0d2e 100644 --- a/ios/app/Info.plist +++ b/ios/app/Info.plist @@ -49,7 +49,9 @@ NSCameraUsageDescription - Allow $(PRODUCT_NAME) to access your camera + $(PRODUCT_NAME) needs access to your Camera. + NSMotionUsageDescription + Allow $(PRODUCT_NAME) to access your device motion UILaunchStoryboardName SplashScreen UIRequiredDeviceCapabilities diff --git a/package-lock.json b/package-lock.json index 4bf4369..3b89ecc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "react-countup": "^6.5.3", "react-native": "0.74.2", "react-native-compass-heading": "^1.5.0", + "react-native-config": "^1.5.2", "react-native-permissions": "^4.1.5", "react-native-progress": "^5.0.1", "react-native-safe-area-context": "4.10.1", @@ -12852,6 +12853,20 @@ "react-native": "*" } }, + "node_modules/react-native-config": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/react-native-config/-/react-native-config-1.5.2.tgz", + "integrity": "sha512-jIx/21Ryr7+NXfULG1lQoct4KgmVae2KZ7/mt5fY2tm4s7N0jAxRm5Js8FX6adgkHuhV2fiizEBJDn/fWIFWiw==", + "license": "MIT", + "peerDependencies": { + "react-native-windows": ">=0.61" + }, + "peerDependenciesMeta": { + "react-native-windows": { + "optional": true + } + } + }, "node_modules/react-native-permissions": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/react-native-permissions/-/react-native-permissions-4.1.5.tgz", diff --git a/package.json b/package.json index 8949aad..436ef18 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "react-countup": "^6.5.3", "react-native": "0.74.2", "react-native-compass-heading": "^1.5.0", + "react-native-config": "^1.5.2", "react-native-permissions": "^4.1.5", "react-native-progress": "^5.0.1", "react-native-safe-area-context": "4.10.1", diff --git a/src/screens/AtividadeScreen.js b/src/screens/AtividadeScreen.js index 7988a6f..25ff876 100644 --- a/src/screens/AtividadeScreen.js +++ b/src/screens/AtividadeScreen.js @@ -26,6 +26,7 @@ export default function AtividadeScreen({ route, navigation }) { const [data, setData] = useState([]); const [isLoading, setLoading] = useState(true); const [degree, setDegree] = useState(0); + const TRAIL_API_BASE_URL = __DEV__ ? 'http://172.26.196.22:5000' : 'https://ALGUMACOISA.COM'; const item = route.params.item; @@ -36,8 +37,10 @@ export default function AtividadeScreen({ route, navigation }) { const getTrees = async () => { try { - const response = await fetch('http://192.168.0.12:5000/trails/' + item.id + '/trees'); + setLoading(true); + const response = await fetch(TRAIL_API_BASE_URL + '/trails/' + item.id + '/trees'); const trees = await response.json(); + console.log(trees); setData(trees); } catch (error) { console.error(error); @@ -54,7 +57,8 @@ export default function AtividadeScreen({ route, navigation }) { if (route.params?.sucess) { if (route.params.sucess) { setArvore(n => n + 1); - setDistancia(n => n + data[arvore].distance); + const distance = data[arvore + 1] != null && data[arvore + 1].distance != null? data[arvore + 1].distance : 0; + setDistancia(n => n + distance); } route.params.sucess = false; } @@ -82,7 +86,7 @@ export default function AtividadeScreen({ route, navigation }) { return ( - + diff --git a/src/screens/IniciarScreen.js b/src/screens/IniciarScreen.js index 97d9dc7..0eeb5b7 100644 --- a/src/screens/IniciarScreen.js +++ b/src/screens/IniciarScreen.js @@ -17,7 +17,7 @@ export default function IniciarScreen({ route, navigation }) { showsHorizontalScrollIndicator={false}> diff --git a/src/screens/TrilhasScreen.js b/src/screens/TrilhasScreen.js index 7f697d1..85acbd5 100644 --- a/src/screens/TrilhasScreen.js +++ b/src/screens/TrilhasScreen.js @@ -14,7 +14,7 @@ function TrilhaCard({ item, navigation }) { @@ -41,10 +41,13 @@ function TrilhaCard({ item, navigation }) { export default function TrilhasScreen({ navigation }) { const [isLoading, setLoading] = useState(true); const [data, setData] = useState([]); + const TRAIL_API_BASE_URL = __DEV__ ? 'http://172.26.196.22:5000' : 'google.com'; + const getMovies = async () => { try { - const response = await fetch('http://192.168.0.12:5000/trails/'); + console.log(TRAIL_API_BASE_URL); + const response = await fetch(TRAIL_API_BASE_URL + '/trails/'); const json = await response.json(); console.log(json); setData(json); diff --git a/src/styles/styles.js b/src/styles/styles.js index 7df7710..a7f8f08 100644 --- a/src/styles/styles.js +++ b/src/styles/styles.js @@ -45,7 +45,8 @@ export const styles = StyleSheet.create({ width: '25%', height: 'undefined', aspectRatio: 1, - borderRadius: 4 + borderRadius: 4, + resizeMode: 'contain' }, card : { flex: 1,