leon 1 рік тому
батько
коміт
fa160dde24

Різницю між файлами не показано, бо вона завелика
+ 1 - 1
android/app/src/main/assets/index.android.bundle


Різницю між файлами не показано, бо вона завелика
+ 0 - 0
android/app/src/main/assets/index.android.map


+ 178 - 59
src/app/time_of_day/index_time.tsx

@@ -6,8 +6,15 @@ import Rings, { RingCommon, BgRing, CurrentDot } from "@/features/trackTimeDurat
 import { useEffect, useState } from "react";
 import DeviceInfo from 'react-native-device-info';
 import dayjs from "dayjs";
+import moment from 'moment-timezone'
 import Modal from "@/components/layout/Modal.weapp";
-import { loginAnonymous } from "./services/net";
+import { loginAnonymous, place } from "./services/net";
+import Taro from "@tarojs/taro";
+import { useTranslation } from "react-i18next";
+import 'dayjs/locale/zh-cn';
+import 'dayjs/locale/en';
+
+
 
 let LinearGradient, useActionSheet, useNavigation
 if (process.env.TARO_ENV == 'rn') {
@@ -24,26 +31,91 @@ export default function IndexTimePage() {
 
     const [count, setCount] = useState(0)
     const [showLanguage, setShowLanguage] = useState(false)
+    const [isEn, setIsEn] = useState(true)
     const [showDst, setShowDst] = useState(false)
+    const [current, setCurrent] = useState<any>(null)
+    const { t, i18n } = useTranslation()
 
 
     useEffect(() => {
+        getLanguage();
         login()
         setInterval(() => {
             setCount(t => t + 1)
         }, 1000)
     }, [])
 
-    function login(){
-        loginAnonymous(DeviceInfo.getDeviceSync()).then(res=>{
-            console.log('login success',res)
-        }).catch(e=>{
-            console.log('login error',e)
+    async function getLanguage() {
+        var language = await getStorage('language') || 'en'
+        global.language = language;
+        i18n.changeLanguage(language)
+        setIsEn(language == 'en')
+        dayjs.locale(language == 'en' ? 'en' : 'zh-cn');
+        moment.locale(language == 'en' ? 'en' : 'zh-cn');
+    }
+
+    async function getStorage(key: string) {
+        try {
+            const res = await Taro.getStorage({ key });
+            return res.data;
+        } catch {
+            return '';
+        }
+    }
+
+    function changeLanguage(isEnglish: boolean) {
+        global.language = isEnglish ? 'en' : 'zh';
+        i18n.changeLanguage(isEnglish ? 'en' : 'zh')
+        setIsEn(isEnglish)
+        Taro.setStorage({ key: 'language', data: isEnglish ? 'en' : 'zh' })
+        setShowLanguage(false)
+        dayjs.locale(isEnglish ? 'en' : 'zh-cn');
+        moment.locale(isEnglish ? 'en' : 'zh-cn');
+    }
+
+    function login() {
+        loginAnonymous(DeviceInfo.getDeviceSync()).then(res => {
+            console.log('login success', res)
+        }).catch(e => {
+            console.log('login error', e)
         })
     }
 
-    function chooseLocation() {
-        jumpPage('', 'map', navigation)
+    function goMap() {
+        jumpPage('', 'map', navigation, { source: 'time_of_day', chooseLocation: chooseLocation })
+    }
+
+    function chooseLocation(res: any) {
+        place(res.lat, res.lng).then(res => {
+            console.log(res)
+            setCurrent((res as any).location)
+            saveLocation((res as any).location)
+        }).catch(e => {
+            console.log(e)
+        })
+    }
+
+    function saveLocation(location: any) {
+
+    }
+
+    function getLocation() {
+        if (current.geo) {
+            if (current.geo.city) {
+                return current.geo.city
+            }
+            if (current.geo.country) {
+                return current.geo.country
+            }
+        }
+        return t('time_of_day.index.unknown')
+    }
+
+    function getTimezone() {
+        if (current.time && current.time.timezone) {
+            return current.time.timezone.abbrev + ' · ' + current.time.timezone.name
+        }
+        return ''
     }
 
     const common: RingCommon = {
@@ -66,65 +138,105 @@ export default function IndexTimePage() {
             borderColor: '#ffffff',
             offset: 0
         }
-
-        // var common = getCommon(null, true)
-        // common.radius = 115;
-        // common.lineWidth = 26;
-        // var bgRing = getBgRing()
-        // var realRing = getReal(record, false, false)
-        // return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={'small'} />
         return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={'smal11l'} />
     }
 
     function languageModalContent() {
         return <View className="modal_bg">
             <View className="language_content">
-                <View className="language_item">
+                <View className="language_item" onClick={() => changeLanguage(true)}>
                     <Text className="language_text">English</Text>
-                    <Image className="check" src={require('@assets/index_time/check.png')} />
+                    {
+                        isEn && <Image className="check" src={require('@assets/index_time/check.png')} />
+                    }
+
                 </View>
                 <View className="line" />
-                <View className="language_item">
+                <View className="language_item" onClick={() => changeLanguage(false)}>
                     <Text className="language_text">中文</Text>
+                    {
+                        !isEn && <Image className="check" src={require('@assets/index_time/check.png')} />
+                    }
                 </View>
             </View>
         </View>
     }
 
+    function formatTime(format: string, timestamp?: number) {
+        // var moment = require('moment-timezone');
+        if (current) {
+            if (timestamp) {
+                return dayjs(timestamp).tz(current.time.timezone.id).format(format)
+            }
+            return dayjs().tz(current.time.timezone.id).format(format)
+        }
+
+        return dayjs().format(format)
+    }
+
+    function dstTitle(index: number) {
+        if (index == 0) {
+            return t('time_of_day.index.last_change')
+        }
+        return t('time_of_day.index.next_change')
+    }
+
+    function dstDesc(item: any, index: number) {
+        if (index == 0) {
+            if (item.new_dst > 0) {
+                return t('time_of_day.index.summer_started')
+            }
+            return t('time_of_day.index.winter_started')
+        }
+        if (item.new_dst > 0) {
+            return t('time_of_day.index.summer_starts')
+        }
+        return t('time_of_day.index.winter_starts')
+    }
+
+    function dstNote(item:any){
+        var str = moment(item.timestamp).tz(current.time.timezone.id).format('YYYY-MM-DDTHH:mm:ss')
+        var str2 = moment(item.timestamp-1).tz(current.time.timezone.id).format('YYYY-MM-DDTHH:mm:ss')
+        console.log(str,str2)
+        debugger
+        return 'Time was set forward 1 hour from 02:00 to 03:00.\nTime zone changed to UTC-7, Pacific Daylight Time (PDT).'
+    }
+
+    function isNight(){
+        var hour = new Date().getHours()
+        if (current) {
+            var strHour = moment().tz(current.time.timezone.id).format('H')
+            hour = parseInt(strHour)
+        }
+        
+        if (hour>=18 || hour<6){
+            return true
+        }
+        return false
+    }
+
     function dstModalContent() {
         return <View className="modal_bg">
-            <View className="dst_content">
-                <View className="dst_item">
-                    <View className="dst_card">
-                        <Text className="month">{dayjs().format('MMMM')}</Text>
-                        <Text className="day">{dayjs().format('D')}</Text>
-                        <Text className="week">{dayjs().format('dddd')}</Text>
-                        <Text className="year">{dayjs().format('YYYY')}</Text>
-                    </View>
-                </View>
-                <View style={{flex:1}}>
-                    <Text className="dst_title">Last change</Text>
-                    <Text className="dst_desc">Summer time started</Text>
-                    <Text className="dst_note"> Time was set forward 1 hour from 02:00 to 03:00.
-                    Time zone changed to UTC-7, Pacific Daylight Time (PDT).</Text>
-                </View>
-            </View>
-            <View className="dst_content">
-                <View className="dst_item">
-                    <View className="dst_card">
-                        <Text className="month">{dayjs().format('MMMM')}</Text>
-                        <Text className="day">{dayjs().format('D')}</Text>
-                        <Text className="week">{dayjs().format('dddd')}</Text>
-                        <Text className="year">{dayjs().format('YYYY')}</Text>
+            {
+                current.time_changes.map((item, index) => {
+                    return <View className="dst_content" key={index}>
+                        <View className="dst_item">
+                            <View className="dst_card">
+                                <Text className="month">{formatTime('MMMM', item.timestamp)}</Text>
+                                <Text className="day">{formatTime('D', item.timestamp)}</Text>
+                                <Text className="week">{formatTime('dddd', item.timestamp)}</Text>
+                                <Text className="year">{formatTime('YYYY', item.timestamp)}</Text>
+                            </View>
+                        </View>
+                        <View style={{ flex: 1 }}>
+                            <Text className="dst_title">{dstTitle(index)}</Text>
+                            <Text className="dst_desc">{dstDesc(item, index)}</Text>
+                            <Text className="dst_note">{dstNote(item)}</Text>
+                        </View>
                     </View>
-                </View>
-                <View style={{flex:1}}>
-                    <Text className="dst_title">Last change</Text>
-                    <Text className="dst_desc">Summer time started</Text>
-                    <Text className="dst_note"> Time was set forward 1 hour from 02:00 to 03:00.
-                    Time zone changed to UTC-7, Pacific Daylight Time (PDT).</Text>
-                </View>
-            </View>
+                })
+            }
+
         </View>
     }
 
@@ -134,29 +246,36 @@ export default function IndexTimePage() {
                 ring()
             }
             <View className="ring_center">
-                <Image className="sun" src={require('@assets/index_time/sun.png')} />
-                <Text className="time">{dayjs().format('HH:mm:ss')}</Text>
-                <Text className="date">{dayjs().format('dddd, MMM DD')}</Text>
+                <Image className="sun" src={isNight()?require('@assets/index_time/moon.png'):require('@assets/index_time/sun.png')} />
+                <Text className="time">{formatTime('HH:mm:ss')}</Text>
+                <Text className="date">{global.language == 'en' ? formatTime('dddd, MMM DD') : formatTime('MMMD dddd')}</Text>
             </View>
         </View>
 
         <View className="location">
             <Image className="location_icon" src={require('@assets/index_time/pin.png')} />
-            <Text className="location_text">Beijing</Text>
+            <Text className="location_text">{current ? getLocation() : t('time_of_day.index.unknown')}</Text>
         </View>
 
-        <View style={{ flexDirection: 'row', marginTop: 10, alignItems: 'center' }} onClick={() => setShowDst(true)}>
-            <Text className="timezone">UTC+8</Text>
-            <Image className="location_icon" src={require('@assets/index_time/arrow_right.png')} />
+        <View style={{ flexDirection: 'row', marginTop: 10, alignItems: 'center' }} onClick={() => {
+            if (current && current.time && current.time.timezone.use_dst) {
+                setShowDst(true)
+            }
+        }}>
+            <Text className="timezone">{current ? getTimezone() : 'UTC+8'}</Text>
+            {
+                current && current.time && current.time.timezone.use_dst && <Image className="location_icon" src={require('@assets/index_time/arrow_right.png')} />
+            }
+
         </View>
 
 
-        <View className="btn_bg" onClick={chooseLocation}>
-            <Text className="btn_text">Pick Location</Text>
+        <View className="btn_bg" onClick={goMap}>
+            <Text className="btn_text">{t('time_of_day.index.pick_location')}</Text>
             <Image className="more" src={require('@assets/index_time/more.png')} />
         </View>
         <View className="footer" onClick={() => setShowLanguage(true)}>
-            <Text className="footer_text">English</Text>
+            <Text className="footer_text">{isEn ? 'English' : '中文'}</Text>
             <Image className="footer_icon" src={require('@assets/index_time/arrow.png')} />
         </View>
         {

+ 14 - 0
src/app/time_of_day/services/net.tsx

@@ -1,6 +1,7 @@
 import { request } from "@/services/http/request"
 const baseUrl = 'https://api.fast.dev.liveplus.fun'
 const API_LOGIN_ANONYMOUS = `${baseUrl}/api/user/login/anonymous`
+const API_PLACE = `${baseUrl}/api/time/place`
 
 export const loginAnonymous = (uuid: string) => {
 
@@ -14,4 +15,17 @@ export const loginAnonymous = (uuid: string) => {
             reject(e)
         })
     })
+}
+
+export const place = (lat: string, lng: string) => {
+    return new Promise((resolve, reject) => {
+        request({
+            url: API_PLACE, method: 'GET', data: { lat, lng,timestamp:new Date().getTime() }
+        }).then(res => {
+            resolve(res)
+            // dispatch(loginSuccess(res));
+        }).catch(e => {
+            reject(e)
+        })
+    })
 }

+ 87 - 74
src/context/locales/en.js

@@ -16,15 +16,15 @@ export default {
         clock: {
             title: 'Circadian',
         },
-        reminders:{
-            title:'Reminders',
+        reminders: {
+            title: 'Reminders',
         },
         activity: {
             title: 'Activity',
         },
         metric: {
             title: 'Metrics',
-            unit_options:'Unit options'
+            unit_options: 'Unit options'
         },
         food: {
             title: 'Breakfast Journal',
@@ -35,7 +35,7 @@ export default {
         explore: {
             title: 'Explore',
             share_title: 'My explore',
-            journal:'Journals'
+            journal: 'Journals'
         },
         more: {
             title: 'Profile',
@@ -45,8 +45,8 @@ export default {
             setting: 'Settings',
             reset_session: 'Reset session',
             debug_mode: 'Debug mode',
-            pro_member:'Pro Member',
-            member_desc:'Premium access to Pro features till {{time}}.',
+            pro_member: 'Pro Member',
+            member_desc: 'Premium access to Pro features till {{time}}.',
         },
         choose_scenario: {
             title: 'Select Circadian Clock',
@@ -87,14 +87,14 @@ export default {
         },
         auth: {
             agreement: 'I have read and agreed to the User Agreement and Privacy Policy',
-            psd_repeat_diff:'Passwords do not match.'
+            psd_repeat_diff: 'Passwords do not match.'
         },
         records_history: {
             time_title: 'History',
             metric_title: '{{title}} Records',
             activity_title: '{{title}} Records',
             del_success: 'Deletion successful',
-            del_action_title:'This record will be deleted permanently.'
+            del_action_title: 'This record will be deleted permanently.'
         },
         setting: {
             title: 'Settings',
@@ -110,45 +110,45 @@ export default {
         edit_nickname: {
             title: 'Edit Nickname'
         },
-        reminders:{
-            title:'Reminders',
-            fast_sleep:'Fast & Sleep',
-            base:'Reminders',
-            base_schedule_time:'At schedule time',
-            always:'Always',
-            off:'Off',
-            base_footer:'A timely reminder so you never miss your schedule time for fasting and/or sleep.',
-            extra:'Extra Reminders',
-            missed_action:'Missed previous action',
-            extra_footer:'In case you missed your previous action, receive another reminder to log it together with the current one. This gives you extra protection against any streak loss.',
-            sun:'The Sun (Pro)',
-            sun_header:'Reminders for Your Daily Local Solar Times',
-            sun_footer:'Note for polar region, during Polar Day (Midnight Sun) when the Sun is up all day or Polar Night when the Sun is down all day, the only reminder available is the daily Solar Noon.',
-            sunrise:'Sunrise',
-            sunset:'Sunset',
-            solarnoon:'Solar noon',
-            pro_feature:'Pro Feature',
-            pro_sun_desc:'Unlock exclusive features such as reminders for daily sunrise, sunset, etc.',
-            become_pro:'Become a Pro Member',
-            not_now:'Not now',
-            open:'Follow'
+        reminders: {
+            title: 'Reminders',
+            fast_sleep: 'Fast & Sleep',
+            base: 'Reminders',
+            base_schedule_time: 'At schedule time',
+            always: 'Always',
+            off: 'Off',
+            base_footer: 'A timely reminder so you never miss your schedule time for fasting and/or sleep.',
+            extra: 'Extra Reminders',
+            missed_action: 'Missed previous action',
+            extra_footer: 'In case you missed your previous action, receive another reminder to log it together with the current one. This gives you extra protection against any streak loss.',
+            sun: 'The Sun (Pro)',
+            sun_header: 'Reminders for Your Daily Local Solar Times',
+            sun_footer: 'Note for polar region, during Polar Day (Midnight Sun) when the Sun is up all day or Polar Night when the Sun is down all day, the only reminder available is the daily Solar Noon.',
+            sunrise: 'Sunrise',
+            sunset: 'Sunset',
+            solarnoon: 'Solar noon',
+            pro_feature: 'Pro Feature',
+            pro_sun_desc: 'Unlock exclusive features such as reminders for daily sunrise, sunset, etc.',
+            become_pro: 'Become a Pro Member',
+            not_now: 'Not now',
+            open: 'Follow'
         }
     },
     feature: {
-        pro:{
-            for_pro:'For Pro',
-            tag:'Limit-Time Offer'
+        pro: {
+            for_pro: 'For Pro',
+            tag: 'Limit-Time Offer'
         },
         auth_sys: {
-            device_location:'Unable to use location info',
-            device_location_desc:'Go to Location settings and turn on location.',
+            device_location: 'Unable to use location info',
+            device_location_desc: 'Go to Location settings and turn on location.',
             location_title: 'Unable to use location info',
             location_desc: 'Go to app Settings, tap Location and choose \'While Using the App.\' If Location is unavailable, go back to global Settings > Privacy and enable Location Services first.',
-            location_android_service_desc:'Go to App info, tap Permissions > Location and choose \'Allow only while using the app.\'',
+            location_android_service_desc: 'Go to App info, tap Permissions > Location and choose \'Allow only while using the app.\'',
             location_cancel: 'Close',
             location_confirm: 'Settings',
-            device_confirm:'Enable location',
-            service_confirm:'Allow access',
+            device_confirm: 'Enable location',
+            service_confirm: 'Allow access',
         },
         choose_scenario: {
             title: 'Choose Circadain Clock',
@@ -208,9 +208,9 @@ export default {
             done: 'Done',
             next_day: 'Next day ',
         },
-        pay:{
-            paying_title:'Your payment is processing...',
-            paying_desc:'Please wait for transaction completion.',
+        pay: {
+            paying_title: 'Your payment is processing...',
+            paying_desc: 'Please wait for transaction completion.',
         },
 
         check_access: {
@@ -276,22 +276,22 @@ export default {
                 pick_earlier_end: 'Pick an earlier end',
             }
         },
-        location:{
-            no_location:'No location info yet.',
-            clear_info:'Clear location info',
-            clear_alert_title:'Alert',
-            clear_alert_content:'Your local sunrise & sunset info will be removed once you clear your location info. Are you sure you want to clear your info?',
-            clear_alert_cancel:'Cancel',
-            clear_alert_confirm:'Clear info'
-        },
-        heads_up:{
-            alert_title:'Heads-up',
-            ongoing1_content:'You haven\'t logged your sleep.you end fasting now, If you will lose your premium access to \'Fasting with Sleep.\'',
-            ongoing1_cancel:'Log my sleep first',
-            ongoing1_confirm:'End fasting',
-            ongoing2_content:'You haven\'t finished your sleep log. If you end fasting now, you will lose your premium access to \'Fasting with Sleep.\'',
-            ongoing2_cancel:'Finish my sleep log',
-            ongoing2_confirm:'End fasting',
+        location: {
+            no_location: 'No location info yet.',
+            clear_info: 'Clear location info',
+            clear_alert_title: 'Alert',
+            clear_alert_content: 'Your local sunrise & sunset info will be removed once you clear your location info. Are you sure you want to clear your info?',
+            clear_alert_cancel: 'Cancel',
+            clear_alert_confirm: 'Clear info'
+        },
+        heads_up: {
+            alert_title: 'Heads-up',
+            ongoing1_content: 'You haven\'t logged your sleep.you end fasting now, If you will lose your premium access to \'Fasting with Sleep.\'',
+            ongoing1_cancel: 'Log my sleep first',
+            ongoing1_confirm: 'End fasting',
+            ongoing2_content: 'You haven\'t finished your sleep log. If you end fasting now, you will lose your premium access to \'Fasting with Sleep.\'',
+            ongoing2_cancel: 'Finish my sleep log',
+            ongoing2_confirm: 'End fasting',
         },
         common: {
             prompt: 'Prompt',
@@ -384,14 +384,14 @@ export default {
                 logout_title: 'Log out',
                 logout_content: 'Are you sure you want to log out?',
 
-                del:'Delete',
+                del: 'Delete',
                 deluser_title: 'Confirm Deletion of Account',
                 deluser_content: 'This action cannot be undone.\nAre you sure you want to delete this account?',
-                deluser_cancel:'Cancel',
-                deluser_confirm:'Confirm Deletion',
-                deluser_action_title:'This account will be deleted permanently.',
-                deluser_action_confirm:'Delete Account',
-                deluser_action_cancel:'Cancel',
+                deluser_cancel: 'Cancel',
+                deluser_confirm: 'Confirm Deletion',
+                deluser_action_title: 'This account will be deleted permanently.',
+                deluser_action_confirm: 'Delete Account',
+                deluser_action_cancel: 'Cancel',
 
                 reset_session_title: 'Reset session',
                 reset_session_content: 'Are you sure you want to reset the session?'
@@ -413,7 +413,7 @@ export default {
                 footer_desc: 'Already have an account?',
                 footer_login: 'Log in',
                 btn_next: 'Next',
-                login:'Log in'
+                login: 'Log in'
             },
             login: {
                 input_account_placeholder: 'Username',
@@ -485,8 +485,8 @@ export default {
             sunset: 'Sunset',
             location_updated: 'Location updated.',
             location_failed: 'Location failed to update.',
-            group_title:'Day-Night Cycle',
-            sync:'Sync up'
+            group_title: 'Day-Night Cycle',
+            sync: 'Sync up'
         },
         track_time_duration: {
             common: {
@@ -727,18 +727,18 @@ export default {
                 multi_selection: 'Multiple Selection'
             },
             weekly: {
-                show_eating_window:'Eating and Wake Windows',
+                show_eating_window: 'Eating and Wake Windows',
                 current_week: 'Current week',
                 title: 'Windows',
                 fast_average: 'Avg. Fast',
                 sleep_average: 'Avg. Sleep',
-                eat_average:'Avg. Eating',
-                wake_average:'Avg. Wake',
-                back:'Back'
+                eat_average: 'Avg. Eating',
+                wake_average: 'Avg. Wake',
+                back: 'Back'
             },
-            log_timing:{
-                log_timings:'Log Multiple Times',
-                pick_time:'Pick Time'
+            log_timing: {
+                log_timings: 'Log Multiple Times',
+                pick_time: 'Pick Time'
             }
         },
         food: {
@@ -815,7 +815,7 @@ export default {
                 choose_metric_desc: 'Select metrics based on your needs.',
                 order: 'Adjust order',
                 combo: 'Combo',
-                derived:'Derived'
+                derived: 'Derived'
 
             },
             werun_auth: {
@@ -824,5 +824,18 @@ export default {
                 toast_reject_auth: 'You have rejected authorization and cannot access step count'
             }
         }
+    },
+    time_of_day: {
+        index: {
+            pick_location: 'Pick Location',
+            change_location: 'Change Location',
+            unknown: 'Unknown',
+            last_change: 'Last change',
+            next_change: 'Next change',
+            summer_started: 'Summer time started',
+            winter_started: 'Winter time started',
+            summer_starts: 'Summer time starts',
+            winter_starts: 'Winter time starts'
+        }
     }
 }

+ 139 - 126
src/context/locales/zh.js

@@ -16,15 +16,15 @@ export default {
         clock: {
             title: '生物钟',
         },
-        reminders:{
-            title:'提醒',
+        reminders: {
+            title: '提醒',
         },
         activity: {
             title: '运动',
         },
         metric: {
             title: '指标',
-            unit_options:'单位选项'
+            unit_options: '单位选项'
         },
         food: {
             title: '早餐日记',
@@ -35,15 +35,15 @@ export default {
         explore: {
             title: '发现更多',
             share_title: '我的发现',
-            journal:'日记'
+            journal: '日记'
         },
         more: {
             title: '我',
             un_login: '未登录',
             stone: '成为 Pro 会员',
             stone_desc: '解锁会员专享功能。',
-            pro_member:'Pro 会员',
-            member_desc:'{{time}} 到期。',
+            pro_member: 'Pro 会员',
+            member_desc: '{{time}} 到期。',
             setting: '设置',
             reset_session: '重置session',
             debug_mode: '走查模式'
@@ -86,14 +86,14 @@ export default {
         },
         auth: {
             agreement: '已阅读并同意《用户协议》和《隐私政策》',
-            psd_repeat_diff:'两次密码输入不一致'
+            psd_repeat_diff: '两次密码输入不一致'
         },
         records_history: {
             time_title: '历史记录',
             metric_title: '{{title}}记录',
             activity_title: '{{title}}记录',
             del_success: '删除成功',
-            del_action_title:'本条记录将被永久删除。'
+            del_action_title: '本条记录将被永久删除。'
         },
         setting: {
             title: '设置',
@@ -109,37 +109,37 @@ export default {
         edit_nickname: {
             title: '编辑昵称'
         },
-        reminders:{
-            title:'提醒',
-            fast_sleep:'断食与睡眠',
-            base:'基础',
-            base_schedule_time:'打卡提醒',
-            always:'已开启',
-            off:'未开启',
-            base_footer:'日程开始及进程结束,收到提醒。',
-            extra:'额外',
-            missed_action:'补记提醒',
-            extra_footer:'日程结束时间仍未打卡,收到提醒。及时补记将避免连续纪录中断。',
-            sun:'昼夜与阴阳 (Pro)',
-            sun_header:'顺应天时,改善进食、断食及作息时间',
-            sun_footer:'支持全球任意位置。如您位于极地地区,由于极昼期间太阳总在地平线以上、极夜期间太阳总在地平线以下,仅支持太阳位于相对高点的“正午”提醒。',
-            sunrise:'日出',
-            sunset:'日落',
-            solarnoon:'正午',
-            pro_feature:'会员功能',
-            pro_sun_desc:'解锁日出日落提醒等会员功能。',
-            become_pro:'成为 Pro 会员',
-            not_now:'暂不',
-            open:'立即开启'
+        reminders: {
+            title: '提醒',
+            fast_sleep: '断食与睡眠',
+            base: '基础',
+            base_schedule_time: '打卡提醒',
+            always: '已开启',
+            off: '未开启',
+            base_footer: '日程开始及进程结束,收到提醒。',
+            extra: '额外',
+            missed_action: '补记提醒',
+            extra_footer: '日程结束时间仍未打卡,收到提醒。及时补记将避免连续纪录中断。',
+            sun: '昼夜与阴阳 (Pro)',
+            sun_header: '顺应天时,改善进食、断食及作息时间',
+            sun_footer: '支持全球任意位置。如您位于极地地区,由于极昼期间太阳总在地平线以上、极夜期间太阳总在地平线以下,仅支持太阳位于相对高点的“正午”提醒。',
+            sunrise: '日出',
+            sunset: '日落',
+            solarnoon: '正午',
+            pro_feature: '会员功能',
+            pro_sun_desc: '解锁日出日落提醒等会员功能。',
+            become_pro: '成为 Pro 会员',
+            not_now: '暂不',
+            open: '立即开启'
         }
 
 
 
     },
     feature: {
-        pro:{
-            for_pro:'Pro 会员',
-            tag:'限免'
+        pro: {
+            for_pro: 'Pro 会员',
+            tag: '限免'
         },
         auth_sys: {
             location_title: '无法获取你的位置信息',
@@ -156,10 +156,10 @@ export default {
             fast_sleep_desc: '记录每晚断食的三个阶段,\n睡前、睡眠期间、及起床后',
             free: '免费',
             limit_time_offer: '限时免费',
-            next:'下一步',
-            alert_title:'需要高级权限',
-            alert_content:'再次完成断食打卡并连续{{day}}天可解锁。',
-            alert_btn:'我知道了',
+            next: '下一步',
+            alert_title: '需要高级权限',
+            alert_content: '再次完成断食打卡并连续{{day}}天可解锁。',
+            alert_btn: '我知道了',
         },
         suggest: {
             step_0_title: '选择断食结束时间',
@@ -176,7 +176,7 @@ export default {
             fall_sleep_picker_footer: '正常躺床上到入睡需要10-30分钟。',
             step_3_title: '睡眠日程推荐',
             sleep_suggest_header: '{{time}} 起床感觉清爽, 为你推荐以下就寝时间:',
-            sleep_suggest_footer:'睡个好觉需要 5-6 个完整睡眠周期, 每个睡眠周期平均90分钟。',
+            sleep_suggest_footer: '睡个好觉需要 5-6 个完整睡眠周期, 每个睡眠周期平均90分钟。',
             cycles: '{{times}}个睡眠周期',
             go_to_bed_at: '{{time}} 上床睡觉',
             restorative: '滋养',
@@ -184,31 +184,31 @@ export default {
             set_myself: '自己设置',
             popular: '热门',
             recent: '最近',
-            btn:'下一步',
-            done:'完成',
-            hour:'小时',
-            hours2:'小时',
-            minute:'分钟',
-            mins:'分钟'
+            btn: '下一步',
+            done: '完成',
+            hour: '小时',
+            hours2: '小时',
+            minute: '分钟',
+            mins: '分钟'
         },
         set_goal: {
             set_action_plan: '设置日程',
             almost_done: '最后一步',
             header: '检查您的日程',
             footer: '您可根据需要做出最后调整。',
-            fast:'断食',
-            sleep:'睡眠',
-            start_fasting:'开始断食',
-            go_to_bed:'就寝',
-            wake_up:'起床',
-            end_fasting:'结束断食',
-            done:'完成',
+            fast: '断食',
+            sleep: '睡眠',
+            start_fasting: '开始断食',
+            go_to_bed: '就寝',
+            wake_up: '起床',
+            end_fasting: '结束断食',
+            done: '完成',
             next_day: '次日 ',
         },
 
-        pay:{
-            paying_title:'您的付款正在处理中...',
-            paying_desc:'请等待交易完成。',
+        pay: {
+            paying_title: '您的付款正在处理中...',
+            paying_desc: '请等待交易完成。',
         },
 
         check_access: {
@@ -217,46 +217,46 @@ export default {
                 desc: '您已连续{{day}}天完成断食打卡。',//'You\'re on a {{day}}-day streak.\n{{day_left}} more {{day_unit}} until unlocking \'Fasting with sleep.\'',
                 btn: '继续保持'
             },
-            gain_access:{
-                title:'高级功能已解锁',
-                desc:'{{reason}}您已解锁“断食与睡眠”功能。现在要启用高级功能吗?',
+            gain_access: {
+                title: '高级功能已解锁',
+                desc: '{{reason}}您已解锁“断食与睡眠”功能。现在要启用高级功能吗?',
                 // desc:'You\'ve unlocked \'Fasting with Sleep\' since you\'re on a {{day}}-day streak.\nAre you ready to up the game?',
-                upgrade:'启用"断食与睡眠"',
-                upgrade_desc:'{{time}} 后失效',
-                stay_btn:'保持仅断食',
-                reason:'因您已连续{{day}}天完成断食打卡,',
+                upgrade: '启用"断食与睡眠"',
+                upgrade_desc: '{{time}} 后失效',
+                stay_btn: '保持仅断食',
+                reason: '因您已连续{{day}}天完成断食打卡,',
                 // more:'Learn more'
             },
-            upgrade_pro:{
-                title:'Congrats on Your PRO Status!',
-                desc:'To preserve this status, continue your fasting streak in {{time}} and begin your sleep streak. Remember to keep both of them going.',
-                btn:'I got this!'
+            upgrade_pro: {
+                title: 'Congrats on Your PRO Status!',
+                desc: 'To preserve this status, continue your fasting streak in {{time}} and begin your sleep streak. Remember to keep both of them going.',
+                btn: 'I got this!'
             },
-            sleep_schedule:{
-                title:'睡眠日程',
-                desc:'您此前的睡眠日程为 {{start_time}} - {{end_time}}。是否要设置新日程?',
-                confirm:'设置新日程',
-                cancel:'保持老日程'
+            sleep_schedule: {
+                title: '睡眠日程',
+                desc: '您此前的睡眠日程为 {{start_time}} - {{end_time}}。是否要设置新日程?',
+                confirm: '设置新日程',
+                cancel: '保持老日程'
             },
-            stay_qualified:{
-                title:'连续纪录已更新',
-                desc:'您已连续{{fast_streak_day}}天完成断食打卡、连续{{sleep_streak_day}}天完成睡眠打卡。',
+            stay_qualified: {
+                title: '连续纪录已更新',
+                desc: '您已连续{{fast_streak_day}}天完成断食打卡、连续{{sleep_streak_day}}天完成睡眠打卡。',
                 // desc:'You\'re on a {{fast_streak_day}}-day fasting streak and a {{sleep_streak_day}}-day sleep streak.\nKeep \'em going to stay in the game.',
-                btn:'继续保持',
+                btn: '继续保持',
             },
-            lose_access:{
-                title:'高级权限已失效',
-                desc:'{{reason}} 您失去了"断食与睡眠"的体验资格。再次完成断食打卡并连续{{require_days}}天, 即可重获资格。',
-                btn:'我知道了'
+            lose_access: {
+                title: '高级权限已失效',
+                desc: '{{reason}} 您失去了"断食与睡眠"的体验资格。再次完成断食打卡并连续{{require_days}}天, 即可重获资格。',
+                btn: '我知道了'
                 // confirm:'Become a PRO member',
                 // cancel:'Achieve New Fasting Streak'
             },
-            lost_reason:{
-                fast_streak_lost:'因断食连续天数已中断,',
-                sleep_streak_lost:'因睡眠连续天数已中断,',
-                fast_sleep_streaks_lost:'因断食和睡眠连续打卡中断,',
-                sleep_streak_not_growing:'因未启用睡眠打卡记录,',
-                not_satisfied_after_delete:'因断食连续打卡不足{{day}}天,',
+            lost_reason: {
+                fast_streak_lost: '因断食连续天数已中断,',
+                sleep_streak_lost: '因睡眠连续天数已中断,',
+                fast_sleep_streaks_lost: '因断食和睡眠连续打卡中断,',
+                sleep_streak_not_growing: '因未启用睡眠打卡记录,',
+                not_satisfied_after_delete: '因断食连续打卡不足{{day}}天,',
                 // fast_streak_lost:'since you lost your fasting streak on {{date}}',
                 // sleep_streak_lost:'since you lost your sleep streak on {{date}}',
                 // fast_sleep_streaks_lost:'since you lost both of your fasting and sleep streaks on {{date}}',
@@ -264,7 +264,7 @@ export default {
                 // not_satisfied_after_delete:'since you no longer have a fasting streak that satisfy the base requirement',
             }
         },
-        
+
         notification: {
             action_title: {
                 start_timer_now: '一键立即开始计时',
@@ -274,22 +274,22 @@ export default {
                 pick_earlier_end: '选择更早结束',
             }
         },
-        location:{
-            no_location:'暂无位置信息',
-            clear_info:'清除位置信息',
-            clear_alert_title:'提示',
-            clear_alert_content:'清除位置信息后, 您将无法继续查看当地日出日落时间。确定要清除位置信息吗',
-            clear_alert_cancel:'取消',
-            clear_alert_confirm:'清除'
-        },
-        heads_up:{
-            alert_title:'提示',
-            ongoing1_content:'您还未睡眠打卡。此时结束断食, 您将失去\'断食与睡眠\'的高级体验资格。',
-            ongoing1_cancel:'睡眠打卡',
-            ongoing1_confirm:'结束断食',
-            ongoing2_content:'您还未完成睡眠打卡。此时结束断食, 您将失去\'断食与睡眠\'的高级体验资格。',
-            ongoing2_cancel:'睡眠打卡',
-            ongoing2_confirm:'结束断食',
+        location: {
+            no_location: '暂无位置信息',
+            clear_info: '清除位置信息',
+            clear_alert_title: '提示',
+            clear_alert_content: '清除位置信息后, 您将无法继续查看当地日出日落时间。确定要清除位置信息吗',
+            clear_alert_cancel: '取消',
+            clear_alert_confirm: '清除'
+        },
+        heads_up: {
+            alert_title: '提示',
+            ongoing1_content: '您还未睡眠打卡。此时结束断食, 您将失去\'断食与睡眠\'的高级体验资格。',
+            ongoing1_cancel: '睡眠打卡',
+            ongoing1_confirm: '结束断食',
+            ongoing2_content: '您还未完成睡眠打卡。此时结束断食, 您将失去\'断食与睡眠\'的高级体验资格。',
+            ongoing2_cancel: '睡眠打卡',
+            ongoing2_confirm: '结束断食',
         },
         common: {
             prompt: '提示',
@@ -384,14 +384,14 @@ export default {
                 logout_content: '确定退出登录吗?',
 
 
-                del:'注销',
+                del: '注销',
                 deluser_title: '确认注销账号注销',
                 deluser_content: '账号注销后不可恢复。 确定要注销此账号吗?',
-                deluser_cancel:'取消',
-                deluser_confirm:'确认注销',
-                deluser_action_title:'账号将被永久注销。',
-                deluser_action_confirm:'注销账号',
-                deluser_action_cancel:'取消',
+                deluser_cancel: '取消',
+                deluser_confirm: '确认注销',
+                deluser_action_title: '账号将被永久注销。',
+                deluser_action_confirm: '注销账号',
+                deluser_action_cancel: '取消',
 
                 reset_session_title: '重置session',
                 reset_session_content: '确认重置session吗?'
@@ -413,7 +413,7 @@ export default {
                 footer_desc: '已有账号?',
                 footer_login: '去登录',
                 btn_next: '下一步',
-                login:'登录'
+                login: '登录'
             },
             login: {
                 input_account_placeholder: '用户名或邮箱',
@@ -485,8 +485,8 @@ export default {
             sunset: '日落',
             location_updated: '位置更新成功',
             location_failed: '位置更新失败',
-            group_title:'昼夜节律',
-            sync:'同步'
+            group_title: '昼夜节律',
+            sync: '同步'
         },
         track_time_duration: {
             common: {
@@ -560,15 +560,15 @@ export default {
                 countdown_titles: '别让连续纪录终止, 将它们一直保持下去!',
                 countdown_fast: '当前断食连续天数将在 {{time}} 后重置归零。',
                 countdown_sleep: '当前睡眠连续天数将在 {{time}} 后重置归零。',
-                last_reset:'上次归零',
-                next_reset:'下次归零',
+                last_reset: '上次归零',
+                next_reset: '下次归零',
                 not_determined: '待定',
-                faststreak:'断食连续',
-                sleepstreak:'睡眠连续',
-                alert_title:'别忘了今晚也要睡眠打卡!',
-                alert_content:'为了保障您的高级体验, 您需要激活睡眠连续纪录, 并让睡眠与断食连续打卡天数保持同步增长。',
-                alert_confirm:'好的收到',
-                heads_up:'提示',
+                faststreak: '断食连续',
+                sleepstreak: '睡眠连续',
+                alert_title: '别忘了今晚也要睡眠打卡!',
+                alert_content: '为了保障您的高级体验, 您需要激活睡眠连续纪录, 并让睡眠与断食连续打卡天数保持同步增长。',
+                alert_confirm: '好的收到',
+                heads_up: '提示',
             },
             change_tz_alert: {
                 title: '检测到新时区',
@@ -724,18 +724,18 @@ export default {
                 multi_selection: '多选'
             },
             weekly: {
-                show_eating_window:'进食与活动时间',
+                show_eating_window: '进食与活动时间',
                 current_week: '本周',
                 title: '时段统计',
                 fast_average: '平均断食',
                 sleep_average: '平均睡眠',
-                eat_average:'平均进食',
-                wake_average:'平均活动',
-                back:'返回'
+                eat_average: '平均进食',
+                wake_average: '平均活动',
+                back: '返回'
             },
-            log_timing:{
-                log_timings:'记录多个时间',
-                pick_time:'选择时间'
+            log_timing: {
+                log_timings: '记录多个时间',
+                pick_time: '选择时间'
             }
         },
         food: {
@@ -812,7 +812,7 @@ export default {
                 choose_metric_desc: '按需选择自己常用的指标',
                 order: '调整排序',
                 combo: '组合',
-                derived:'计算'
+                derived: '计算'
             },
             werun_auth: {
                 modal_open_setting_title: '提示',
@@ -821,5 +821,18 @@ export default {
             }
 
         }
+    },
+    time_of_day: {
+        index: {
+            pick_location: '选择地点',
+            change_location: '选择地点',
+            unknown: '未知',
+            last_change: '上次调整',
+            next_change: '下次调整',
+            summer_started: '夏令时生效',
+            winter_started: '冬令时生效',
+            summer_starts: '夏令时将生效',
+            winter_starts: '冬令时将生效'
+        }
     }
 }

+ 8 - 1
src/pages/map/map.tsx

@@ -47,6 +47,13 @@ export default function map() {
     }, [])
 
     function confirmChoose() {
+        if ((router.params! as any).source && (router.params! as any).source == 'time_of_day') {
+            if ((router.params! as any).chooseLocation){
+                (router.params! as any).chooseLocation(location)
+            }
+            navigation.goBack()
+            return;
+        }
         var today = new Date()
         var yesterday = new Date(today.getTime() - 24 * 3600 * 1000)
         var tomorrow = new Date(today.getTime() + 24 * 3600 * 1000)
@@ -209,7 +216,7 @@ export default function map() {
         </View>
         <View style={styles.location_btn}>
             {
-                isLoading ? <View style={{width:20,height:20,overflow:'hidden'}}>
+                isLoading ? <View style={{ width: 20, height: 20, overflow: 'hidden' }}>
                     <AtActivityIndicator size={20} color="#000" content="" />
                 </View> :
                     <Image src={require('@/assets/images/current_location.png')} onClick={showCurrent} style={styles.location_icon} />

Деякі файли не було показано, через те що забагато файлів було змінено