Viktoriia vor 5 Monaten
Ursprung
Commit
d88eb7aabd
5 geänderte Dateien mit 12 neuen und 129 gelöschten Zeilen
  1. 1 10
      app.config.ts
  2. 9 0
      eas.json
  3. 1 1
      package.json
  4. 1 33
      src/screens/InAppScreens/MapScreen/index.tsx
  5. 0 85
      src/utils/backgroundLocation.ts

+ 1 - 10
app.config.ts

@@ -26,7 +26,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
   // Should be updated after every production release (deploy to AppStore/PlayMarket)
   version: '2.0.29',
   // Should be updated after every dependency change
-  runtimeVersion: '1.5',
+  runtimeVersion: '1.6',
   orientation: 'portrait',
   icon: './assets/icon.png',
   userInterfaceStyle: 'light',
@@ -83,8 +83,6 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
         'Nomadmania app needs access to the documents folder to select files.',
       NSCameraUsageDescription: 'Nomadmania app needs access to the camera to record video.',
       NSLocationWhenInUseUsageDescription:
-        'NomadMania app needs access to your location to show relevant data.',
-      NSLocationAlwaysAndWhenInUseUsageDescription:
         'NomadMania app needs access to your location to show relevant data.'
     },
     privacyManifests: {
@@ -162,12 +160,5 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
       }
     ],
     ['@maplibre/maplibre-react-native']
-    // [
-    //   'expo-location',
-    //   {
-    //     isIosBackgroundLocationEnabled: true,
-    //     isAndroidBackgroundLocationEnabled: true
-    //   }
-    // ]
   ]
 });

+ 9 - 0
eas.json

@@ -31,6 +31,12 @@
         "ENV": "development"
       }
     },
+    "testflight": {
+      "channel": "development",
+      "env": {
+        "ENV": "production"
+      }
+    },
     "production": {
       "channel": "production",
       "android": {
@@ -51,6 +57,9 @@
     }
   },
   "submit": {
+    "testflight": {
+      "ascAppId": "6502843543"
+    },
     "production": {}
   }
 }

+ 1 - 1
package.json

@@ -13,7 +13,7 @@
   },
   "dependencies": {
     "@expo/config-plugins": "^8.0.8",
-    "@maplibre/maplibre-react-native": "^10.0.0-alpha.22",
+    "@maplibre/maplibre-react-native": "^10.0.0-alpha.28",
     "@react-native-clipboard/clipboard": "^1.14.2",
     "@react-native-community/datetimepicker": "8.0.1",
     "@react-native-community/netinfo": "11.3.1",

+ 1 - 33
src/screens/InAppScreens/MapScreen/index.tsx

@@ -83,10 +83,6 @@ import MapButton from 'src/components/MapButton';
 import { useAvatarStore } from 'src/stores/avatarVersionStore';
 import _ from 'lodash';
 import ScaleBar from 'src/components/ScaleBar';
-// import {
-//   startBackgroundLocationUpdates,
-//   stopBackgroundLocationUpdates
-// } from 'src/utils/backgroundLocation';
 
 const defaultUserAvatar = require('assets/icon-user-share-location-solid.png');
 const logo = require('assets/logo-ua.png');
@@ -625,24 +621,9 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
       ) {
         setShowNomads(false);
         storage.set('showNomads', false);
-        // await stopBackgroundLocationUpdates();
         return;
       }
 
