|
|
@@ -69,17 +69,11 @@ export default function CheckAccess(props: { record: any, count: number }) {
|
|
|
if (global.indexPageRefresh) {
|
|
|
global.indexPageRefresh()
|
|
|
}
|
|
|
- if (global.refreshStreaks){
|
|
|
- global.refreshStreaks()
|
|
|
- }
|
|
|
}
|
|
|
if (sleep_expire && new Date().getTime() > sleep_expire && obj.current_record.status == 'WAIT_FOR_START') {
|
|
|
if (global.indexPageRefresh) {
|
|
|
global.indexPageRefresh()
|
|
|
}
|
|
|
- if (global.refreshStreaks){
|
|
|
- global.refreshStreaks()
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -126,6 +120,8 @@ export default function CheckAccess(props: { record: any, count: number }) {
|
|
|
|
|
|
global.chooseMixed = () => {
|
|
|
setChooseMixedSuccess(true)
|
|
|
+ setShowFastAlert(false)
|
|
|
+ setKeepContent(false)
|
|
|
}
|
|
|
global.checkAccess = (acccessData: any) => {
|
|
|
const currentStatus = acccessData.current.qualification.status
|
|
|
@@ -166,7 +162,7 @@ export default function CheckAccess(props: { record: any, count: number }) {
|
|
|
Taro.setStorage({ key: 'showedDisqualifiedAlert', data: false })
|
|
|
var expire = acccessData.current.qualification.fast_expire
|
|
|
setShowFastAlert(true)
|
|
|
- setKeepContent(false)
|
|
|
+ setKeepContent(true)
|
|
|
setAlertTitle(t('feature.check_access.gain_access.title'))
|
|
|
setAlertContent(t('feature.check_access.gain_access.desc', { reason: reason }))
|
|
|
setShowCancel(true)
|
|
|
@@ -231,6 +227,7 @@ export default function CheckAccess(props: { record: any, count: number }) {
|
|
|
}, [])
|
|
|
|
|
|
function upgradeSuccess() {
|
|
|
+ setShowFastAlert(false)
|
|
|
// var expire = access.current.qualification.fast_expire
|
|
|
// setShowFastAlert(true)
|
|
|
// setKeepContent(false)
|
|
|
@@ -266,6 +263,7 @@ export default function CheckAccess(props: { record: any, count: number }) {
|
|
|
dt = sleep_expire
|
|
|
}
|
|
|
var date = TimeFormatter.getMonthAndDayByTimestamp(dt, true)
|
|
|
+ var day_unit = Math.max(condition.streak_fast_min_required-1,1)==1?'day':'days';
|
|
|
|
|
|
switch (trigger_event) {
|
|
|
case 'FAST_STREAK_LOST':
|
|
|
@@ -281,7 +279,7 @@ export default function CheckAccess(props: { record: any, count: number }) {
|
|
|
desc = t('feature.check_access.lost_reason.sleep_streak_not_growing');
|
|
|
break;
|
|
|
case 'NOT_SATISFIED_AFTER_DELETE':
|
|
|
- desc = t('feature.check_access.lost_reason.not_satisfied_after_delete',{day:condition.streak_fast_min_required});
|
|
|
+ desc = t('feature.check_access.lost_reason.not_satisfied_after_delete',{day:Math.max(condition.streak_fast_min_required-1,1),day_unit:day_unit});
|
|
|
break;
|
|
|
case 'NA':
|
|
|
default:
|
|
|
@@ -471,6 +469,8 @@ export default function CheckAccess(props: { record: any, count: number }) {
|
|
|
<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>
|
|
|
</View>
|
|
|
}
|
|
|
|
|
|
@@ -491,73 +491,4 @@ export default function CheckAccess(props: { record: any, count: number }) {
|
|
|
</Modal>
|
|
|
}
|
|
|
</View>
|
|
|
-}
|
|
|
-
|
|
|
-// export const checkAccessProvisional = (acccessData: any, showFastAlert: any) => {
|
|
|
-// debugger
|
|
|
-
|
|
|
-// const currentStatus = acccessData.current.qualification.status
|
|
|
-// const preStatus = acccessData.previous.qualification.status
|
|
|
-
|
|
|
-// function upgrade() {
|
|
|
-// showAlert({
|
|
|
-// title: 'Congrats on Your PRO Status!',
|
|
|
-// content: `To preserve this status, continue your fasting streak in 倒计时 and begin your sleep streak. Remember to keep both of them going.`,
|
|
|
-// showCancel: false,
|
|
|
-// confirmText: 'Got it!',
|
|
|
-// })
|
|
|
-// }
|
|
|
-
|
|
|
-// if (preStatus == 'NOT_QUALIFIED' && currentStatus == 'NOT_QUALIFIED') {
|
|
|
-// debugger
|
|
|
-// const { streak_fast_current } = acccessData.current.qualification.condition
|
|
|
-// showFastAlert({
|
|
|
-// title: 'hello world'
|
|
|
-// })
|
|
|
-// // showAlert({
|
|
|
-// // title: 'Well Done',
|
|
|
-// // content: `You're on a ${streak_fast_current}-day streak.
|
|
|
-// // Two more days until unlocking 'Fasting with sleep.'`,
|
|
|
-// // showCancel: false,
|
|
|
-// // confirmText: 'Got it!',
|
|
|
-// // })
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// else if (preStatus == 'NOT_QUALIFIED' && currentStatus == 'PROVISIONAL_QUALIFIED') {
|
|
|
-// showAlert({
|
|
|
-// title: 'Premium Access Unlocked',
|
|
|
-// content: `You've unlocked 'Fasting with Sleep' since you're on a x-day streak.
|
|
|
-// Are you ready to up the game?`,
|
|
|
-// showCancel: true,
|
|
|
-// cancelText: 'Stay',
|
|
|
-// confirmText: 'Upgrade',
|
|
|
-// confirm: upgrade
|
|
|
-// })
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// else if (preStatus == 'PROVISIONAL_QUALIFIED' && currentStatus == 'PROVISIONAL_QUALIFIED') {
|
|
|
-// const { streak_fast_current, streak_sleep_current } = acccessData.current.qualification.condition
|
|
|
-// showAlert({
|
|
|
-// title: 'Well Done',
|
|
|
-// content: `You're on a ${streak_fast_current}-day fasting streak${streak_sleep_current > 0 ? ' and a ' + streak_sleep_current + '-day sleep streak' : ''}.
|
|
|
-// Keep 'em going to stay in the game.'`,
|
|
|
-// showCancel: false,
|
|
|
-// confirmText: 'Got it!',
|
|
|
-// })
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// else if (preStatus == 'PROVISIONAL_QUALIFIED' && currentStatus == 'NOT_QUALIFIED') {
|
|
|
-// showFastAlert({
|
|
|
-// title: 'hello world2'
|
|
|
-// })
|
|
|
-// // showAlert({
|
|
|
-// // title: 'Premium Access Lost',
|
|
|
-// // content: `You've lost premium access to the 'Fasting with Sleep' feature
|
|
|
-// // since you lost your fasting streak. To regain access, become a PRO or achieve a new 3-day fasting streak.`,
|
|
|
-// // showCancel: true,
|
|
|
-// // cancelText:'Achieve',
|
|
|
-// // confirmText: 'Become',
|
|
|
-// // })
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// }
|
|
|
+}
|