leon 1 year ago
parent
commit
0716d132fd

+ 1 - 1
ios/AppDelegate.mm

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

+ 2 - 2
ios/hola.xcodeproj/project.pbxproj

@@ -572,7 +572,7 @@
 				CODE_SIGN_ENTITLEMENTS = hola/hola.entitlements;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 16;
+				CURRENT_PROJECT_VERSION = 19;
 				DEVELOPMENT_TEAM = GPMXAZ9G5N;
 				ENABLE_BITCODE = NO;
 				INFOPLIST_FILE = hola/Info.plist;
@@ -605,7 +605,7 @@
 				CODE_SIGN_ENTITLEMENTS = hola/hola.entitlements;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 16;
+				CURRENT_PROJECT_VERSION = 19;
 				DEVELOPMENT_TEAM = GPMXAZ9G5N;
 				INFOPLIST_FILE = hola/Info.plist;
 				LD_RUNPATH_SEARCH_PATHS = (

File diff suppressed because it is too large
+ 0 - 0
ios/main.jsbundle


+ 4 - 4
src/components/basic/Buttons.tsx

@@ -76,8 +76,8 @@ export default function Buttons(props: {
         return (
             <View className={mainClass} style={{ ...props.btnStyle, opacity: props.lowLight ? 0.4 : 1 }} onClick={onClick} onLongPress={onLongClick}>
                 {
-                    props.showLoading && <View style={{ marginBottom: 2, marginRight: 5 }}>
-                        <AtActivityIndicator size={32} color={props.btnStyle.color} />
+                    props.showLoading && <View style={{ display: 'flex', overflow: 'hidden', height: 20, marginRight: 5 }}>
+                        <AtActivityIndicator  color={props.btnStyle.color} />
                     </View>
                 }
                 <Text
@@ -97,8 +97,8 @@ export default function Buttons(props: {
             onClick={onClick}
             onLongPress={onLongClick}>
             {
-                props.showLoading && <View style={{ marginBottom: 2, marginRight: 5 }}>
-                    <AtActivityIndicator size={32} color={props.lightLoading ? '#999' : '#000'} />
+                props.showLoading && <View style={{ display: 'flex', overflow: 'hidden', height: 20, marginRight: 5 }}>
+                    <AtActivityIndicator color={props.lightLoading ? '#999' : '#000'} />
                 </View>
             }
             <Text

+ 50 - 21
src/features/common/RecordItem.tsx

@@ -6,10 +6,22 @@ import { TimeFormatter } from "@/utils/time_format";
 import { useTranslation } from "react-i18next";
 import { vibrate } from "@/utils/tools";
 import showActionSheet from "@/components/basic/ActionSheet";
+import showAlert from "@/components/basic/Alert";
 
+let useActionSheet;
+if (process.env.TARO_ENV == 'rn') {
+    useActionSheet = require('@expo/react-native-action-sheet').useActionSheet
+}
 
 export default function Component(props: { children: React.ReactNode, onClick?: Function, delete?: Function, canDel?: boolean, disableDelete?: boolean }) {
     const { t } = useTranslation()
+
+    let showActionSheetWithOptions;
+    if (process.env.TARO_ENV == 'rn') {
+        showActionSheetWithOptions = useActionSheet()
+    }
+
+
     function click(e) {
         if (props.onClick) {
             if (process.env.TARO_ENV == 'weapp') {
@@ -27,34 +39,51 @@ export default function Component(props: { children: React.ReactNode, onClick?:
         if (!props.delete || props.disableDelete) {
             return;
         }
-        // showActionSheet({
 
-        // })
-
-        Taro.showActionSheet({
+        showActionSheet({
+            showActionSheetWithOptions: showActionSheetWithOptions,
             itemList: [t('feature.common.action_sheet.delete')],
-            itemColor: '#ff0000'
-        })
-            .then(res => {
-                switch (res.tapIndex) {
+            success: (res) => {
+                switch (res) {
                     case 0:
-                        Taro.showModal({
-                            title: t('feature.common.modal.delete_item_title'),
-                            content: t('feature.common.modal.delete_item_content'),
-                            success: function (res) {
-                                if (res.confirm) {
+                        {
+                            showAlert({
+                                title: t('feature.common.modal.delete_item_title'),
+                                content: t('feature.common.modal.delete_item_content'),
+                                showCancel: true,
+                                confirm: () => {
                                     props.delete!();
                                 }
-                            }
-                        })
-                        break;
-                    case 1:
-
+                            })
+                        }
                         break;
                 }
-            })
-            .catch(err => {
-            })
+            }
+        })
+
+        // Taro.showActionSheet({
+        //     itemList: [t('feature.common.action_sheet.delete')],
+        //     itemColor: '#ff0000'
+        // })
+        //     .then(res => {
+        //         switch (res.tapIndex) {
+        //             case 0:
+        //                 showAlert({
+        //                     title: t('feature.common.modal.delete_item_title'),
+        //                     content: t('feature.common.modal.delete_item_content'),
+        //                     showCancel: true,
+        //                     confirm: () => {
+        //                         props.delete!();
+        //                     }
+        //                 })
+        //                 break;
+        //             case 1:
+
+        //                 break;
+        //         }
+        //     })
+        //     .catch(err => {
+        //     })
 
     }
     //gesture  onClick onLongPress 有效

+ 1 - 0
src/features/common/SpecBtns.tsx

@@ -146,6 +146,7 @@ export const ChooseScenarioBtn = (props: { onClick: Function, title: string, bac
                 onClick={() => { props.onClick() }}
                 longClick={props.longClick}
                 disabled={props.disable}
+                showLoading={props.disable}
                 btnStyle={{
                     height: 50,
                     width: 300,

+ 1 - 1
src/features/daynight/DayNightSwiper.tsx

@@ -125,7 +125,7 @@ export default function DayNightSwiper(props: { count: number, schedule: any, ho
         indicatorColor='#ffffff66'
         indicatorActiveColor='#ffffff99'
         current={current}
-        style={{height:process.env.TARO_ENV=='weapp'?rpxToPx(204)+96+4:rpxToPx(204)+96+12}}
+        style={{height:process.env.TARO_ENV=='weapp'?rpxToPx(204)+96+4:rpxToPx(204)+96+12+10}}
 
     >
         <SwiperItem>

+ 5 - 5
src/features/food/FoodTimelineItem.tsx

@@ -14,6 +14,7 @@ import { TimeFormatter } from "@/utils/time_format";
 import { baseUrl } from "@/services/http/api";
 import Slider from "@/components/input/Slider";
 import { rpxToPx } from "@/utils/tools";
+import showAlert from "@/components/basic/Alert";
 
 export default function Component(props: {
     data: any, index: number,
@@ -60,13 +61,12 @@ export default function Component(props: {
                         share()
                         break;
                     case 2:
-                        Taro.showModal({
+                        showAlert({
                             title: t('feature.common.modal.delete_item_title'),
                             content: t('feature.common.modal.delete_item_content'),
-                            success: function (res) {
-                                if (res.confirm) {
-                                    props.delete();
-                                }
+                            showCancel: true,
+                            confirm: () => {
+                                props.delete();
                             }
                         })
                         break;

+ 0 - 1
src/features/trackTimeDuration/components/ClockHeader.tsx

@@ -72,7 +72,6 @@ export default function ClockHeader(props: { homeData: any }) {
             setSleepPickerValue(durationIndex(current_record.sleep.target_start_time, current_record.sleep.target_end_time, common))
         }
 
-
     }
 
     function tapAddBtn() {

+ 13 - 13
src/features/trackTimeDuration/components/RecordFastSleep.tsx

@@ -26,6 +26,7 @@ import { setSelID } from "@/store/common";
 import CircadianDetailPopup from "./CircadianDetailPopup";
 import dayjs from 'dayjs'
 import '@/utils/ring_card.scss';
+import showAlert from "@/components/basic/Alert";
 // import { sqrt } from 'mathjs'
 
 let AppState;
@@ -156,16 +157,15 @@ const RecordFastSleep = memo((props: { data: any, type: string, index: number, d
     }
 
     function tapDel() {
-        Taro.showModal({
+        showAlert({
             title: t('feature.common.modal.delete_item_title'),
             content: t('feature.common.modal.delete_item_content'),
-            success: function (res) {
-                if (res.confirm) {
-                    del();
-                }
-                else {
-                    setShowDel(false)
-                }
+            showCancel: true,
+            confirm: () => {
+                del();
+            },
+            cancel: () => {
+                setShowDel(false)
             }
         })
     }
@@ -447,11 +447,11 @@ const RecordFastSleep = memo((props: { data: any, type: string, index: number, d
                     }
                 }
                 if (global.language == 'en') {
-                    return TimeFormatter.tzTimeFormateLocalTime(props.data.first_real_check_time, props.data.first_timezone.id,'MMM D z')
+                    return TimeFormatter.tzTimeFormateLocalTime(props.data.first_real_check_time, props.data.first_timezone.id, 'MMM D z')
                     // return dayjs(props.data.first_real_check_time).tz(props.data.first_timezone.id).format('MMM D z')
                 }
                 else {
-                    return TimeFormatter.tzTimeFormateLocalTime(props.data.first_real_check_time, props.data.first_timezone.id,'M月D日 z')
+                    return TimeFormatter.tzTimeFormateLocalTime(props.data.first_real_check_time, props.data.first_timezone.id, 'M月D日 z')
                     // return dayjs(props.data.first_real_check_time).tz(props.data.first_timezone.id).format('M月D日 z')
                 }
             }
@@ -475,11 +475,11 @@ const RecordFastSleep = memo((props: { data: any, type: string, index: number, d
                     }
                 }
                 if (global.language == 'en') {
-                    return TimeFormatter.tzTimeFormateLocalTime(props.data.first_real_check_time, props.data.first_timezone.id,'MMM D z')
+                    return TimeFormatter.tzTimeFormateLocalTime(props.data.first_real_check_time, props.data.first_timezone.id, 'MMM D z')
                     // return dayjs(props.data.first_real_check_time).tz(props.data.first_timezone.id).format('MMM D z')
                 }
                 else {
-                    return TimeFormatter.tzTimeFormateLocalTime(props.data.first_real_check_time, props.data.first_timezone.id,'M月D日 z')
+                    return TimeFormatter.tzTimeFormateLocalTime(props.data.first_real_check_time, props.data.first_timezone.id, 'M月D日 z')
                     // return dayjs(props.data.first_real_check_time).tz(props.data.first_timezone.id).format('M月D日 z')
                 }
             }
@@ -703,7 +703,7 @@ const RecordFastSleep = memo((props: { data: any, type: string, index: number, d
             {
                 process.env.TARO_ENV == 'weapp' && <View className={showDel ? 'btnDelete btnDeleteAni' : 'btnDelete'} onClick={tapDel}>{t('feature.track_time_duration.record_fast_sleep.delete')}</View>
             }
-            
+
 
         </View>
         {/* {

+ 7 - 7
src/features/workout/Result.tsx

@@ -13,6 +13,7 @@ import { NaviBarTitleShowType, TemplateType } from "@/utils/types";
 import Box from "@/components/layout/Box";
 import MultiText from "@/components/view/MultiText";
 import { IconX } from "@/components/basic/Icons";
+import showAlert from "@/components/basic/Alert";
 
 export default function Component() {
     const router = useRouter();
@@ -113,10 +114,10 @@ export default function Component() {
                             valueSize={rpxToPx(48)}
                             unitSize={rpxToPx(32)} />
                         {
-                            index<list.length-1 && <IconX width={rpxToPx(32)} color={router.params.themeColor+''} />
+                            index < list.length - 1 && <IconX width={rpxToPx(32)} color={router.params.themeColor + ''} />
                         }
                         {
-                            index<list.length-1 && <View style={{ width: 1 }} />
+                            index < list.length - 1 && <View style={{ width: 1 }} />
                         }
                     </View>
                 })
@@ -125,13 +126,12 @@ export default function Component() {
     }
 
     function del() {
-        Taro.showModal({
+        showAlert({
             title: t('feature.common.modal.delete_item_title'),
             content: t('feature.common.modal.delete_item_content'),
-            success: function (res) {
-                if (res.confirm) {
-                    delData()
-                }
+            showCancel: true,
+            confirm: () => {
+                delData()
             }
         })
     }

+ 10 - 8
src/pages/clock/ClockMain.tsx

@@ -379,20 +379,22 @@ export default function Page() {
                         global.refrehWeekly()
                     }
 
+                    global.indexPageRefresh()
+
                     // if (global.refreshNight){
                     //     global.refreshNight()
                     // }
                     // if (global.refreshDay){
                     //     global.refreshDay()
                     // }
-                    if (global.currentStatus != 'WAIT_FOR_START') {
-                        showAlert({
-                            title: t('feature.track_time_duration.change_tz_alert.title'),
-                            content: t('feature.track_time_duration.change_tz_alert.content', { tz: timeZoneFormatted }),
-                            showCancel: false,
-                            confirmText: t('feature.track_time_duration.change_tz_alert.confirm'),
-                        })
-                    }
+                    // if (global.currentStatus != 'WAIT_FOR_START') {
+                    showAlert({
+                        title: t('feature.track_time_duration.change_tz_alert.title'),
+                        content: t('feature.track_time_duration.change_tz_alert.content', { tz: timeZoneFormatted }),
+                        showCancel: false,
+                        confirmText: t('feature.track_time_duration.change_tz_alert.confirm'),
+                    })
+                    // }
                 }
             },
             complete: function () {

+ 5 - 1
src/pages/clock/SetGoal.tsx

@@ -52,6 +52,7 @@ export default function SetGoal() {
     const [isFast, setIsFast] = useState(true)
     const [isStart, setIsStart] = useState(true)
     const [authStatus, setAuthStatus] = useState('')
+    const [btnDisable, setBtnDisable] = useState(false)
     const { t } = useTranslation()
     const dispatch = useDispatch();
 
@@ -259,7 +260,7 @@ export default function SetGoal() {
     }
 
     function confirm() {
-        debugger
+        setBtnDisable(true)
         var params: any = {
             method: parseInt(router.params.isSelf + '') == 1 ? 'USER_SET' : 'SUGGEST',
             schedule: {
@@ -302,6 +303,7 @@ export default function SetGoal() {
         }
 
         setPlan(params).then(res => {
+            setBtnDisable(false)
             if (global.checkData) {
                 global.checkData()
             }
@@ -321,6 +323,7 @@ export default function SetGoal() {
 
 
         }).catch(e => {
+            setBtnDisable(false)
         })
     }
 
@@ -597,6 +600,7 @@ export default function SetGoal() {
 
         <Footer>
             <ChooseScenarioBtn
+                disable={btnDisable}
                 onClick={confirm}
                 title={t('feature.set_goal.done')}
                 background={ColorType.fast}

+ 12 - 5
src/pages/clock/Suggest.tsx

@@ -119,6 +119,12 @@ export default function Suggest() {
             setSuggestIndex(currentIndex)
             setScrollTop(currentIndex * (rpxToPx(92 + 28) + 72) - 30)
             if (process.env.TARO_ENV == 'rn') {
+                setTimeout(() => {
+                    
+                        var screenHeight = Taro.getSystemInfoSync().screenHeight
+                        var safeBottom = Taro.getSystemInfoSync().safeArea?.bottom
+                        setScrollHeight(Taro.getSystemInfoSync().windowHeight - 50 - rpxToPx(88) - rpxToPx(420) - (screenHeight - safeBottom) - rpxToPx(46));
+                }, 100)
                 setTimeout(() => {
                     (scrollViewRef.current as any).scrollTo({ x: 0, y: currentIndex * (rpxToPx(92 + 28) + 72) - 30, animated: true })
                 }, 500)
@@ -372,7 +378,7 @@ export default function Suggest() {
         return <View>
             {
                 process.env.TARO_ENV == 'weapp' ? <View style={{
-                    marginBottom: rpxToPx(40), marginLeft: rpxToPx(46),
+                    marginLeft: rpxToPx(46),
                     marginRight: rpxToPx(46), borderRadius: 10,
                     overflow: 'hidden', backgroundColor: '#1c1c1c', paddingTop: 10, paddingBottom: 10
                 }}>
@@ -380,7 +386,7 @@ export default function Suggest() {
                     {picker1()}
                 </View> :
                     <View style={{
-                        marginBottom: rpxToPx(40), marginLeft: rpxToPx(46),
+                        marginLeft: rpxToPx(46),
                         marginRight: rpxToPx(46), borderRadius: 10,
                         overflow: 'hidden', backgroundColor: '#1c1c1c',
                         height: 180,
@@ -610,7 +616,7 @@ export default function Suggest() {
         }
 
         if (pageStep == 1 && process.env.TARO_ENV === 'rn') {
-            return <ScrollViewRN style={{ height: rpxToPx(868) }} ref={scrollViewRef}>
+            return <ScrollViewRN style={{ height: scrollHeight }} ref={scrollViewRef}>
                 {
                     scrollContent()
                 }
@@ -654,6 +660,7 @@ export default function Suggest() {
                     </View>
                 })
             }
+            <Text className="suggest_footer_note" style={{marginTop:0}}>{t('feature.suggest.sleep_suggest_footer')}</Text>
         </View>
     }
 
@@ -665,9 +672,9 @@ export default function Suggest() {
             {
                 (pageStep == 1 || pageStep == 3) && suggestList()
             }
-            {
+            {/* {
                 pageStep == 3 && <Text className="suggest_footer_note">{t('feature.suggest.sleep_suggest_footer')}</Text>
-            }
+            } */}
             {
                 pageStep == 2 && fallSleepPicker()
             }

+ 1 - 1
src/services/http/request.ts

@@ -90,7 +90,7 @@ export async function request<T>(param: RequestParam): Promise<T> {
         header['X-Timestamp'] = new Date().getTime()
         if (token.length > 0) {
             header['Authorization'] = `Bearer ${token}`;
-            // header['Authorization'] = 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhY2NvdW50Iiwic3ViIjoiMTE0Nzg0NGE5NDIyODk1MmE5Zjc2OTdjYWJjYmU3Y2UiLCJpc3MiOiJmYXN0Iiwibmlja25hbWUiOiJGYXN0ZXIiLCJ0eXAiOiJCZWFyZXIiLCJzZXNzaW9uX3N0YXRlIjoiZWE5NTQ1Y2VkNThlNzgzNTA1MWRjZTY0ODEwMzQ4ZmQiLCJleHAiOjE3NDk3MDA3MTYsImlhdCI6MTcxODE2NDcxN30.yrh-xAJhmfG-CueyCsToW-X4Dx043DYhk5DiE0E4eNk';
+            // header['Authorization'] = 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhY2NvdW50Iiwic3ViIjoiZTQ3M2RlZDI4YzgwNzY3ZDZiOTBkYzAzMDg5YzRhYzEiLCJpc3MiOiJmYXN0Iiwibmlja25hbWUiOiLmtYvor5UiLCJ0eXAiOiJCZWFyZXIiLCJzZXNzaW9uX3N0YXRlIjoiNDE1NTZkODNiM2QyODRmYzNhODY1NmI3YzdhOTBjODQiLCJleHAiOjIwMzM3ODU4MTcsImlhdCI6MTcxODI1MzAxN30.JBbFZhmckizGqblsFFB3ee3u_CivwTR8w-0VoUcph2w';
             // header['Authorization'] = 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhY2NvdW50Iiwic3ViIjoiMjZkOGE1YTg0MDMyYmExN2Q4NDk3MTlkNTljNGY1NzgiLCJpc3MiOiJmYXN0Iiwibmlja25hbWUiOiJCSyIsInR5cCI6IkJlYXJlciIsInNlc3Npb25fc3RhdGUiOiI1ZDU2NTkzYmNjNWFmNzM0OWNlZTMwZjlkNGYzMWIyMCIsImV4cCI6MTc0ODE3MDg5NSwiaWF0IjoxNzE2NjM0ODk1fQ.uaRm2vSNCX8fkFS63Oe-WNWIDHG_cRM-nQ5EGyUMaBg';
         }
 

+ 7 - 7
src/utils/time_format.ts

@@ -243,11 +243,11 @@ export class TimeFormatter {
     }
 
 
-    const utcDate1 = Date.UTC(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate())
-    const utcDate2 = Date.UTC(inputDate.getFullYear(), inputDate.getMonth(), inputDate.getDate())
-    const oneDayMilliseconds = 24 * 60 * 60 * 1000; // 一天的毫秒数
-    var dayDifference = Math.floor((utcDate2 - utcDate1) / oneDayMilliseconds);
-    if (dayDifference < 0) {
+    // const utcDate1 = Date.UTC(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate())
+    // const utcDate2 = Date.UTC(inputDate.getFullYear(), inputDate.getMonth(), inputDate.getDate())
+    // const oneDayMilliseconds = 24 * 60 * 60 * 1000; // 一天的毫秒数
+    // var dayDifference = Math.floor((utcDate2 - utcDate1) / oneDayMilliseconds);
+    // if (dayDifference < 0) {
       var strMonth = TimeFormatter.getMonth(inputDate.getMonth() + 1)
       var strDt = ''
       var strYear = ''
@@ -264,8 +264,8 @@ export class TimeFormatter {
       strDt = strDt + strMonth
       strDt = strDt + (inputDate.getDate()) + '日'
       return strDt
-    }
-    return `${dayDifference}天后`
+    // }
+    // return global.language == 'en'?`${dayDifference} days from now`:`${dayDifference}天后`
 
     // return `${inputDate.getFullYear()}-${TimeFormatter.formatNumber(inputDate.getMonth() + 1)}-${TimeFormatter.formatNumber(
     //   inputDate.getDate()

Some files were not shown because too many files changed in this diff