cdmoss пре 2 година
родитељ
комит
227ee3ed32
1 измењених фајлова са 2 додато и 101 уклоњено
  1. 2 101
      src/components/Map/MainMapComponent/OutdoorMap.tsx

+ 2 - 101
src/components/Map/MainMapComponent/OutdoorMap.tsx

@@ -10,21 +10,13 @@ import { RouteProp, useNavigationState } from "@react-navigation/native";
 import { booleanPointInPolygon, circle } from '@turf/turf';
 import * as Notifications from 'expo-notifications';
 import { observer } from "mobx-react";
-<<<<<<< HEAD
 import React, { useEffect, useState } from "react";
-import { ActivityIndicator, Image, Keyboard, Modal, Text, TouchableOpacity, TouchableWithoutFeedback, View } from "react-native";
-import MapView, { LatLng, Marker, Polygon } from "react-native-maps";
+import { ActivityIndicator, Alert, Image, Keyboard, Modal, Text, TouchableOpacity, TouchableWithoutFeedback, View } from "react-native";
+import MapView, { LatLng, Marker, Polygon, Polyline } from "react-native-maps";
 import { ToggleButton } from "react-native-paper";
 import { openSettings } from "react-native-permissions";
 import Spokestack, { activate } from 'react-native-spokestack';
 import { useAuth } from "../../../data/Auth/AuthContext";
-=======
-import React, { useEffect, useRef, useState } from "react";
-import { AppState, Image, Keyboard, Modal, Platform, TouchableOpacity, TouchableWithoutFeedback, Text, View, ActivityIndicator, Alert } from "react-native";
-import MapView, { LatLng, Marker, Polygon, Region, Polyline } from "react-native-maps";
-import { PERMISSIONS } from "react-native-permissions";
-import Spokestack from 'react-native-spokestack';
->>>>>>> global-alerts
 import { Landmark } from '../../../data/landmarks';
 import { NotifType } from "../../../data/notifications";
 import { usePermissions } from "../../../data/PermissionsContext";
@@ -133,97 +125,6 @@ const OutdoorMap: React.FC<OutdoorMapProps> = (props) => {
             mapState.mapRef.current.animateToRegion({ latitude: props.newLandmark?.latitude, longitude: props.newLandmark?.longitude, latitudeDelta: 0.01, longitudeDelta: 0.01 })
         }
     }, [props.newLandmark])
-<<<<<<< HEAD
-=======
-
-
-    /**
-     * Gets speech permissions from user, runs every time app is brought to foreground
-     */
-    useEffect(() => {
-        const getSpeechPermissions = async () => {
-            if (AppState.currentState == 'active') {
-                await getMapPermissions()
-                console.log('[Permissions]: Checking voice permissions...')
-                if (Platform.OS == 'android') {
-                    const permitted = await checkVoicePermissions([PERMISSIONS.ANDROID.RECORD_AUDIO])
-                    mapState.toggleVoicePermission(permitted)
-                    if (permitted) console.log('[Permissions]: Voice permission granted')
-                    else console.log('[Permissions]: Voice permission denied')
-                }
-                else if (Platform.OS == 'ios') {
-                    const permitted = await checkVoicePermissions([PERMISSIONS.IOS.SPEECH_RECOGNITION, PERMISSIONS.IOS.MICROPHONE])
-                    mapState.toggleVoicePermission(permitted)
-                    if (permitted) console.log('[Permissions]: Voice permission granted')
-                    else console.log('[Permissions]: Voice permission denied')
-                }
-            }
-        }
-        getSpeechPermissions()
-    }, [AppState.currentState])
-
-    /**
-     * Gets foreground location permissions from user, runs every time app is brought to foreground
-     */
-    useEffect(() => {
-        const checkForegroundLocationPermissions = async () => {
-            if (AppState.currentState == 'active') {
-                console.log('[Permissions]: Checking location permissions...')
-                if (Platform.OS == 'android') {
-                    const permitted = await checkVoicePermissions([PERMISSIONS.ANDROID.ACCESS_COARSE_LOCATION, PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION])
-                    mapState.toggleFgroundLocationPermission(permitted)
-                    if (permitted) console.log('[Permissions]: Location permission granted')
-                    else console.log('[Permissions]: Location permission denied')
-                }
-                else if (Platform.OS == 'ios') {
-                    const permitted = await checkVoicePermissions([PERMISSIONS.IOS.LOCATION_WHEN_IN_USE])
-                    mapState.toggleFgroundLocationPermission(permitted)
-                    if (permitted) console.log('[Permissions]: Location permission granted')
-                    else console.log('[Permissions]: Location permission denied')
-                }
-            }
-        }
-        checkForegroundLocationPermissions();
-    }, [AppState.currentState])
-
-    /**
-     * Gets background location permissions from user, runs every time app is brought to foreground
-     */
-    useEffect(() => {
-        const checkBackgroundLocationPermissions = async () => {
-            if (AppState.currentState == 'active') {
-                if (Platform.OS == 'android') {
-                    const permitted = await checkVoicePermissions([PERMISSIONS.ANDROID.ACCESS_BACKGROUND_LOCATION])
-                    mapState.toggleBgroundLocationPermission(permitted)
-                    if (permitted) console.log('[Permissions]: Background location permission granted')
-                    else console.log('[Permissions]: Background location permission denied')
-                }
-                else if (Platform.OS == 'ios') {
-                    const permitted = await checkVoicePermissions([PERMISSIONS.IOS.LOCATION_ALWAYS])
-                    mapState.toggleBgroundLocationPermission(permitted)
-                    if (permitted) console.log('[Permissions]: Background location permission granted')
-                    else console.log('[Permissions]: Background location permission denied')
-                }
-            }
-        }
-        checkBackgroundLocationPermissions();
-    }, [AppState.currentState])
-
-    /**
-     * Gets net location permission the existing location permission states. It will check foreground and background permissions and AppState, 
-     * then from that it will decide if location-enabled features should be activated (through the mapState state values).
-     */
-    useEffect(() => {
-        const updateLocationPermissionOnAppStateChange = async () => {
-            const netLocationPermissions = mapState.bgroundLocationPermission || (mapState.fgroundLocationPermission && AppState.currentState == 'active')
-            console.log('[Permissions]: Appstate, or location permissions changed, net location permissions found to be: ' + netLocationPermissions)
-            mapState.toggleLocationPermitted(netLocationPermissions)
-        }
-        updateLocationPermissionOnAppStateChange()
-    }, [AppState.currentState, mapState.bgroundLocationPermission, mapState.fgroundLocationPermission])
-
-
->>>>>>> global-alerts
     /**
      * Animates the map to fly over to and focus on the user's location.
      */