leon há 1 ano atrás
pai
commit
618ede9c03

+ 1 - 1
ios/AppDelegate.mm

@@ -250,7 +250,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"];

Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
ios/main.jsbundle


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

@@ -33,7 +33,6 @@ export default function DayNightSwiper(props: { count: number, schedule: any, ho
         getLatestLocation()
     }, [user.isLogin])
     global.swiperDayNightRefresh = () => {
-        debugger
         getLatestLocation()
     }
 

+ 3 - 3
src/pages/account/Profile.tsx

@@ -61,9 +61,9 @@ export default function Page() {
                     appUserID: user.id
                 })
             }
-            setInterval(()=>{
-                getCustomInfo()
-            },2000)
+            // setInterval(()=>{
+            //     getCustomInfo()
+            // },2000)
             
         }
     }, [])

+ 36 - 30
src/pages/clock/ClockMain.tsx

@@ -345,7 +345,6 @@ export default function Page() {
     }
 
     const handleAppStateChange = (nextAppState) => {
-        console.log(nextAppState)
         if (nextAppState != 'active') {
             return
         }
@@ -353,6 +352,9 @@ export default function Page() {
             checkTimeZone()
             updateNotificationStatus()
             mainTimer()
+            if (user.isLogin){
+                getUserAccess()
+            }
         }
 
     };
