leon hai 1 ano
pai
achega
0cd9c36e6b

+ 1 - 1
ios/AppDelegate.mm

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

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

@@ -576,7 +576,7 @@
 				CODE_SIGN_ENTITLEMENTS = hola/hola.entitlements;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 83;
+				CURRENT_PROJECT_VERSION = 84;
 				DEVELOPMENT_TEAM = GPMXAZ9G5N;
 				ENABLE_BITCODE = NO;
 				INFOPLIST_FILE = hola/Info.plist;
@@ -609,7 +609,7 @@
 				CODE_SIGN_ENTITLEMENTS = hola/hola.entitlements;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 83;
+				CURRENT_PROJECT_VERSION = 84;
 				DEVELOPMENT_TEAM = GPMXAZ9G5N;
 				INFOPLIST_FILE = hola/Info.plist;
 				LD_RUNPATH_SEARCH_PATHS = (

+ 1 - 1
ios/hola/Info.plist

@@ -32,7 +32,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>83</string>
+	<string>84</string>
 	<key>ITSAppUsesNonExemptEncryption</key>
 	<false/>
 	<key>LSApplicationCategoryType</key>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
ios/main.jsbundle


+ 29 - 19
src/features/trackTimeDuration/components/CheckAccess.tsx

@@ -25,7 +25,7 @@ if (process.env.TARO_ENV == 'rn') {
     useNavigation = require("@react-navigation/native").useNavigation
 }
 
-const CheckAccess = memo((props: { record: any, count: number }) => {
+const CheckAccess = memo((props: { record: any, count: number, access: any }) => {
     // export default function CheckAccess(props: { record: any, count: number }) {
     const [showFastAlert, setShowFastAlert] = useState(false)
     const [alertTitle, setAlertTitle] = useState('')
@@ -56,17 +56,18 @@ const CheckAccess = memo((props: { record: any, count: number }) => {
 
     useEffect(() => {
         var obj = props.record
-        if (obj.access) {
+        if (props.access) {
             global.ring = ring;
-            const currentStatus = obj.access.current.qualification.status
-            const preStatus = obj.access.previous.qualification.status
-            if (preStatus == 'PROVISIONAL_QUALIFIED' && currentStatus == 'NOT_QUALIFIED' && obj.current_record.status == 'WAIT_FOR_START') {
-                // lose(obj.access.current.qualification.condition)
-                loseGain(obj.access)
+            const currentStatus = props.access.fast_sleep.current.qualification.status
+            const preStatus = props.access.fast_sleep.previous.qualification.status
+            if ((preStatus == 'PROVISIONAL_QUALIFIED' || preStatus == 'QUALIFIED_UNTIL_EXPIRE') &&
+                currentStatus == 'PENDING' &&
+                obj.current_record.status == 'WAIT_FOR_START') {
+                loseGain(props.access.fast_sleep)
             }
             else if (currentStatus == 'PROVISIONAL_QUALIFIED') {
                 Taro.setStorage({ key: 'showedDisqualifiedAlert', data: false })
-                const { fast_expire, sleep_expire } = obj.access.current.qualification
+                const { fast_expire, sleep_expire } = props.access.fast_sleep.current.qualification
                 if (fast_expire && new Date().getTime() > fast_expire && obj.current_record.status == 'WAIT_FOR_START') {
                     if (global.indexPageRefresh) {
                         global.indexPageRefresh()
@@ -79,6 +80,15 @@ const CheckAccess = memo((props: { record: any, count: number }) => {
                 }
 
             }
+            else if (currentStatus == 'QUALIFIED_UNTIL_EXPIRE') {
+                Taro.setStorage({ key: 'showedDisqualifiedAlert', data: false })
+                const member_expire = props.access.member.expire
+                if (member_expire && new Date().getTime() > member_expire && obj.current_record.status == 'WAIT_FOR_START') {
+                    if (global.indexPageRefresh) {
+                        global.indexPageRefresh()
+                    }
+                }
+            }
 
             if (obj.current_record.status != 'WAIT_FOR_START') {
                 Taro.setStorage({ key: 'showedDisqualifiedAlert', data: false })
@@ -133,7 +143,7 @@ const CheckAccess = memo((props: { record: any, count: number }) => {
             setKeepContent(false)
         }
 
-        global.paySuccess = ()=>{
+        global.paySuccess = () => {
             cancelAction = null
             confirmAction = null
             setShowFastAlert(false)
@@ -173,7 +183,7 @@ const CheckAccess = memo((props: { record: any, count: number }) => {
                 setShowCancel(false)
                 setConfirmText(t('feature.check_access.non_access.btn'))
             }
-            else if (preStatus == 'NOT_QUALIFIED' && currentStatus == 'PROVISIONAL_QUALIFIED') {
+            else if (preStatus == 'NOT_QUALIFIED' && (currentStatus == 'PROVISIONAL_QUALIFIED' || currentStatus == 'QUALIFIED_UNTIL_EXPIRE')) {
 
                 const { streak_fast_current } = acccessData.current.qualification.condition
                 const reason = t('feature.check_access.gain_access.reason', { day: streak_fast_current })
@@ -203,7 +213,7 @@ const CheckAccess = memo((props: { record: any, count: number }) => {
                     // setConfirmText(`Upgrade to Fasting with Sleep\n(Offer Expiring in ${TimeFormatter.countdown(expire)})`)
                 }, 1000)
             }
-            else if (preStatus == 'PROVISIONAL_QUALIFIED' && currentStatus == 'PROVISIONAL_QUALIFIED') {
+            else if ((preStatus == 'PROVISIONAL_QUALIFIED' || preStatus == 'QUALIFIED_UNTIL_EXPIRE') && (currentStatus == 'PROVISIONAL_QUALIFIED' || currentStatus == 'QUALIFIED_UNTIL_EXPIRE')) {
                 const { streak_fast_current, streak_sleep_current } = acccessData.current.qualification.condition
                 if (global.ring.current_record.scenario == 'FAST') {
                     var expire = acccessData.current.qualification.fast_expire
@@ -236,7 +246,7 @@ const CheckAccess = memo((props: { record: any, count: number }) => {
                 setShowCancel(false)
                 setConfirmText(t('feature.check_access.stay_qualified.btn'))
             }
-            else if (preStatus == 'PROVISIONAL_QUALIFIED' && currentStatus == 'PENDING') {
+            else if ((preStatus == 'QUALIFIED_UNTIL_EXPIRE' || preStatus == 'PROVISIONAL_QUALIFIED') && currentStatus == 'PENDING') {
                 loseGain(acccessData);
             }
         }
@@ -248,10 +258,10 @@ const CheckAccess = memo((props: { record: any, count: number }) => {
 
     function pay() {
         jumpPage('', 'ProductList', navigation)
-        setTimeout(()=>{
+        setTimeout(() => {
             confirmAction = pay
             cancelAction = changeFastScenaria
-        },200)
+        }, 200)
     }
 
     async function loseGain(access) {
@@ -482,11 +492,11 @@ const CheckAccess = memo((props: { record: any, count: number }) => {
                 }
                 {
                     user.test_user && <View style={{ display: 'flex', flexDirection: 'column' }}>
-                        <Text style={{ color: '#fff', fontSize: 12 }}>current status:{props.record.access.current.qualification.status}</Text>
-                        <Text style={{ color: '#fff', fontSize: 12 }}>previous status:{props.record.access.previous.qualification.status}</Text>
-                        <Text style={{ color: '#fff', fontSize: 12 }}>trigger event:{props.record.access.current.qualification.trigger_event}</Text>
-                        <Text style={{ color: '#fff', fontSize: 12 }}>lost_access_total:{props.record.access.current.qualification.condition.lost_access_total}</Text>
-                        <Text style={{ color: '#fff', fontSize: 12 }}>streak_fast_min_required:{props.record.access.current.qualification.condition.streak_fast_min_required}</Text>
+                        <Text style={{ color: '#fff', fontSize: 12 }}>current status:{props.access.fast_sleep.current.qualification.status}</Text>
+                        <Text style={{ color: '#fff', fontSize: 12 }}>previous status:{props.access.fast_sleep.previous.qualification.status}</Text>
+                        <Text style={{ color: '#fff', fontSize: 12 }}>trigger event:{props.access.fast_sleep.current.qualification.trigger_event}</Text>
+                        <Text style={{ color: '#fff', fontSize: 12 }}>lost_access_total:{props.access.fast_sleep.current.qualification.condition.lost_access_total}</Text>
+                        <Text style={{ color: '#fff', fontSize: 12 }}>streak_fast_min_required:{props.access.fast_sleep.current.qualification.condition.streak_fast_min_required}</Text>
                     </View>
                 }
 

+ 2 - 2
src/features/trackTimeDuration/components/IndexConsole.tsx

@@ -40,7 +40,7 @@ let isTimeout = false
 let stageIndex = 0
 
 let nativePushListener = null
-export default function IndexConsole(props: { record: any, count: number }) {
+export default function IndexConsole(props: { record: any, count: number,access:any }) {
     const user = useSelector((state: any) => state.user);
     const { status } = props.record.current_record;
     const currentRecord = props.record.current_record;
@@ -1017,7 +1017,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
         {
             props.record.scenario.name == 'FAST_SLEEP' ? mixed() : single()
         }
-        <CheckAccess record={props.record} count={props.count} />
+        <CheckAccess record={props.record} count={props.count} access={props.access}/>
     </View>
 
 }

+ 11 - 0
src/features/trackTimeDuration/components/Streaks.scss

@@ -239,4 +239,15 @@
     color: #fff;
     font-weight: bold;
     margin-bottom: 2px;
+}
+.vip_calendar2{
+    margin-top: 40px;
+    margin-left: 46px;
+    width: 658px;
+    height: 104px;
+    background-color: #212121;
+    border-radius: 24px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
 }

+ 3 - 0
src/features/trackTimeDuration/components/Streaks.tsx

@@ -89,6 +89,9 @@ export default function Streaks(props: { count: number }) {
             <StreakItem isFast={true} data={fastStreaks} />
             <StreakItem isFast={false} data={sleepStreaks} />
         </View>
+        <View className="vip_calendar2" onClick={() => {}}>
+            <Text style={{ color: '#fff' }}>Restore my streak</Text>
+        </View>
 
     </View>
 }

+ 38 - 17
src/pages/clock/ChooseScenario.tsx

@@ -16,6 +16,7 @@ import { IconCheck } from "@/components/basic/Icons";
 import Rings2, { BgRing, RingCommon, TargetRing } from '@/features/trackTimeDuration/components/Rings';
 import { useTranslation } from "react-i18next";
 import showAlert from "@/components/basic/Alert";
+import { userAccess } from "@/services/user";
 
 
 let LinearGradient
@@ -53,8 +54,11 @@ export default function ChooseScenario() {
 
         getClocks().then(res => {
             setSelected((res as any).current_record.scenario == 'FAST_SLEEP' ? 1 : 0)
-            setAccess((res as any).access)
+            // setAccess((res as any).access)
             dispatch(chooseMode({ isMixed: (res as any).current_record.scenario == 'FAST_SLEEP' }))
+            userAccess().then(res => {
+                setAccess(res)
+            })
         })
         getPlans().then(res => {
             const data = res as { scenarios: any[] };
@@ -74,6 +78,20 @@ export default function ChooseScenario() {
             })
             dispatch(initTarget(targets))
         })
+
+        if (process.env.TARO_ENV == 'rn') {
+            // AppState.addEventListener('change', handleAppStateChange);
+            navigation.addListener('focus', () => {
+                userAccess().then(res => {
+                    setAccess(res)
+                })
+            });
+
+            // 当页面即将消失时执行
+            navigation.addListener('blur', () => {
+            });
+
+        }
     }, [])
 
     useDidShow(() => {
@@ -92,14 +110,17 @@ export default function ChooseScenario() {
     }
 
     function chooseType(index: number) {
-        const { qualification } = access.current
-        if (qualification.status != "PROVISIONAL_QUALIFIED" && index == 1) {
+        const { qualification } = access.fast_sleep.current
+        if (qualification.status != "PROVISIONAL_QUALIFIED" && qualification.status != 'QUALIFIED_UNTIL_EXPIRE' && index == 1) {
             const { streak_fast_min_required } = qualification.condition;
             showAlert({
                 title: t('feature.choose_scenario.alert_title'),
                 content: t('feature.choose_scenario.alert_content', { day: streak_fast_min_required, day_unit: streak_fast_min_required == 1 ? 'day' : 'days' }),
                 showCancel: false,
                 confirmText: t('feature.choose_scenario.alert_btn'),
+                confirm: () => {
+                    jumpPage('', 'ProductList', navigation)
+                }
             })
             return;
         }
@@ -175,42 +196,42 @@ export default function ChooseScenario() {
             }}>
                 <Rings2 common={common} bgRing={bgRing} targetRing={selected == 0 ? targetRing : null} canvasId={new Date().getTime()} />
             </View>
-            <View style={{ display: 'flex', flexDirection: 'column',marginTop:rpxToPx(8) }}>
-                <Text className="choose_item_title" style={{color:ColorType.fast}}>{t('feature.choose_scenario.fasting')}</Text>
+            <View style={{ display: 'flex', flexDirection: 'column', marginTop: rpxToPx(8) }}>
+                <Text className="choose_item_title" style={{ color: ColorType.fast }}>{t('feature.choose_scenario.fasting')}</Text>
                 <Text className="choose_item_desc">{t('feature.choose_scenario.fast_desc')}</Text>
             </View>
-            <View className="choose_corner_tag" style={{fontWeight:'bold'}}>{t('feature.choose_scenario.free')}</View>
+            <View className="choose_corner_tag" style={{ fontWeight: 'bold' }}>{t('feature.choose_scenario.free')}</View>
             {
                 selected == 0 && <View className="choose_item_check_bg">
                     <IconCheck color={ColorType.fast} width={24} height={24} />
                 </View>
             }
         </View>
-        <View className={selected == 1 ? 'item1 item_sel1' : 'item1'} style={{borderColor:selected==1?ColorType.sleep:'transparent'}} onClick={() => chooseType(1)}>
+        <View className={selected == 1 ? 'item1 item_sel1' : 'item1'} style={{ borderColor: selected == 1 ? ColorType.sleep : 'transparent' }} onClick={() => chooseType(1)}>
             <View style={{
                 flexShrink: 0, display: 'flex', width: 74, height: 74, marginRight: rpxToPx(24),
                 position: 'relative', zIndex: 1, alignItems: 'center', justifyContent: 'center',
-                
+
             }}>
                 <Rings2 common={common} bgRing={bgRing} targetRing={selected == 1 ? targetRing : null} canvasId={new Date().getTime() + 2} />
                 <View style={{ display: 'flex', position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, alignItems: 'center', justifyContent: 'center' }}>
                     <Rings2 common={common2} bgRing={bgRing} targetRing={selected == 1 ? targetRing2 : null} canvasId={new Date().getTime() + 4} />
                 </View>
             </View>
-            <View style={{ display: 'flex', flexDirection: 'column', flex: 1,marginTop:rpxToPx(8) }}>
+            <View style={{ display: 'flex', flexDirection: 'column', flex: 1, marginTop: rpxToPx(8) }}>
                 <Text className="choose_item_title fast_sleep_item_text">{t('feature.choose_scenario.fast_sleep')}</Text>
                 <Text className="choose_item_desc">{t('feature.choose_scenario.fast_sleep_desc')}</Text>
 
 
             </View>
             {
-                process.env.TARO_ENV == 'weapp' ? <View className="choose_corner_tag limit_offer"  style={{fontWeight:'bold'}}>{t('feature.choose_scenario.limit_time_offer')}</View> :
+                process.env.TARO_ENV == 'weapp' ? <View className="choose_corner_tag limit_offer" style={{ fontWeight: 'bold' }}>{t('feature.choose_scenario.limit_time_offer')}</View> :
                     <LinearGradient className="choose_corner_tag"
                         colors={[ColorType.fast, ColorType.sleep]}
                         start={{ x: 0, y: 0 }}
                         end={{ x: 1, y: 0 }}
                     >
-                        <Text style={{ fontSize: rpxToPx(20),fontWeight:'bold',color:ColorType.black }}>{t('feature.choose_scenario.limit_time_offer')}</Text>
+                        <Text style={{ fontSize: rpxToPx(20), fontWeight: 'bold', color: ColorType.black }}>{t('feature.choose_scenario.limit_time_offer')}</Text>
                     </LinearGradient>
             }
             {
@@ -223,12 +244,12 @@ export default function ChooseScenario() {
         <View style={{ flex: 1 }} />
         <Footer>
             <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
-                 <ChooseScenarioBtn
-                        onClick={goSuggestion}
-                        title={t('feature.choose_scenario.next')}
-                        background={background}
-                    />
-                
+                <ChooseScenarioBtn
+                    onClick={goSuggestion}
+                    title={t('feature.choose_scenario.next')}
+                    background={background}
+                />
+
                 {/* {
                     process.env.TARO_ENV == 'rn' && selected == 1 && <View onClick={goSuggestion}>
                         <LinearGradient

+ 16 - 17
src/pages/clock/ClockMain.tsx

@@ -53,6 +53,7 @@ import Discovery from "@/features/trackTimeDuration/components/Discovery";
 import NoData from "@/components/view/NoData";
 import { getLocalPush } from "@/features/trackTimeDuration/actions/TrackTimeActions";
 import { TimeFormatter } from "@/utils/time_format";
+import { userAccess } from "@/services/user";
 
 const utc = require('dayjs/plugin/utc')
 const timezone = require('dayjs/plugin/timezone')
@@ -117,6 +118,7 @@ export default function Page() {
 
     const permission = useSelector((state: any) => state.permission);
     const common = useSelector((state: any) => state.common);
+    const [access,setAccess] = useState<any>(null)
 
     const scrollRef = useRef(null);
 
@@ -133,7 +135,6 @@ export default function Page() {
     useEffect(() => {
         console.log(new Date().toString());
         dispatch(staticResources() as any);
-        console.log('计时器开始')
         pauseTimer = false;
         mainTimer()
 
@@ -172,17 +173,6 @@ export default function Page() {
     useEffect(() => {
 
         if (process.env.TARO_ENV == 'rn') {
-            // JPush.setBadge({
-            //     badge: 0,
-            //     appBadge: 0
-            // })
-            // JPush.isNotificationEnabled((res) => {
-            //     if (res) {
-            //         const test = require('@/utils/push').default
-            //         test()
-            //     }
-            // })
-
             AppState.addEventListener('change', handleAppStateChange);
         }
 
@@ -198,6 +188,7 @@ export default function Page() {
             checkAuthorized();
             //检查用户是否添加过小程序
             checkAddToMini();
+
             wxPubFollow({ force_refresh: true }).then(res => {
                 dispatch(setWXFollow((res as any).wx_pub_followed));
             })
@@ -545,7 +536,15 @@ export default function Page() {
             setLoaded(true)
         })
 
-        getHistory()
+
+
+        if (user.isLogin) {
+            getHistory()
+            userAccess().then(res => {
+                console.log('useraccess',res)
+                setAccess(res)
+            })
+        }
     }
 
     function setCheckData(list: any) {
@@ -827,8 +826,8 @@ export default function Page() {
             <View className="index_section">
                 <Text className="index_section_title">{t('feature.track_time_duration.weekly.title')}</Text>
             </View>
-            <WeekCalendar isFastSleep={false}/>
-            <View className="vip_calendar" style={{marginBottom:40}} onClick={() => setShowEatCalendar(false)}>
+            <WeekCalendar isFastSleep={false} />
+            <View className="vip_calendar" style={{ marginBottom: 40 }} onClick={() => setShowEatCalendar(false)}>
                 <Text style={{ color: '#fff' }}>关闭</Text>
             </View>
         </View>
@@ -866,7 +865,7 @@ export default function Page() {
                         <IndexItem type="FAST_SLEEP" data={homeData} time={timestamp} showStage={false} />
                         {
 
-                            user.isLogin ? <IndexConsole record={homeData} count={count} /> : <StageSelector />
+                            user.isLogin ? <IndexConsole record={homeData} count={count} access={access}/> : <StageSelector />
                         }
 
                     </View>
@@ -913,7 +912,7 @@ export default function Page() {
                         <View className="index_section">
                             <Text className="index_section_title">{t('feature.track_time_duration.weekly.title')}</Text>
                         </View>
-                        <WeekCalendar isFastSleep={true}/>
+                        <WeekCalendar isFastSleep={true} />
                         <View className="vip_calendar" onClick={() => setShowEatCalendar(true)}>
                             <Text style={{ color: '#fff' }}>Show eating and wake windows</Text>
                         </View>

+ 5 - 0
src/pages/clock/StreakRestore.tsx

@@ -0,0 +1,5 @@
+import { View } from "@tarojs/components";
+
+export default function StreakRestore(){
+    return <View></View>
+}

+ 11 - 0
src/pages/rn/RNMain.tsx

@@ -112,6 +112,17 @@ export default function RNMain() {
             );
           },
         }} />
+        <Tab.Screen name="Metrics" component={MetricPage} options={{
+          tabBarIcon: ({ size, focused, color }) => {
+            return (
+              <Image
+                resizeMode='contain'
+                style={{ width: size, height: size }}
+                source={require('@assets/images/camera.png')}
+              />
+            );
+          },
+        }} /> 
         {/* <Tab.Screen name="Explore" component={ExplorePage} options={{
           tabBarIcon: ({ size, focused, color }) => {
             return (

+ 29 - 0
src/pages/store/product_list.scss

@@ -0,0 +1,29 @@
+.product_item{
+    display: flex;
+    flex-direction: column;
+    margin-bottom: 20px;
+    margin-left: 46px;
+    margin-right: 46px;
+    background-color: #1C1C1C;
+    border-radius: 24px;
+    padding-left: 40px;
+    padding-right: 40px;
+    padding-top: 24px;
+    padding-bottom: 24px;
+}
+
+.product_title{
+    font-size: 36px;
+    line-height: 68px;
+    font-weight: bold;
+}
+
+.product_desc{
+
+}
+
+.product_price{
+    color: #fff;
+    font-size: 36px;
+    font-weight: bold;
+}

+ 73 - 29
src/pages/store/product_list.tsx

@@ -1,11 +1,19 @@
-import { payInfo } from "@/services/common";
+
 import { kIsAndroid, kIsIOS } from "@/utils/tools";
-import { View, Text } from "@tarojs/components";
+import { View, Text, Image } from "@tarojs/components";
 import { useEffect, useState } from "react";
 import { FlatList, Pressable } from "react-native";
 import Purchases from 'react-native-purchases'
 import { useSelector } from "react-redux";
+import './product_list.scss'
+import { ColorType } from "@/context/themes/color";
+import { payInfo } from "@/services/user";
+import Taro from "@tarojs/taro";
 
+let useNavigation;
+if (process.env.TARO_ENV == 'rn') {
+    useNavigation = require("@react-navigation/native").useNavigation
+}
 export default function ProductList() {
 
     const [packages, setPackages] = useState([]);
@@ -13,19 +21,27 @@ export default function ProductList() {
     // - State for displaying an overlay view
     const [isPurchasing, setIsPurchasing] = useState(false);
 
+    let navigation;
+    if (useNavigation) {
+        navigation = useNavigation()
+    }
+
     useEffect(() => {
         console.log(user)
         if (process.env.TARO_ENV == 'rn') {
             if (kIsIOS) {
-                Purchases.configure({ apiKey: 'appl_FNFYDLwHZlXzqrKJFlErWXUHGwx',
-                    appUserID:user.id
-                 })
+                Purchases.configure({
+                    apiKey: 'appl_FNFYDLwHZlXzqrKJFlErWXUHGwx',
+                    appUserID: user.id
+                })
             }
             else if (kIsAndroid) {
-                Purchases.configure({ apiKey: 'goog_cyJSYOsnZpNqsUbCsHSdhqQdQwe',
-                    appUserID:user.id
-                 })
+                Purchases.configure({
+                    apiKey: 'goog_cyJSYOsnZpNqsUbCsHSdhqQdQwe',
+                    appUserID: user.id
+                })
             }
+            getProducts();
             // console.log('aaaa')
             // setTimeout(() => {
             //     // getProducts();
@@ -38,8 +54,8 @@ export default function ProductList() {
     async function getProducts() {
         try {
             const offerings = await Purchases.getOfferings();
-            console.log('product list offerings',offerings)
-            console.log('product list detail',(offerings as any).current.availablePackages[1])
+            console.log('product list offerings', offerings)
+            console.log('product list detail', (offerings as any).current.availablePackages[1])
 
             if (offerings.current !== null && offerings.current.availablePackages.length !== 0) {
                 setPackages((offerings as any).current.availablePackages);
@@ -62,40 +78,68 @@ export default function ProductList() {
         }
     }
 
-    async function pay(item:any) {
+    async function pay(item: any) {
         setIsPurchasing(true);
         try {
-            const { customerInfo } = await Purchases.purchasePackage(item);
-            payInfo(customerInfo);
-            console.log('result',customerInfo)
-          } catch (e) {
+            const { customerInfo, productIdentifier, transaction } = await Purchases.purchasePackage(item);
+            payInfo({
+                customerInfo,
+                productIdentifier,
+                transaction
+            }).then(res => {
+                global.paySuccess()
+                if (process.env.TARO_ENV == 'rn') {
+                    navigation.pop(1)
+                }
+                else {
+                    Taro.navigateBack({
+                        delta: 1
+                    })
+                }
+            });
+            console.log('result', customerInfo)
+        } catch (e) {
             debugger
             if (e.code === Purchases.PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR) {
 
             }
-          } finally {
+        } finally {
             setIsPurchasing(false);
-          }
+        }
     }
 
     return <View>
-        <Text style={{ color: '#fff', fontSize: 30 }} onClick={getProducts}>点击获取产品列表</Text>
-        <FlatList
+        <View style={{ height: 40 }} />
+        {
+            packages.map((item, index) => {
+                return <View className="product_item" key={index} onClick={() => pay(item)}>
+                    <Text className="product_title" style={{ color: ColorType.fast }}>{(item as any).product.title}</Text>
+                    <Text style={{ color: '#fff', fontSize: 16, marginTop: 5, marginBottom: 5 }}>{(item as any).product.description}</Text>
+                    <View style={{ flexDirection: 'row', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
+                        <Text className="product_price">{(item as any).product.priceString}</Text>
+                        <Image style={{ width: 24, height: 24 }} src={require('@/assets/images/arrow3.png')} />
+                    </View>
+
+                </View>
+            })
+        }
+        {/* <FlatList
             data={packages}
-            renderItem={({ item }) => <Pressable onPress={()=>{}} style={{flexDirection:'column',marginTop:20,marginBottom:20}}>
-            <View>
-              <Text style={{color:'#fff',fontSize:20,fontWeight:'bold'}}>{(item as any).product.title}</Text>
-              <Text style={{color:'#fff',fontSize:16,marginTop:5,marginBottom:5}}>{(item as any).product.description}</Text>
-            </View>
-            <Text style={{color:'red'}}>{(item as any).product.priceString}</Text>
-            <Text style={{color:'green',fontSize:30,fontWeight:'bold'}} onClick={()=>pay(item)}>Pay</Text>
-          </Pressable>}
+            renderItem={({ item }) => <View className="product_item" onClick={() => pay(item)}>
+                <Text className="product_title" style={{ color: ColorType.fast }}>{(item as any).product.title}</Text>
+                <Text style={{ color: '#fff', fontSize: 16, marginTop: 5, marginBottom: 5 }}>{(item as any).product.description}</Text>
+                <View style={{ flexDirection: 'row', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
+                    <Text className="product_price">{(item as any).product.priceString}</Text>
+                    <Image style={{width:24,height:24}} src={require('@/assets/images/arrow3.png')} />
+                </View>
+
+            </View>}
             keyExtractor={(item) => (item as any).identifier}
 
-        />
+        /> */}
 
         {
-            isPurchasing && <Text style={{color:'#fff',fontSize:40}}>正在付款</Text>
+            isPurchasing && <Text style={{ color: '#fff', fontSize: 40 }}>正在付款</Text>
         }
     </View>
 }

+ 1 - 17
src/services/common.tsx

@@ -1,5 +1,5 @@
 import { setResources, setConfigs } from "@/store/common";
-import { API_CONFIGS, API_DEL_SESSION, API_GLOBAL_CONFIGS, API_PAY_UPLOAD, API_STATIC_RESOURCES, API_SYSTEM_VERSION, API_UPLOAD_SESSION, API_USER_CLIENT, API_USER_LOCATION, APP_VERSION } from "./http/api";
+import { API_CONFIGS, API_DEL_SESSION, API_GLOBAL_CONFIGS, API_PAY_UPLOAD, API_STATIC_RESOURCES, API_SYSTEM_VERSION, API_UPLOAD_SESSION, API_USER_ACCESS, API_USER_CLIENT, API_USER_LOCATION, APP_VERSION } from "./http/api";
 import { request } from "./http/request";
 import Taro from "@tarojs/taro";
 import { kIsIOS } from "@/utils/tools";
@@ -99,19 +99,3 @@ export const delSession = (params) => {
     })
 }
 
-export const payInfo = (params) => {
-    debugger
-    return new Promise((resolve, reject) => {
-        request({
-            url: API_PAY_UPLOAD, method: 'POST', data: {
-                ...params
-            }
-        }).then(res => {
-            resolve(res)
-            // dispatch(loginSuccess(res));
-        }).catch(e => {
-            reject(e)
-        })
-    })
-
-}

+ 1 - 0
src/services/http/api.js

@@ -83,3 +83,4 @@ export const API_NOTIFY_SETTINGS = `${baseUrl}/api/user/notify-settings`
 
 //store
 export const API_PAY_UPLOAD = `${baseUrl}/api/payment/member/rc-receipts`
+export const API_USER_ACCESS = `${baseUrl}/api/user/access`

+ 31 - 1
src/services/user.tsx

@@ -1,5 +1,5 @@
 import Taro from '@tarojs/taro'
-import { API_OAUTH_LOGIN, API_REGISTER, API_LOGIN, API_LOGOUT, API_CLEAR_USER, API_USER_INFO, API_CHECK_UNIQUE, API_CLIENT_ID, API_USER_PERMS, API_USER_LOCATION } from './http/api'
+import { API_OAUTH_LOGIN, API_REGISTER, API_LOGIN, API_LOGOUT, API_CLEAR_USER, API_USER_INFO, API_CHECK_UNIQUE, API_CLIENT_ID, API_USER_PERMS, API_USER_LOCATION, API_PAY_UPLOAD, API_USER_ACCESS } from './http/api'
 import { request } from './http/request'
 import { clearSuccess, getInfoSuccess, loginSuccess, logoutSuccess, registerSuccess, updateSuccess } from '@/store/user'
 import { kIsIOS } from '@/utils/tools'
@@ -208,3 +208,33 @@ export const clientId = (isJiguang = true) => {
 
 }
 
+export const payInfo = (params) => {
+    return new Promise((resolve, reject) => {
+        request({
+            url: API_PAY_UPLOAD, method: 'POST', data: {
+                ...params
+            }
+        }).then(res => {
+            resolve(res)
+            // dispatch(loginSuccess(res));
+        }).catch(e => {
+            reject(e)
+        })
+    })
+
+}
+
+export const userAccess = ()=>{
+    return new Promise((resolve, reject) => {
+        request({
+            url: API_USER_ACCESS, method: 'GET', data: {
+            }
+        }).then(res => {
+            resolve(res)
+            // dispatch(loginSuccess(res));
+        }).catch(e => {
+            reject(e)
+        })
+    })
+}
+

+ 0 - 0
src/store/access.tsx


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio