From 6e2eb14e8a688632db439ef14db2c5b7264ab7d5 Mon Sep 17 00:00:00 2001 From: "axel.l.r" <153505101+AxelRENAULT92@users.noreply.github.com> Date: Sat, 13 Apr 2024 01:08:35 +0200 Subject: [PATCH] core(gamescreen): replace secret and fix button (#66) --- eas.json | 6 +++-- package.json | 1 + screens/Gamescreen.js | 24 ++++++++++-------- yarn.lock | 58 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 12 deletions(-) diff --git a/eas.json b/eas.json index 680c47f..322404e 100644 --- a/eas.json +++ b/eas.json @@ -3,9 +3,11 @@ "version": ">= 7.1.2" }, "build": { - "development": { + "development-simulator": { "developmentClient": true, - "distribution": "internal" + "ios": { + "simulator": true + } }, "preview": { "ios": { diff --git a/package.json b/package.json index 1f42ebf..379e557 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "@react-navigation/native-stack": "^6.9.17", "eas-cli": "^7.3.0", "expo": "~49.0.15", + "expo-dev-client": "~2.4.13", "expo-status-bar": "~1.6.0", "mongodb": "^6.3.0", "mongoose": "^8.2.0", diff --git a/screens/Gamescreen.js b/screens/Gamescreen.js index ad0a3cf..9c41b98 100644 --- a/screens/Gamescreen.js +++ b/screens/Gamescreen.js @@ -14,7 +14,6 @@ import { HomeIcon } from "react-native-heroicons/solid"; import { useNavigation } from "@react-navigation/native"; import * as Progress from "react-native-progress"; import { useImage } from "../provider/ImageContext"; -import {API_BASE_URL} from "@env" export default function Gamescreen() { const [isLoading, setIsLoading] = useState(false); @@ -23,6 +22,9 @@ export default function Gamescreen() { const [players, setPlayers] = useState([]); const { backgroundImageSource } = useImage(); + + const apiUrl = process.env.API_BASE_URL; + useEffect(() => { fetchQuestionsAndPlayers(); }, []); // Fetch questions and players initially @@ -31,7 +33,7 @@ export default function Gamescreen() { setIsLoading(true); try { // Fetch and shuffle questions - const questionsResponse = await fetch(`${API_BASE_URL}/api/questions`); + const questionsResponse = await fetch(`${apiUrl}/api/questions`); const questionsData = await questionsResponse.json(); const shuffledQuestions = shuffledArray(questionsData); setQuestions(shuffledQuestions); @@ -60,14 +62,16 @@ export default function Gamescreen() { }; const handleNextRound = () => { - if (currentQuestionIndex + 1 >= questions.length) { - // No more questions, navigate to Endscreen or reset for a new game - navigation.navigate("End"); - } else { - // Increment index to move to the next question - setCurrentQuestionIndex(currentQuestionIndex + 1); - } + + if (currentQuestionIndex + 1 >= questions.length) { + // No more questions, navigate to Endscreen or reset for a new game + navigation.navigate("End"); + } else { + // Increment index to move to the next question + setCurrentQuestionIndex(currentQuestionIndex + 1); + } }; + const navigation = useNavigation(); const goToHomescreen = () => { @@ -157,7 +161,7 @@ export default function Gamescreen() { TOUR SUIVANT diff --git a/yarn.lock b/yarn.lock index 6fccdb5..40bfee6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4753,6 +4753,47 @@ expo-constants@~14.4.2: "@expo/config" "~8.1.0" uuid "^3.3.2" +expo-dev-client@~2.4.13: + version "2.4.13" + resolved "https://registry.yarnpkg.com/expo-dev-client/-/expo-dev-client-2.4.13.tgz#cf8c829e2f815b273db44c17e513d5410af5b7fa" + integrity sha512-EBNJlPntw+DZy7mKxYvpdrmE2GU4YjcEpxSLpwNn2GDwy7e2xXAC2k/25E13BGy3yKPLo1iBXNgB01uleIDdVg== + dependencies: + expo-dev-launcher "2.4.15" + expo-dev-menu "3.2.4" + expo-dev-menu-interface "1.3.0" + expo-manifests "~0.7.0" + expo-updates-interface "~0.10.0" + +expo-dev-launcher@2.4.15: + version "2.4.15" + resolved "https://registry.yarnpkg.com/expo-dev-launcher/-/expo-dev-launcher-2.4.15.tgz#298ac56b523f77c40523453224f75dcc894198bc" + integrity sha512-6oF4NsxlKwuafnyIZvVtMp4OTxRu4Arsw6qJ9s4jDjZuGJtGwgEj9ux3R0YLkDPs8xhsK9Awp0q17RqbQzs1qg== + dependencies: + expo-dev-menu "3.2.3" + resolve-from "^5.0.0" + semver "^7.5.3" + +expo-dev-menu-interface@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/expo-dev-menu-interface/-/expo-dev-menu-interface-1.3.0.tgz#51b6be8c6e0ce73e414ac7a545998dfad0dfdb80" + integrity sha512-WtRP7trQ2lizJJTTFXUSGGn1deIeHaYej0sUynvu/uC69VrSP4EeSnYOxbmEO29kuT/MsQBMGu0P/AkMQOqCOg== + +expo-dev-menu@3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/expo-dev-menu/-/expo-dev-menu-3.2.3.tgz#31c102251d94e9a35fac667cefdbaeae7b1e1375" + integrity sha512-DneF3okTC4AAfAZgaOIylQ/UngSO8SnUT6bRV6nHhJU/jQS1OIP1cZoNW23I100+2yj6x6mobL21PxyiI5VA8g== + dependencies: + expo-dev-menu-interface "1.3.0" + semver "^7.5.3" + +expo-dev-menu@3.2.4: + version "3.2.4" + resolved "https://registry.yarnpkg.com/expo-dev-menu/-/expo-dev-menu-3.2.4.tgz#25ba1efe70bf74ab2d7804eab54212785cd2a01a" + integrity sha512-jPvEY4xGTsiVL6A8M6xThNG+tgCHKlDaWqmWHT+wy2EXgFf/7zE0daVYoFms0KJ1XtZc+/DmDRgIPTR86qIGTg== + dependencies: + expo-dev-menu-interface "1.3.0" + semver "^7.5.3" + expo-file-system@~15.4.0, expo-file-system@~15.4.5: version "15.4.5" resolved "https://registry.npmjs.org/expo-file-system/-/expo-file-system-15.4.5.tgz" @@ -4767,11 +4808,23 @@ expo-font@~11.4.0: dependencies: fontfaceobserver "^2.1.0" +expo-json-utils@~0.7.0: + version "0.7.1" + resolved "https://registry.yarnpkg.com/expo-json-utils/-/expo-json-utils-0.7.1.tgz#efe315c982113204be46419cbc26d4d9a2af145f" + integrity sha512-L0lyH8diXQtV0q5BLbFlcoxTqPF5im79xDHPhybB0j36xYdm65hjwRJ4yMrPIN5lR18hj48FUZeONiDHRyEvIg== + expo-keep-awake@~12.3.0: version "12.3.0" resolved "https://registry.npmjs.org/expo-keep-awake/-/expo-keep-awake-12.3.0.tgz" integrity sha512-ujiJg1p9EdCOYS05jh5PtUrfiZnK0yyLy+UewzqrjUqIT8eAGMQbkfOn3C3fHE7AKd5AefSMzJnS3lYZcZYHDw== +expo-manifests@~0.7.0: + version "0.7.2" + resolved "https://registry.yarnpkg.com/expo-manifests/-/expo-manifests-0.7.2.tgz#77c2d9476e8130fc9ca6d4274fa1a5495d34358e" + integrity sha512-xlhL0XI2zw3foJ0q2Ra4ieBhU0V2yz+Rv6GpVEaaIHFlIC/Dbx+mKrX5dgenZEMERr/MG7sRJaRbAVB2PaAYhA== + dependencies: + expo-json-utils "~0.7.0" + expo-modules-autolinking@1.5.1: version "1.5.1" resolved "https://registry.npmjs.org/expo-modules-autolinking/-/expo-modules-autolinking-1.5.1.tgz" @@ -4797,6 +4850,11 @@ expo-status-bar@~1.6.0: resolved "https://registry.yarnpkg.com/expo-status-bar/-/expo-status-bar-1.6.0.tgz#e79ffdb9a84d2e0ec9a0dc7392d9ab364fefa9cf" integrity sha512-e//Oi2WPdomMlMDD3skE4+1ZarKCJ/suvcB4Jo/nO427niKug5oppcPNYO+csR6y3ZglGuypS+3pp/hJ+Xp6fQ== +expo-updates-interface@~0.10.0: + version "0.10.1" + resolved "https://registry.yarnpkg.com/expo-updates-interface/-/expo-updates-interface-0.10.1.tgz#cab075641cd381718ccd9264bf133dc393430a44" + integrity sha512-I6JMR7EgjXwckrydDmrkBEX/iw750dcqpzQVsjznYWfi0HTEOxajLHB90fBFqQkUV5i5s4Fd3hYQ1Cn0oMzUbA== + expo@~49.0.15: version "49.0.21" resolved "https://registry.npmjs.org/expo/-/expo-49.0.21.tgz"