Leon 1 rok temu
rodzic
commit
93baec5338

Plik diff jest za duży
+ 1 - 1
android/app/src/main/assets/index.android.bundle


Plik diff jest za duży
+ 0 - 0
android/app/src/main/assets/index.android.map


BIN
android/app/src/main/res/drawable-mdpi/src_assets_images_center.png


BIN
android/app/src/main/res/drawable-mdpi/src_assets_images_current_location.png


+ 1 - 1
ios/AppDelegate.mm

@@ -131,7 +131,7 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
 - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
 {
 //  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
-#if DEBUGaa
+#if DEBUG
   return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
 #else
   return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

+ 9 - 4
src/features/daynight/DayNightDetailPopup.tsx

@@ -21,7 +21,7 @@ const timezone = require('dayjs/plugin/timezone')
 dayjs.extend(utc)
 dayjs.extend(timezone)
 
-let LinearGradient, useActionSheet,useNavigation
+let LinearGradient, useActionSheet, useNavigation
 if (process.env.TARO_ENV == 'rn') {
     LinearGradient = require('react-native-linear-gradient').default
     useActionSheet = require('@expo/react-native-action-sheet').useActionSheet
@@ -584,6 +584,11 @@ export default function DayNightDetailPopup(props: {
     }
 
     function chooseLocation() {
+        if (process.env.TARO_ENV == 'rn') {
+            jumpPage('', 'map', navigation)
+            props.onClose()
+            return;
+        }
         props.updateLocation()
     }
 
@@ -592,11 +597,11 @@ export default function DayNightDetailPopup(props: {
             e.stopPropagation()
         }
         else {
-            jumpPage('','map',navigation)
-            if (props.onClose){
+            jumpPage('', 'map', navigation)
+            if (props.onClose) {
                 props.onClose()
             }
-            
+
             return
         }
         // else {

+ 47 - 3
src/pages/map/map.tsx

@@ -1,4 +1,4 @@
-import { View, StyleSheet } from "react-native";
+import { View, StyleSheet, Linking } from "react-native";
 import { Image, Text } from "@tarojs/components";
 import './map.scss'
 import { useEffect, useRef, useState } from "react";
@@ -7,6 +7,9 @@ import { LeafletView } from 'react-native-leaflet-maps';
 import { useNavigation } from "@react-navigation/native";
 import { TimeFormatter } from "@/utils/time_format";
 import { systemLocation } from "@/services/common";
+import { useTranslation } from "react-i18next";
+import showAlert from "@/components/basic/Alert";
+import { kIsAndroid, kIsIOS } from "@/utils/tools";
 
 // let LeafletView = require('react-native-leaflet-maps').LeafletView
 let location: any = null
@@ -14,6 +17,7 @@ export default function map() {
     // const [location, setLocation] = useState<any>(null)
     const navigation = useNavigation()
     const [current, setCurrent] = useState<any>(null)
+    const { t } = useTranslation()
     const [show, setShow] = useState(false)
     const [count, setCount] = useState(0)
 
@@ -65,11 +69,51 @@ export default function map() {
     function getCurrent() {
         Taro.getLocation({
             success(res) {
+                // showAlert({
+                //     title: 'location',
+                //     content: JSON.stringify(res)
+                // })
                 setShow(true)
                 setCurrent(res)
                 location = {
                     lat: (res as any).latitude, lng: (res as any).longitude
                 }
+            },
+            fail(res) {
+                console.log('location update failed reason', res)
+                if (res.errMsg == 'Permissions denied!') {
+                    showAlert({
+                        title: t('feature.auth_sys.location_title'),
+                        content: kIsIOS ? t('feature.auth_sys.location_desc') : t('feature.auth_sys.location_android_service_desc'),
+                        showCancel: true,
+                        cancelText: t('feature.auth_sys.location_cancel'),
+                        confirmText: kIsIOS ? t('feature.auth_sys.location_confirm') : t('feature.auth_sys.service_confirm'),
+                        confirm: () => {
+                            if (kIsIOS) {
+                                Linking.openURL('app-settings:')
+                            }
+                            else {
+                                // Linking.openSettings()
+                                var Jto = require('react-native').NativeModules.NativeBridge;
+                                Jto.openNotificationSettings()
+                            }
+
+                        }
+                    })
+                }
+                else {
+                    if (kIsAndroid) {
+
+                        var Jto = require('react-native').NativeModules.NativeBridge;
+                        Jto.getLocation().then(result => {
+                            var res = JSON.parse(result)
+                            setCurrent(res)
+                            location = {
+                                lat: (res as any).latitude, lng: (res as any).longitude
+                            }
+                        })
+                    }
+                }
             }
         })
     }
@@ -141,11 +185,11 @@ export default function map() {
             <Image src={require('@/assets/images/center.png')} style={styles.center} />
         </View>
         <Image src={require('@/assets/images/current_location.png')} onClick={showCurrent} style={styles.location_btn} />
-        <View style={styles.footer}>
+        {/* <View style={styles.footer}>
             {
                 location && <Text style={{ fontSize: 14, color: '#000' }}>Center位置:lat {(location as any).lat.toFixed(4)} lng {(location as any).lng.toFixed(4)}</Text>
             }
-        </View>
+        </View> */}
     </View>
 }
 

+ 2 - 0
src/pages/notification/setting.tsx

@@ -459,6 +459,8 @@ export default function Page() {
             authLocation()
         }
         else {
+            jumpPage('','map',navigation);
+            return;
             if (kIsIOS) {
                 authLocation()
             }

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików