leon 1 년 전
부모
커밋
1287866bc6
7개의 변경된 파일110개의 추가작업 그리고 59개의 파일을 삭제
  1. 1 1
      ios/AppDelegate.mm
  2. 2 2
      ios/hola.xcodeproj/project.pbxproj
  3. 1 1
      ios/hola/Info.plist
  4. 0 0
      ios/main.jsbundle
  5. 42 14
      src/pages/account/Profile.tsx
  6. 3 0
      src/pages/clock/ClockMain.tsx
  7. 61 41
      src/pages/store/product_list.tsx

+ 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 DEBUGaa
+#if DEBUGaaa
   return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
 #else
   return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

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

@@ -580,7 +580,7 @@
 				CODE_SIGN_ENTITLEMENTS = hola/hola.entitlements;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 131;
+				CURRENT_PROJECT_VERSION = 132;
 				DEVELOPMENT_TEAM = GPMXAZ9G5N;
 				ENABLE_BITCODE = NO;
 				INFOPLIST_FILE = hola/Info.plist;
@@ -613,7 +613,7 @@
 				CODE_SIGN_ENTITLEMENTS = hola/hola.entitlements;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 131;
+				CURRENT_PROJECT_VERSION = 132;
 				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>131</string>
+	<string>132</string>
 	<key>ITSAppUsesNonExemptEncryption</key>
 	<false/>
 	<key>LSApplicationCategoryType</key>

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
ios/main.jsbundle


+ 42 - 14
src/pages/account/Profile.tsx

@@ -47,7 +47,7 @@ export default function Page() {
         }
         getPermissions()
 
