|
@@ -420,6 +420,7 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
|
|
|
const hideTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
|
|
|
|
const [markerCoords, setMarkerCoords] = useState<any>(null);
|
|
|
+ const [interval, setInterval] = useState(0);
|
|
|
|
|
|
const isSmallScreen = Dimensions.get('window').width < 383;
|
|
|
const processedImages = useRef(new Set<string>());
|
|
@@ -701,11 +702,27 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
|
|
|
}, [])
|
|
|
);
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ if (interval > 0 && showNomads) {
|
|
|
+ const intervalId = setInterval(() => {
|
|
|
+ if (location && token && showNomads) {
|
|
|
+ refetchUsersLocation();
|
|
|
+ }
|
|
|
+ }, interval);
|
|
|
+
|
|
|
+ return () => clearInterval(intervalId);
|
|
|
+ }
|
|
|
+ }, [interval, showNomads]);
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
(async () => {
|
|
|
let { status } = await Location.getForegroundPermissionsAsync();
|
|
|
const isServicesEnabled = await Location.hasServicesEnabledAsync();
|
|
|
|
|
|
+ if (locationSettings && locationSettings.sharing_refresh_interval) {
|
|
|
+ setInterval(locationSettings.sharing_refresh_interval * 1000);
|
|
|
+ }
|
|
|
+
|
|
|
if (
|
|
|
status !== 'granted' ||
|
|
|
!token ||
|