|
|
@@ -16,7 +16,7 @@ import Tabbar from "@/components/navigation/TabBar";
|
|
|
import { getInfoSuccess, updateDebug } from "@/store/user";
|
|
|
import TitleView from "@/features/trackTimeDuration/components/TitleView";
|
|
|
import showAlert from "@/components/basic/Alert";
|
|
|
-import { rpxToPx } from "@/utils/tools";
|
|
|
+import { kIsAndroid, kIsIOS, rpxToPx } from "@/utils/tools";
|
|
|
import dayjs from "dayjs";
|
|
|
|
|
|
let useNavigation, SwitchRN;
|
|
|
@@ -46,6 +46,26 @@ export default function Page() {
|
|
|
setSwitchOn(status)
|
|
|
}
|
|
|
getPermissions()
|
|
|
+
|
|
|
+ if (process.env.TARO_ENV == 'rn'){
|
|
|
+ let Purchases = require("react-native-purchases").default
|
|
|
+ if (kIsIOS) {
|
|
|
+ Purchases.configure({
|
|
|
+ apiKey: 'appl_FNFYDLwHZlXzqrKJFlErWXUHGwx',
|
|
|
+ appUserID: user.id
|
|
|
+ })
|
|
|
+ }
|
|
|
+ else if (kIsAndroid) {
|
|
|
+ Purchases.configure({
|
|
|
+ apiKey: 'goog_cyJSYOsnZpNqsUbCsHSdhqQdQwe',
|
|
|
+ appUserID: user.id
|
|
|
+ })
|
|
|
+ }
|
|
|
+ setInterval(()=>{
|
|
|
+ getCustomInfo()
|
|
|
+ },2000)
|
|
|
+
|
|
|
+ }
|
|
|
}, [])
|
|
|
|
|
|
if (process.env.TARO_ENV == 'weapp') {
|
|
|
@@ -57,6 +77,18 @@ export default function Page() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ async function getCustomInfo() {
|
|
|
+ let Purchases = require("react-native-purchases").default
|
|
|
+ try {
|
|
|
+ const customerInfo = await Purchases.getCustomerInfo();
|
|
|
+ console.log('customer info',customerInfo)
|
|
|
+ // access latest customerInfo
|
|
|
+ } catch (e) {
|
|
|
+ console.log('customer info error',e)
|
|
|
+ // Error fetching customer info
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
function switchChanged(e) {
|
|
|
setSwitchOn(e.detail.value)
|
|
|
Taro.setStorageSync('isDebug', e.detail.value)
|