-      // const bgStatus = await Location.getBackgroundPermissionsAsync();
-      // if (bgStatus.status !== 'granted') {
-      //   const { status } = await Location.requestBackgroundPermissionsAsync();
-      //   if (status === Location.PermissionStatus.GRANTED) {
-      //     await startBackgroundLocationUpdates();
-      //     console.log('[Permissions] Background granted');
-      //   } else {
-      //     console.log('[Permissions] Background denied');
-      //   }
-      // } else {
-      //   await startBackgroundLocationUpdates();
-      //   console.log('[Permissions] Background already granted');
-      // }
-
       try {
         let currentLocation = await Location.getCurrentPositionAsync({
           accuracy: Location.Accuracy.Balanced
@@ -913,19 +894,6 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
 
       if (status === 'granted' && isServicesEnabled) {
         await getLocation();
-        // const bgStatus = await Location.getBackgroundPermissionsAsync();
-        // if (bgStatus.status !== 'granted') {
-        //   const { status } = await Location.requestBackgroundPermissionsAsync();
-        //   if (status === Location.PermissionStatus.GRANTED) {
-        //     await startBackgroundLocationUpdates();
-        //     console.log('[Permissions] Background granted');
-        //   } else {
-        //     console.log('[Permissions] Background denied');
-        //   }
-        // } else {
-        //   await startBackgroundLocationUpdates();
-        //   console.log('[Permissions] Background already granted');
-        // }
       } else if (!canAskAgain || !isServicesEnabled) {
         setOpenSettingsVisible(true);
       } else {
@@ -1199,7 +1167,7 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
       <MapLibreGL.MapView
         ref={mapRef}
         style={styles.map}
-        styleJSON={VECTOR_MAP_HOST + '/nomadmania-maps.json'}
+        mapStyle={VECTOR_MAP_HOST + '/nomadmania-maps.json'}
         rotateEnabled={false}
         attributionEnabled={false}
         onPress={onMapPress}

+ 0 - 85
src/utils/backgroundLocation.ts

@@ -1,85 +0,0 @@
-// import * as TaskManager from 'expo-task-manager';
-import * as Location from 'expo-location';
-import axios from 'axios';
-import { storage, StoreType } from 'src/storage';
-import { Platform } from 'react-native';
-import { API_URL } from 'src/constants';
-import { API } from 'src/types';
-
-const LOCATION_TASK_NAME = 'BACKGROUND_LOCATION_TASK';
-
-// TaskManager.defineTask(LOCATION_TASK_NAME, async ({ data, error }) => {
-//   if (error) {
-//     console.error('[BackgroundLocation] Task error:', error);
-//     return;
-//   }
-//   if (data) {
-//     const { locations } = data as any;
-//     if (locations && locations.length > 0) {
-//       const { coords, timestamp } = locations[0];
-
-//       console.log('[BackgroundLocation] New location:', coords);
-//       const token = storage.get('token', StoreType.STRING);
-
-//       if (!token) {
-//         return;
-//       }
-
-//       try {
-//         const response = await axios.postForm(
-//           API_URL + '/' + API.UPDATE_LOCATION,
-//           {
-//             token,
-//             lat: coords.latitude,
-//             lng: coords.longitude,
-//             background: LOCATION_TASK_NAME,
-//             location_timestamp: timestamp
-//           },
-//           {
-//             headers: {
-//               Platform: Platform.OS
-//             }
-//           }
-//         );
-//         console.log('[BackgroundLocation] Location sent:', response.data);
-//       } catch (sendError) {
-//         console.error('[BackgroundLocation] Sending location failed:', sendError);
-//       }
-//     }
-//   }
-//   console.log('[BackgroundLocation] TaskManager end');
-// });
-
-export const startBackgroundLocationUpdates = async () => {
-  const hasStarted = await Location.hasStartedLocationUpdatesAsync(LOCATION_TASK_NAME);
-  if (hasStarted) {
-    console.log('[BackgroundLocation] Already started...');
-    return;
-  }
-
-  await Location.startLocationUpdatesAsync(LOCATION_TASK_NAME, {
-    accuracy: Location.Accuracy.Highest,
-    // 10 minutes for Android
-    timeInterval: 10 * 60 * 1000,
-    showsBackgroundLocationIndicator: false,
-    pausesUpdatesAutomatically: false,
-    // banner on Android
-    foregroundService: {
-      notificationTitle: 'NomadMania tracking your location',
-      notificationBody: 'Location is used in background every 10 minutes.',
-      notificationColor: '#0F3F4F'
-    },
-    // iOS only
-    activityType: Location.ActivityType.Other
-  });
-
-  console.log('[BackgroundLocation] Started task');
-};
-
-export const stopBackgroundLocationUpdates = async () => {
-  const hasStarted = await Location.hasStartedLocationUpdatesAsync(LOCATION_TASK_NAME);
-  if (hasStarted) {
-    await Location.stopLocationUpdatesAsync(LOCATION_TASK_NAME);
-    console.log('[BackgroundLocation] Stopped task');
-  }
-};