Amélioration Géolocalisation

This commit is contained in:
2024-12-19 16:47:41 +01:00
parent abb5c3c584
commit 590539a979
7 changed files with 84 additions and 19 deletions

View File

@ -1,7 +1,9 @@
import { Accuracy } from "expo-location"
import { useAppDispatch, useAppSelector } from "./useStore"
import { GamePayload, PenaltyPayload, setPlayerId, updateActiveChallengeId, updateGameState, updateMoney, updatePenalty } from "@/utils/features/game/gameSlice"
import { GamePayload, PenaltyPayload, setLocationAccuracy, setPlayerId, updateActiveChallengeId, updateGameState, updateMoney, updatePenalty } from "@/utils/features/game/gameSlice"
export const useGame = () => useAppSelector((state) => state.game)
export const useSettings = () => useAppSelector((state) => state.game.settings)
export const useSetPlayerId = () => {
const dispath = useAppDispatch()
return (playerId: number) => dispath(setPlayerId(playerId))
@ -22,3 +24,7 @@ export const useUpdatePenalty = () => {
const dispatch = useAppDispatch()
return (penalty: PenaltyPayload) => dispatch(updatePenalty(penalty))
}
export const useSetLocationAccuracy = () => {
const dispatch = useAppDispatch()
return (accuracy: Accuracy | null) => dispatch(setLocationAccuracy(accuracy))
}