-        if (process.env.TARO_ENV == 'rn'){
+        if (process.env.TARO_ENV == 'rn') {
             let Purchases = require("react-native-purchases").default
             if (kIsIOS) {
                 Purchases.configure({
@@ -64,7 +64,7 @@ export default function Page() {
             // setInterval(()=>{
             //     getCustomInfo()
             // },2000)
-            
+
         }
     }, [])
 
@@ -81,12 +81,12 @@ export default function Page() {
         let Purchases = require("react-native-purchases").default
         try {
             const customerInfo = await Purchases.getCustomerInfo();
-            console.log('customer info',customerInfo)
+            console.log('customer info', customerInfo)
             // access latest customerInfo
-          } catch (e) {
-            console.log('customer info error',e)
-           // Error fetching customer info
-          }
+        } catch (e) {
+            console.log('customer info error', e)
+            // Error fetching customer info
+        }
     }
 
     function switchChanged(e) {
@@ -208,23 +208,52 @@ export default function Page() {
         if (!accessObj.access) {
             return ''
         }
+
+        switch (accessObj.access.member.subscription_status) {
+            case 'INITIAL':
+            case 'INACTIVE':
+            case 'INACTIVE_EXPIRED':
+                return 'Unlimited premium access to Pro features forever.';
+            case 'ACTIVE':
+                return t('page.more.member_desc', { time: time_formate(accessObj.access.member.expire) })
+            case 'ACTIVE_RENEWING':
+                return `Your membership will renew on ${time_formate(accessObj.access.member.renewal)}.`
+            case 'ACTIVE_EXPIRING':
+                return `Your membership is expiring soon on ${time_formate(accessObj.access.member.expire)}.`
+
+        }
         if (accessObj.access.member.type == 'NON_CONSUMABLE') {
             return 'Unlimited premium access to Pro features forever.'
         }
         if (accessObj.access.member.type == 'AUTO_RENEW') {
-            return `Your membership will automatically renew on ${member_expire()}.`
+            return `Your membership will automatically renew on ${time_formate(accessObj.access.member.expire)}.`
             // return 'Premium access to Pro features during membership.'
         }
-        return t('page.more.member_desc', { time: member_expire() })
+        return t('page.more.member_desc', { time: time_formate(accessObj.access.member.expire) })
     }
 
-    function member_expire() {
+    function isMember() {
+        console.log('aaaa')
+        if (!user.isLogin || !accessObj || !accessObj.access) {
+            return false;
+        }
+        console.log(accessObj.access)
+        switch (accessObj.access.member.subscription_status){
+            case 'INITIAL':
+            case 'INACTIVE':
+            case 'INACTIVE_EXPIRED':
+                return false;
+        }
+        console.log('bbbbb')
+        return true;
+    }
 
+    function time_formate(timestamp) {
         if (global.language == 'en') {
-            return dayjs(accessObj.access.member.expire).format('MMM D HH:mm')
+            return dayjs(timestamp).format('MMM D HH:mm')
         }
 
-        return dayjs(accessObj.access.member.expire).format('YYYY年MM月DD日 HH:mm')
+        return dayjs(timestamp).format('YYYY年MM月DD日 HH:mm')
     }
 
     function detail() {
@@ -251,14 +280,13 @@ export default function Page() {
 
             <Box>
                 {
-                    (!user.isLogin || (accessObj && accessObj.access && accessObj.access.member.status == 'NON_MEMBER')) ? <View className="balance" onClick={tapBalance}>
+                    !isMember() ? <View className="balance" onClick={tapBalance}>
                         <Text className="title">{t('page.more.stone')}</Text>
                         <Text className="desc" style={{ height: process.env.TARO_ENV == 'weapp' ? rpxToPx(32) : rpxToPx(64) }}>{t('page.more.stone_desc')}</Text>
                     </View> :
                         <View className="balance" onClick={tapBalance}>
                             <Text className="title">{t('page.more.pro_member')}</Text>
                             <Text className="desc">{memberdesc()}</Text>
-                            {/* <Text className="desc">{t('page.more.member_desc', { time: member_expire() })}</Text> */}
                         </View>
                 }
 

+ 3 - 0
src/pages/clock/ClockMain.tsx

@@ -1041,6 +1041,9 @@ export default function Page() {
                             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>
                         }
+                        {
+                            access && access.member && <Text style={{ color: '#fff', fontSize: 15 }}>subscription_status:{access.member.subscription_status}</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>
                         <Text style={{ color: '#fff', fontSize: 15 }}>trigger event:{access.fast_sleep.current.qualification.trigger_event}</Text>

+ 61 - 41
src/pages/store/product_list.tsx

@@ -102,10 +102,10 @@ export default function ProductList() {
                         }
                     });
                 });
-                var list0:any = []
-                var list1:any = []
+                var list0: any = []
+                var list1: any = []
                 array.forEach(element => {
-                    if (element.product.productCategory == 'NON_SUBSCRIPTION'){
+                    if (element.product.productCategory == 'NON_SUBSCRIPTION') {
                         list0.push(element)
                     }
                     else {
@@ -156,19 +156,39 @@ export default function ProductList() {
         })
     }
 
+    function catchBuyAlert() {
+        showAlert({
+            title: 'Active Subscription',
+            content: `You're currently subscribed to ${accessObj.access.member.product.display_name}`,
+            showCancel: false,
+            confirmText: 'OK'
+        })
+    }
+
     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
-            }
+        console.log(item)
+        switch (accessObj.access.member.subscription_status) {
+            case 'ACTIVE':
+                if (segmentIndex == 1) {
+                    catchBuyAlert()
+                    return
+                }
+                break;
+            case 'ACTIVE_RENEWING':
+                if (segmentIndex == 0) {
+                    catchBuyAlert()
+                    return
+                }
+                else {
+                    console.log(item.product.identifier,accessObj.access.member.product.product_id)
+                    if (item.product.identifier == accessObj.access.member.product.product_id) {
+                        catchBuyAlert()
+                        return
+                    }
+                }
+                break;
         }
-        
+
 
         setIsPurchasing(true);
         try {
@@ -197,7 +217,7 @@ export default function ProductList() {
                 pay(item)
                 return;
             }
-            
+
             if (e.code === Purchases.PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR) {
                 return
             }
@@ -219,36 +239,36 @@ export default function ProductList() {
 
     return <View style={{ flex: 1, position: 'relative' }}>
         <View className='seg_bg'>
-            <Text className={segmentIndex==0?'seg_sel':'seg_nor'} onClick={() => setSegmentIndex(0)}>Non-renew</Text>
-            <Text className={segmentIndex==1?'seg_sel':'seg_nor'} onClick={() => setSegmentIndex(1)}>Auto-renew</Text>
+            <Text className={segmentIndex == 0 ? 'seg_sel' : 'seg_nor'} onClick={() => setSegmentIndex(0)}>Non-renew</Text>
+            <Text className={segmentIndex == 1 ? 'seg_sel' : 'seg_nor'} onClick={() => setSegmentIndex(1)}>Auto-renew</Text>
         </View>
-        <ScrollView style={{flex:1}}>
-        {
-            segmentIndex==0 && packages.map((item, index) => {
-                return <View className="product_item" key={index} onClick={() => process.env.TARO_ENV == 'weapp' ? createOrder(item) : pay(item)}>
-                    <Text className="product_title" style={{ color: ColorType.fast }}>{process.env.TARO_ENV == 'weapp' ? (item as any).display_name : (item as any).product.title}</Text>
-                    <Text style={{ color: '#fff', fontSize: 16, marginTop: 5, marginBottom: 5 }}>{process.env.TARO_ENV == 'weapp' ? (item as any).description : (item as any).product.description}</Text>
-                    <View style={{ flexDirection: 'row', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
-                        <Text className="product_price">{process.env.TARO_ENV == 'weapp' ? '¥' + (item as any).price : (item as any).product.priceString}</Text>
-                        <Image style={{ width: 24, height: 24 }} src={require('@/assets/images/arrow3.png')} />
-                    </View>
+        <ScrollView style={{ flex: 1 }}>
+            {
+                segmentIndex == 0 && packages.map((item, index) => {
+                    return <View className="product_item" key={index} onClick={() => process.env.TARO_ENV == 'weapp' ? createOrder(item) : pay(item)}>
+                        <Text className="product_title" style={{ color: ColorType.fast }}>{process.env.TARO_ENV == 'weapp' ? (item as any).display_name : (item as any).product.title}</Text>
+                        <Text style={{ color: '#fff', fontSize: 16, marginTop: 5, marginBottom: 5 }}>{process.env.TARO_ENV == 'weapp' ? (item as any).description : (item as any).product.description}</Text>
+                        <View style={{ flexDirection: 'row', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
+                            <Text className="product_price">{process.env.TARO_ENV == 'weapp' ? '¥' + (item as any).price : (item as any).product.priceString}</Text>
+                            <Image style={{ width: 24, height: 24 }} src={require('@/assets/images/arrow3.png')} />
+                        </View>
 
-                </View>
-            })
-        }
-        {
-            segmentIndex==1 && packages2.map((item, index) => {
-                return <View className="product_item" key={index} onClick={() => process.env.TARO_ENV == 'weapp' ? createOrder(item) : pay(item)}>
-                    <Text className="product_title" style={{ color: ColorType.fast }}>{process.env.TARO_ENV == 'weapp' ? (item as any).display_name : (item as any).product.title}</Text>
-                    <Text style={{ color: '#fff', fontSize: 16, marginTop: 5, marginBottom: 5 }}>{process.env.TARO_ENV == 'weapp' ? (item as any).description : (item as any).product.description}</Text>
-                    <View style={{ flexDirection: 'row', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
-                        <Text className="product_price">{process.env.TARO_ENV == 'weapp' ? '¥' + (item as any).price : (item as any).product.priceString}</Text>
-                        <Image style={{ width: 24, height: 24 }} src={require('@/assets/images/arrow3.png')} />
                     </View>
+                })
+            }
+            {
+                segmentIndex == 1 && packages2.map((item, index) => {
+                    return <View className="product_item" key={index} onClick={() => process.env.TARO_ENV == 'weapp' ? createOrder(item) : pay(item)}>
+                        <Text className="product_title" style={{ color: ColorType.fast }}>{process.env.TARO_ENV == 'weapp' ? (item as any).display_name : (item as any).product.title}</Text>
+                        <Text style={{ color: '#fff', fontSize: 16, marginTop: 5, marginBottom: 5 }}>{process.env.TARO_ENV == 'weapp' ? (item as any).description : (item as any).product.description}</Text>
+                        <View style={{ flexDirection: 'row', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
+                            <Text className="product_price">{process.env.TARO_ENV == 'weapp' ? '¥' + (item as any).price : (item as any).product.priceString}</Text>
+                            <Image style={{ width: 24, height: 24 }} src={require('@/assets/images/arrow3.png')} />
+                        </View>
 
-                </View>
-            })
-        }
+                    </View>
+                })
+            }
         </ScrollView>
         {/* <FlatList
             data={packages}

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.