leon 1 年之前
父節點
當前提交
c9149649f7

+ 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 = 97;
+				CURRENT_PROJECT_VERSION = 98;
 				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 = 97;
+				CURRENT_PROJECT_VERSION = 98;
 				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>97</string>
+	<string>98</string>
 	<key>ITSAppUsesNonExemptEncryption</key>
 	<false/>
 	<key>LSApplicationCategoryType</key>

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


+ 10 - 7
src/features/trackTimeDuration/components/CheckAccess.tsx

@@ -64,7 +64,7 @@ const CheckAccess = memo((props: { record: any, count: number, access: any }) =>
             const preStatus = props.access.fast_sleep.previous.qualification.status
             if ((preStatus == 'PROVISIONAL_QUALIFIED' || preStatus == 'QUALIFIED_UNTIL_EXPIRE') &&
                 currentStatus == 'PENDING' &&
-                global.ring.current_record.scenario != 'FAST' &&
+                // global.ring.current_record.scenario != 'FAST' &&
                 obj.current_record.status == 'WAIT_FOR_START') {
                 loseGain(props.access.fast_sleep)
             }
@@ -84,10 +84,10 @@ const CheckAccess = memo((props: { record: any, count: number, access: any }) =>
 
             }
             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){
+                if (member_expire && new Date().getTime() > member_expire) {
                     if (global.indexPageRefresh) {
                         global.indexPageRefresh()
                     }
@@ -155,10 +155,10 @@ const CheckAccess = memo((props: { record: any, count: number, access: any }) =>
             confirmAction = null
             setShowFastAlert(false)
             setKeepContent(false)
-            setTimeout(()=>{
+            setTimeout(() => {
                 global.refreshAccess(res)
-            },2000)
-            
+            }, 2000)
+
         }
         global.checkAccess = (acccessData: any) => {
             const currentStatus = acccessData.current.qualification.status
@@ -257,7 +257,10 @@ const CheckAccess = memo((props: { record: any, count: number, access: any }) =>
                 setShowCancel(false)
                 setConfirmText(t('feature.check_access.stay_qualified.btn'))
             }
-            else if ((preStatus == 'QUALIFIED_UNTIL_EXPIRE' || preStatus == 'PROVISIONAL_QUALIFIED') && currentStatus == 'PENDING' && global.ring.current_record.scenario == 'FAST_SLEEP') {
+            else if ((preStatus == 'QUALIFIED_UNTIL_EXPIRE' || preStatus == 'PROVISIONAL_QUALIFIED')
+                && currentStatus == 'PENDING'
+                // && global.ring.current_record.scenario == 'FAST_SLEEP'
+            ) {
                 loseGain(acccessData);
             }
         }

+ 44 - 3
src/pages/store/product_list.tsx

@@ -7,11 +7,12 @@ 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 { payInfo, products } from "@/services/user";
 import Taro from "@tarojs/taro";
 import showAlert from "@/components/basic/Alert";
 import { useTranslation } from "react-i18next";
 import { AtActivityIndicator } from "taro-ui";
+import NoData from "@/components/view/NoData";
 
 let useNavigation, TouchableOpacity;
 if (process.env.TARO_ENV == 'rn') {
@@ -24,7 +25,9 @@ export default function ProductList() {
     const user = useSelector((state: any) => state.user);
     // - State for displaying an overlay view
     const [isPurchasing, setIsPurchasing] = useState(false);
+    const [showErrorPage, setShowErrorPage] = useState(false);
     const [errorCode, setErrorCode] = useState<any>(-1)
+    const [isLoading, setIsLoading] = useState(false)
     const { t } = useTranslation()
 
     let navigation;
@@ -72,13 +75,46 @@ export default function ProductList() {
             // getProducts();
             // console.log('aaaa')
             // setTimeout(() => {
-            getProducts();
+            // getProducts();
+            getSku();
             // hi()
             // }, 2000)
 
         }
     }, [])
 
+    function getSku() {
+        // Purchases.getOfferings().then(res=>{
+
+        // })
+        setIsLoading(true)
+        Promise.all([Purchases.getOfferings(), products({ store: kIsIOS ? 'app_store' : 'play_store' })]).then(list => {
+
+            var offerings = list[0]
+            var skus: any = (list[1] as any).data
+            if (offerings.current !== null && offerings.current.availablePackages.length !== 0) {
+                var array = (offerings as any).current.availablePackages
+                array.forEach(element => {
+                    skus.forEach(sku => {
+                        if (element.product.identifier == sku.product_id) {
+                            element.product.title = sku.display_name
+                            element.product.description = sku.description
+                        }
+                    });
+                });
+
+                setPackages(array)
+
+            }
+            setShowErrorPage(false)
+            setIsLoading(false)
+            // console.log(list)
+        }).catch(e => {
+            setShowErrorPage(true)
+            setIsLoading(false)
+        })
+    }
+
     async function getProducts() {
         console.log('product list get start')
         try {
@@ -131,11 +167,16 @@ export default function ProductList() {
         }
     }
 
-    if (packages.length == 0)
+    if (isLoading)
         return <View style={{ flex: 1, position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
             <AtActivityIndicator size={40} color="#fff" />
         </View>
 
+    if (showErrorPage)
+        return <View style={{ flex: 1, position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
+            <NoData refresh={() => { getSku() }} />
+        </View>
+
     return <View style={{ flex: 1, position: 'relative' }}>
         <View style={{ height: 40 }} />
         {

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

@@ -84,4 +84,5 @@ 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`
+export const API_USER_ACCESS = `${baseUrl}/api/user/access`
+export const API_PRODUCTS = `${baseUrl}/api/payment/member/products`

+ 17 - 2
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, API_PAY_UPLOAD, API_USER_ACCESS } 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, API_PRODUCTS } from './http/api'
 import { request } from './http/request'
 import { clearSuccess, getInfoSuccess, loginSuccess, logoutSuccess, registerSuccess, updateSuccess } from '@/store/user'
 import { kIsIOS } from '@/utils/tools'
@@ -224,7 +224,22 @@ export const payInfo = (params) => {
 
 }
 
-export const userAccess = ()=>{
+export const products = (params) => {
+    return new Promise((resolve, reject) => {
+        request({
+            url: API_PRODUCTS, method: 'GET', 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: {

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