|
@@ -13,16 +13,18 @@ import Taro from "@tarojs/taro";
|
|
|
import { useTranslation } from "react-i18next";
|
|
import { useTranslation } from "react-i18next";
|
|
|
import { kIsIOS } from "@/utils/tools";
|
|
import { kIsIOS } from "@/utils/tools";
|
|
|
import { ColorType } from "@/context/themes/color";
|
|
import { ColorType } from "@/context/themes/color";
|
|
|
|
|
+// import { useIsFocused } from "@react-navigation/native";
|
|
|
|
|
|
|
|
let confirmAction: any = null;
|
|
let confirmAction: any = null;
|
|
|
let cancelAction: any = null;
|
|
let cancelAction: any = null;
|
|
|
let timer;
|
|
let timer;
|
|
|
let access;
|
|
let access;
|
|
|
-let useNavigation, AppState, Modal;
|
|
|
|
|
|
|
+let useNavigation, AppState, Modal,useIsFocused;
|
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
|
AppState = require("react-native").AppState
|
|
AppState = require("react-native").AppState
|
|
|
Modal = require("react-native").Modal
|
|
Modal = require("react-native").Modal
|
|
|
useNavigation = require("@react-navigation/native").useNavigation
|
|
useNavigation = require("@react-navigation/native").useNavigation
|
|
|
|
|
+ useIsFocused = require("@react-navigation/native").useIsFocused
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const CheckAccess = memo((props: { record: any, count: number, access: any }) => {
|
|
const CheckAccess = memo((props: { record: any, count: number, access: any }) => {
|
|
@@ -48,8 +50,10 @@ const CheckAccess = memo((props: { record: any, count: number, access: any }) =>
|
|
|
const dispatch = useDispatch();
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
|
|
let navigation;
|
|
let navigation;
|
|
|
|
|
+ let isFocused = false;
|
|
|
if (useNavigation) {
|
|
if (useNavigation) {
|
|
|
navigation = useNavigation()
|
|
navigation = useNavigation()
|
|
|
|
|
+ isFocused = useIsFocused()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -104,6 +108,7 @@ const CheckAccess = memo((props: { record: any, count: number, access: any }) =>
|
|
|
// };
|
|
// };
|
|
|
|
|
|
|
|
function viewWillAppear() {
|
|
function viewWillAppear() {
|
|
|
|
|
+ console.log('access page appear')
|
|
|
setRnKeep(true)
|
|
setRnKeep(true)
|
|
|
if (checkChooseMixed && chooseMixedSuccess) {
|
|
if (checkChooseMixed && chooseMixedSuccess) {
|
|
|
upgradeSuccess()
|
|
upgradeSuccess()
|
|
@@ -114,14 +119,14 @@ const CheckAccess = memo((props: { record: any, count: number, access: any }) =>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function viewWillDisappear() {
|
|
function viewWillDisappear() {
|
|
|
- debugger
|
|
|
|
|
|
|
+ console.log('access page disappear')
|
|
|
setRnKeep(false)
|
|
setRnKeep(false)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- useDidShow(() => {
|
|
|
|
|
- console.log('user did show');
|
|
|
|
|
- viewWillAppear()
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ // useDidShow(() => {
|
|
|
|
|
+ // console.log('user did show');
|
|
|
|
|
+ // viewWillAppear()
|
|
|
|
|
+ // })
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
@@ -256,13 +261,7 @@ const CheckAccess = memo((props: { record: any, count: number, access: any }) =>
|
|
|
setShowFastAlert(false)
|
|
setShowFastAlert(false)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function pay() {
|
|
|
|
|
- jumpPage('', 'ProductList', navigation)
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- confirmAction = pay
|
|
|
|
|
- cancelAction = changeFastScenaria
|
|
|
|
|
- }, 200)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
async function loseGain(access) {
|
|
async function loseGain(access) {
|
|
|
var showedDisqualifiedAlert = await getStorage('showedDisqualifiedAlert') || false;
|
|
var showedDisqualifiedAlert = await getStorage('showedDisqualifiedAlert') || false;
|
|
@@ -357,6 +356,8 @@ const CheckAccess = memo((props: { record: any, count: number, access: any }) =>
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
function upgrade() {
|
|
function upgrade() {
|
|
|
const { prev_input, valid, start_time, end_time } = global.ring.schedule.sleep
|
|
const { prev_input, valid, start_time, end_time } = global.ring.schedule.sleep
|
|
|
if (prev_input && valid) {
|
|
if (prev_input && valid) {
|
|
@@ -426,6 +427,14 @@ const CheckAccess = memo((props: { record: any, count: number, access: any }) =>
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function pay() {
|
|
|
|
|
+ jumpPage('', 'ProductList', navigation)
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ confirmAction = pay
|
|
|
|
|
+ cancelAction = changeFastScenaria
|
|
|
|
|
+ }, 200)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function cancelSetting() {
|
|
function cancelSetting() {
|
|
|
const { start_time, end_time } = global.ring.schedule.fast
|
|
const { start_time, end_time } = global.ring.schedule.fast
|
|
|
var params: any = {
|
|
var params: any = {
|
|
@@ -509,7 +518,7 @@ const CheckAccess = memo((props: { record: any, count: number, access: any }) =>
|
|
|
showFastAlert && process.env.TARO_ENV == 'weapp' && alertPop()
|
|
showFastAlert && process.env.TARO_ENV == 'weapp' && alertPop()
|
|
|
}
|
|
}
|
|
|
{
|
|
{
|
|
|
- showFastAlert && rnKeep && process.env.TARO_ENV == 'rn' && <Modal transparent={true}>
|
|
|
|
|
|
|
+ showFastAlert && isFocused && process.env.TARO_ENV == 'rn' && <Modal transparent={true}>
|
|
|
<View style={{ backgroundColor: 'rgba(0,0,0,0.95)', width: '100%', height: '100%', alignItems: 'center', justifyContent: 'center' }}>
|
|
<View style={{ backgroundColor: 'rgba(0,0,0,0.95)', width: '100%', height: '100%', alignItems: 'center', justifyContent: 'center' }}>
|
|
|
{alertPop()}
|
|
{alertPop()}
|
|
|
</View>
|
|
</View>
|