@@ -504,7 +506,7 @@ export default function Page() {
                     setTimeout(() => {
                         Taro.createSelectorQuery().select('#latest').boundingClientRect((rect) => {
                             Taro.pageScrollTo({
-                                scrollTop: (rect as any).top-40,
+                                scrollTop: (rect as any).top - 40,
                                 duration: 150
                             })
                         }).exec()
@@ -540,15 +542,7 @@ export default function Page() {
 
         if (user.isLogin) {
             getHistory()
-            userAccess().then(res => {
-                global.offsetTimestamp = 0;
-                const {server_timestamp} = res as any
-                if (server_timestamp){
-                    global.offsetTimestamp = new Date().getTime()-server_timestamp
-                }
-                dispatch(setAccessData(res))
-                setAccess(res)
-            })
+            getUserAccess()
         }
     }
 
@@ -556,6 +550,18 @@ export default function Page() {
         setAccess(res)
     }
 
+    function getUserAccess() {
+        userAccess().then(res => {
+            global.offsetTimestamp = 0;
+            const { server_timestamp } = res as any
+            if (server_timestamp) {
+                global.offsetTimestamp = new Date().getTime() - server_timestamp
+            }
+            dispatch(setAccessData(res))
+            setAccess(res)
+        })
+    }
+
     function setCheckData(list: any) {
         setHomeData(list[0])
         setSchedules(list[1].scenarios)
@@ -841,39 +847,39 @@ export default function Page() {
             </View>
             <WeekCalendar isFastSleep={false} />
             <View className="vip_calendar" style={{ marginBottom: 40 }} onClick={() => setShowEatCalendar(false)}>
-                <Text style={{ color: '#fff',fontWeight:'bold' }}>{t('feature.track_time_duration.weekly.back')}</Text>
+                <Text style={{ color: '#fff', fontWeight: 'bold' }}>{t('feature.track_time_duration.weekly.back')}</Text>
             </View>
         </View>
     }
 
-    function demo(){
+    function demo() {
         Taro.addPhoneCalendar({
-            title:'单次日历标题',
-            startTime:(new Date().getTime()/1000+60),
-            success:(res)=>{
+            title: '单次日历标题',
+            startTime: (new Date().getTime() / 1000 + 60),
+            success: (res) => {
                 console.log('success')
             },
-            fail:(e)=>{
-                console.log('failed',e)
+            fail: (e) => {
+                console.log('failed', e)
             },
-            complete:(res)=>{
+            complete: (res) => {
                 console.log('complete')
             }
         })
     }
 
-    function demo2(){
+    function demo2() {
         Taro.addPhoneRepeatCalendar({
-            title:'重复日历标题',
-            repeatInterval:'day',
-            startTime:(new Date().getTime()/1000+60),
-            success:(res)=>{
+            title: '重复日历标题',
+            repeatInterval: 'day',
+            startTime: (new Date().getTime() / 1000 + 60),
+            success: (res) => {
                 console.log('success')
             },
-            fail:(e)=>{
-                console.log('failed',e)
+            fail: (e) => {
+                console.log('failed', e)
             },
-            complete:(res)=>{
+            complete: (res) => {
                 console.log('complete')
             }
         })
@@ -964,7 +970,7 @@ export default function Page() {
                         <View className="vip_calendar" onClick={() => setShowEatCalendar(true)}>
                             {
                                 process.env.TARO_ENV == 'weapp' ? <Text className="eat_calendar_text">{t('feature.track_time_duration.weekly.show_eating_window')}</Text> :
-                                    <GradientText style={{ fontSize: rpxToPx(28), color: 'black',fontWeight:'bold' }} colors={[ColorType.food, ColorType.activity]}>{t('feature.track_time_duration.weekly.show_eating_window')}</GradientText>
+                                    <GradientText style={{ fontSize: rpxToPx(28), color: 'black', fontWeight: 'bold' }} colors={[ColorType.food, ColorType.activity]}>{t('feature.track_time_duration.weekly.show_eating_window')}</GradientText>
                             }
 
                         </View>
@@ -1029,11 +1035,11 @@ export default function Page() {
                         <Text style={{ color: '#fff', fontSize: 15 }}>member status:{access && access.member && access.member.status}</Text>
                         {
                             access && access.member && access.member.status == 'MEMBER' &&
-                            <Text style={{ color: '#fff', fontSize: 15 }}>会员过期时间:{access.member.type=='NON_CONSUMABLE'?'Lifelong':dayjs(access.member.expire).format('YYYY-MM-DD HH:mm:ss')}</Text>
+                            <Text style={{ color: '#fff', fontSize: 15 }}>会员过期时间:{access.member.type == 'NON_CONSUMABLE' ? 'Lifelong' : dayjs(access.member.expire).format('YYYY-MM-DD HH:mm:ss')}</Text>
                         }
                         {
                             access && access.member && access.member.status == 'MEMBER' &&
-                            <Text style={{ color: '#fff', fontSize: 15 }}>会员过期倒计时:{access.member.type=='NON_CONSUMABLE'?'Lifelong':TimeFormatter.countdown(access.member.expire)}</Text>
+                            <Text style={{ color: '#fff', fontSize: 15 }}>会员过期倒计时:{access.member.type == 'NON_CONSUMABLE' ? 'Lifelong' : TimeFormatter.countdown(access.member.expire)}</Text>
                         }
                         <Text style={{ color: '#fff', fontSize: 15 }}>current status:{access.fast_sleep.current.qualification.status}</Text>
                         <Text style={{ color: '#fff', fontSize: 15 }}>previous status:{access.fast_sleep.previous.qualification.status}</Text>

+ 12 - 10
src/pages/notification/setting.tsx

@@ -459,7 +459,9 @@ export default function Page() {
             authLocation()
         }
         else {
-            jumpPage('','map',navigation);
+            jumpPage('', 'map', navigation,{
+                zoom: 8,
+            });
             return;
             if (kIsIOS) {
                 authLocation()
@@ -677,7 +679,7 @@ export default function Page() {
     }
 
     function openSwitch(index) {
-        if (process.env.TARO_ENV == 'rn'){
+        if (process.env.TARO_ENV == 'rn') {
             return;
         }
         if (index == 0) {
@@ -735,7 +737,7 @@ export default function Page() {
                 <FSwitch color={ColorType.fast}
                     checked={sunSwitchStatus('extra')}
                     onChange={(value) => {
-                        
+
                         openSwitch(0)
                         if (!isLogin) {
                             jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
@@ -758,7 +760,7 @@ export default function Page() {
                         }).then(res => {
                             // setIsExtra(value)
                             getLocalPush()
-                        }).catch(e=>{
+                        }).catch(e => {
                             setIsExtra(!value)
                         })
                     }}
@@ -807,10 +809,10 @@ export default function Page() {
                                     }
                                 }
                             }).then(res => {
-                                
+
 
                                 global.swiperDayNightRefresh()
-                            }).catch(e=>{
+                            }).catch(e => {
                                 setIsSunrise(!value)
                             })
                         }}
@@ -859,9 +861,9 @@ export default function Page() {
                                     }
                                 }
                             }).then(res => {
-                                
+
                                 global.swiperDayNightRefresh()
-                            }).catch(e=>{
+                            }).catch(e => {
                                 setIsSunset(!value)
                             })
                         }}
@@ -911,9 +913,9 @@ export default function Page() {
                                 }
                             }).then(res => {
 
-                                
+
                                 global.swiperDayNightRefresh()
-                            }).catch(e=>{
+                            }).catch(e => {
                                 setIsSolarNoon(!value)
                             })
                         }}

+ 19 - 2
src/pages/store/product_list.tsx

@@ -12,6 +12,8 @@ import { AtActivityIndicator } from "taro-ui";
 import NoData from "@/components/view/NoData";
 import { setAccessData } from "@/store/access";
 import Segment from "@/components/navigation/Segment";
+import showAlert from "@/components/basic/Alert";
+// import Purchases from 'react-native-purchases'
 
 let useNavigation, TouchableOpacity, Purchases;
 if (process.env.TARO_ENV == 'rn') {
@@ -30,6 +32,7 @@ export default function ProductList() {
     const [showErrorPage, setShowErrorPage] = useState(false);
     const [errorCode, setErrorCode] = useState<any>(-1)
     const [isLoading, setIsLoading] = useState(false)
+    const accessObj = useSelector((state: any) => state.access);
     const { t } = useTranslation()
 
     let navigation;
@@ -154,6 +157,19 @@ export default function ProductList() {
     }
 
     async function pay(item: any) {
+        if (segmentIndex == 0){
+            if (accessObj.access.member.type == 'AUTO_RENEW' && accessObj.access.member.auto_renew_status == 1) {
+                showAlert({
+                    title:'Active Subscription',
+                    content:`You're currently subscribed to ${accessObj.access.member.product.display_name}`,
+                    showCancel:false,
+                    confirmText:'OK'
+                })
+                return
+            }
+        }
+        
+
         setIsPurchasing(true);
         try {
             const { customerInfo, productIdentifier, transaction } = await Purchases.purchasePackage(item);
@@ -181,10 +197,11 @@ export default function ProductList() {
                 pay(item)
                 return;
             }
-            setErrorCode(e.code)
+            
             if (e.code === Purchases.PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR) {
-
+                return
             }
+            setErrorCode(e.code)
         } finally {
             setIsPurchasing(false);
         }

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff