Skip to content

Commit

Permalink
rename gps components
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdanprog committed Apr 23, 2024
1 parent b9b5f28 commit 4aef7bc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ const m = defineMessages({
},
});

interface GPSDisabled {
interface GPSPermissionsDisabled {
setIsGranted: React.Dispatch<React.SetStateAction<boolean | null>>;
}
export const GPSDisabled: React.FC<GPSDisabled> = ({setIsGranted}) => {
export const GPSPermissionsDisabled: React.FC<GPSPermissionsDisabled> = ({
setIsGranted,
}) => {
const {formatMessage} = useIntl();
const requestForLocationPermissions = async () => {
const [foregroundPermission, backgroundPermission] = await Promise.all([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const m = defineMessages({
},
});

export const GPSEnabled = () => {
export const GPSPermissionsEnabled = () => {
const {formatMessage} = useIntl();
const {isTracking, cancelTracking, startTracking, loading} = useTracking();
const {timer} = useTrackTimerContext();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {useEffect, useState} from 'react';
import {GPSDisabled} from './GPSPermissionsDisabled';
import {GPSEnabled} from './GPSPermissionsEnabled';
import {GPSPermissionsDisabled} from './GPSPermissionsDisabled';
import {GPSPermissionsEnabled} from './GPSPermissionsEnabled';
import * as Location from 'expo-location';
import {useGPSModalContext} from '../../../contexts/GPSModalContext';
import {useTabNavigationStore} from '../../../hooks/useTabNavigationStore.ts';
Expand All @@ -10,7 +10,7 @@ import {StyleSheet} from 'react-native';
import {TabName} from '../../../Navigation/types';
import {useFocusEffect} from '@react-navigation/native';

export const GPSModal = React.memo(() => {
export const GPSPermissionsModal = React.memo(() => {
const {setCurrentTab} = useTabNavigationStore();
const [backgroundStatus] = Location.useBackgroundPermissions();
const [foregroundStatus] = Location.useForegroundPermissions();
Expand Down Expand Up @@ -41,9 +41,9 @@ export const GPSModal = React.memo(() => {
handleComponent={() => null}>
<BottomSheetView>
{isGranted ? (
<GPSEnabled />
<GPSPermissionsEnabled />
) : (
<GPSDisabled setIsGranted={setIsGranted} />
<GPSPermissionsDisabled setIsGranted={setIsGranted} />
)}
</BottomSheetView>
</BottomSheetModal>
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/screens/MapScreen/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import ScaleBar from 'react-native-scale-bar';
import {getCoords} from '../../hooks/useLocation';
import {useLastKnownLocation} from '../../hooks/useLastSavedLocation';
import {useLocationProviderStatus} from '../../hooks/useLocationProviderStatus';
import {GPSModal} from './GPSPermissions/GPSPermissionsModal';
import {GPSPermissionsModal} from './GPSPermissions/GPSPermissionsModal';
import {TrackPathLayer} from './track/TrackPathLayer';
import {UserLocation} from './UserLocation';
import {useSharedLocationContext} from '../../contexts/SharedLocationContext';
Expand Down Expand Up @@ -122,7 +122,7 @@ export const MapScreen = () => {
onPress={handleAddPress}
isLoading={!isFinishedLoading}
/>
<GPSModal />
<GPSPermissionsModal />
</View>
);
};
Expand Down

0 comments on commit 4aef7bc

Please sign in to comment.