|
@@ -148,21 +148,21 @@ export default function CheckAccess(props: { record: any, count: number }) {
|
|
|
setAlertContent(t('feature.check_access.non_access.desc',
|
|
setAlertContent(t('feature.check_access.non_access.desc',
|
|
|
{
|
|
{
|
|
|
day: streak_fast_current,
|
|
day: streak_fast_current,
|
|
|
- day_left: streak_fast_min_required - streak_fast_current,
|
|
|
|
|
- day_unit: streak_fast_min_required - streak_fast_current == 1 ? 'day' : 'days'
|
|
|
|
|
|
|
+ // day_left: streak_fast_min_required - streak_fast_current,
|
|
|
|
|
+ // day_unit: streak_fast_min_required - streak_fast_current == 1 ? 'day' : 'days'
|
|
|
}))
|
|
}))
|
|
|
setShowCancel(false)
|
|
setShowCancel(false)
|
|
|
setConfirmText(t('feature.check_access.non_access.btn'))
|
|
setConfirmText(t('feature.check_access.non_access.btn'))
|
|
|
}
|
|
}
|
|
|
else if (preStatus == 'NOT_QUALIFIED' && currentStatus == 'PROVISIONAL_QUALIFIED') {
|
|
else if (preStatus == 'NOT_QUALIFIED' && currentStatus == 'PROVISIONAL_QUALIFIED') {
|
|
|
const { streak_fast_current } = acccessData.current.qualification.condition
|
|
const { streak_fast_current } = acccessData.current.qualification.condition
|
|
|
-
|
|
|
|
|
|
|
+ const reason = t('feature.check_access.gain_access.reason',{day: streak_fast_current})
|
|
|
Taro.setStorage({ key: 'showedDisqualifiedAlert', data: false })
|
|
Taro.setStorage({ key: 'showedDisqualifiedAlert', data: false })
|
|
|
var expire = acccessData.current.qualification.fast_expire
|
|
var expire = acccessData.current.qualification.fast_expire
|
|
|
setShowFastAlert(true)
|
|
setShowFastAlert(true)
|
|
|
setKeepContent(false)
|
|
setKeepContent(false)
|
|
|
setAlertTitle(t('feature.check_access.gain_access.title'))
|
|
setAlertTitle(t('feature.check_access.gain_access.title'))
|
|
|
- setAlertContent(t('feature.check_access.gain_access.desc', { day: streak_fast_current }))
|
|
|
|
|
|
|
+ setAlertContent(t('feature.check_access.gain_access.desc', { reason: reason }))
|
|
|
setShowCancel(true)
|
|
setShowCancel(true)
|
|
|
setCancelText(t('feature.check_access.gain_access.stay_btn'))
|
|
setCancelText(t('feature.check_access.gain_access.stay_btn'))
|
|
|
setConfirmText(t('feature.check_access.gain_access.upgrade'))
|
|
setConfirmText(t('feature.check_access.gain_access.upgrade'))
|
|
@@ -174,7 +174,7 @@ export default function CheckAccess(props: { record: any, count: number }) {
|
|
|
cancel()
|
|
cancel()
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- setSubConfirmText(`Offer Expiring in ${TimeFormatter.countdown(expire)}`)
|
|
|
|
|
|
|
+ setSubConfirmText(t('feature.check_access.gain_access.upgrade_desc', { time: TimeFormatter.countdown(expire) }))
|
|
|
// setConfirmText(`Upgrade to Fasting with Sleep\n(Offer Expiring in ${TimeFormatter.countdown(expire)})`)
|
|
// setConfirmText(`Upgrade to Fasting with Sleep\n(Offer Expiring in ${TimeFormatter.countdown(expire)})`)
|
|
|
}, 1000)
|
|
}, 1000)
|
|
|
}
|
|
}
|
|
@@ -182,10 +182,11 @@ export default function CheckAccess(props: { record: any, count: number }) {
|
|
|
const { streak_fast_current, streak_sleep_current } = acccessData.current.qualification.condition
|
|
const { streak_fast_current, streak_sleep_current } = acccessData.current.qualification.condition
|
|
|
if (global.ring.current_record.scenario == 'FAST') {
|
|
if (global.ring.current_record.scenario == 'FAST') {
|
|
|
var expire = acccessData.current.qualification.fast_expire
|
|
var expire = acccessData.current.qualification.fast_expire
|
|
|
|
|
+ const reason = t('feature.check_access.gain_access.reason',{day: streak_fast_current})
|
|
|
setShowFastAlert(true)
|
|
setShowFastAlert(true)
|
|
|
setKeepContent(false)
|
|
setKeepContent(false)
|
|
|
setAlertTitle(t('feature.check_access.gain_access.title'))
|
|
setAlertTitle(t('feature.check_access.gain_access.title'))
|
|
|
- setAlertContent(t('feature.check_access.gain_access.desc', { day: streak_fast_current }))
|
|
|
|
|
|
|
+ setAlertContent(t('feature.check_access.gain_access.desc', { reason: reason }))
|
|
|
setShowCancel(true)
|
|
setShowCancel(true)
|
|
|
setCancelText(t('feature.check_access.gain_access.stay_btn'))
|
|
setCancelText(t('feature.check_access.gain_access.stay_btn'))
|
|
|
setConfirmText(t('feature.check_access.gain_access.upgrade'))
|
|
setConfirmText(t('feature.check_access.gain_access.upgrade'))
|
|
@@ -196,7 +197,7 @@ export default function CheckAccess(props: { record: any, count: number }) {
|
|
|
cancel()
|
|
cancel()
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- setSubConfirmText(`Offer Expiring in ${TimeFormatter.countdown(expire)}`)
|
|
|
|
|
|
|
+ setSubConfirmText(t('feature.check_access.gain_access.upgrade_desc', { time: TimeFormatter.countdown(expire) }))
|
|
|
// setConfirmText(`Upgrade to Fasting with Sleep\n(Offer Expiring in ${TimeFormatter.countdown(expire)})`)
|
|
// setConfirmText(`Upgrade to Fasting with Sleep\n(Offer Expiring in ${TimeFormatter.countdown(expire)})`)
|
|
|
}, 1000)
|
|
}, 1000)
|
|
|
return;
|
|
return;
|
|
@@ -223,22 +224,22 @@ export default function CheckAccess(props: { record: any, count: number }) {
|
|
|
}, [])
|
|
}, [])
|
|
|
|
|
|
|
|
function upgradeSuccess() {
|
|
function upgradeSuccess() {
|
|
|
- var expire = access.current.qualification.fast_expire
|
|
|
|
|
- setShowFastAlert(true)
|
|
|
|
|
- setKeepContent(false)
|
|
|
|
|
- setAlertTitle(t('feature.check_access.upgrade_pro.title'))
|
|
|
|
|
- setAlertContent(t('feature.check_access.upgrade_pro.desc', { time: TimeFormatter.countdown(expire) }))
|
|
|
|
|
- setShowCancel(false)
|
|
|
|
|
- setConfirmText(t('feature.check_access.upgrade_pro.btn'))
|
|
|
|
|
- setSubConfirmText('')
|
|
|
|
|
- timer = setInterval(() => {
|
|
|
|
|
-
|
|
|
|
|
- if (new Date().getTime() > expire) {
|
|
|
|
|
- cancel()
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- setAlertContent(t('feature.check_access.upgrade_pro.desc', { time: TimeFormatter.countdown(expire) }))
|
|
|
|
|
- }, 1000)
|
|
|
|
|
|
|
+ // var expire = access.current.qualification.fast_expire
|
|
|
|
|
+ // setShowFastAlert(true)
|
|
|
|
|
+ // setKeepContent(false)
|
|
|
|
|
+ // setAlertTitle(t('feature.check_access.upgrade_pro.title'))
|
|
|
|
|
+ // setAlertContent(t('feature.check_access.upgrade_pro.desc', { time: TimeFormatter.countdown(expire) }))
|
|
|
|
|
+ // setShowCancel(false)
|
|
|
|
|
+ // setConfirmText(t('feature.check_access.upgrade_pro.btn'))
|
|
|
|
|
+ // setSubConfirmText('')
|
|
|
|
|
+ // timer = setInterval(() => {
|
|
|
|
|
+
|
|
|
|
|
+ // if (new Date().getTime() > expire) {
|
|
|
|
|
+ // cancel()
|
|
|
|
|
+ // return
|
|
|
|
|
+ // }
|
|
|
|
|
+ // setAlertContent(t('feature.check_access.upgrade_pro.desc', { time: TimeFormatter.countdown(expire) }))
|
|
|
|
|
+ // }, 1000)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function loseGain(access) {
|
|
async function loseGain(access) {
|
|
@@ -261,20 +262,19 @@ export default function CheckAccess(props: { record: any, count: number }) {
|
|
|
|
|
|
|
|
switch (trigger_event) {
|
|
switch (trigger_event) {
|
|
|
case 'FAST_STREAK_LOST':
|
|
case 'FAST_STREAK_LOST':
|
|
|
- desc = t('feature.check_access.lost_reason.fast_streak_lost', { date: date });
|
|
|
|
|
|
|
+ desc = t('feature.check_access.lost_reason.fast_streak_lost');
|
|
|
break;
|
|
break;
|
|
|
case 'SLEEP_STREAK_LOST':
|
|
case 'SLEEP_STREAK_LOST':
|
|
|
- desc = t('feature.check_access.lost_reason.sleep_streak_lost', { date: date });
|
|
|
|
|
|
|
+ desc = t('feature.check_access.lost_reason.sleep_streak_lost');
|
|
|
break;
|
|
break;
|
|
|
case 'FAST_SLEEP_STREAKS_LOST':
|
|
case 'FAST_SLEEP_STREAKS_LOST':
|
|
|
- desc = t('feature.check_access.lost_reason.fast_sleep_streaks_lost', { date: date });
|
|
|
|
|
|
|
+ desc = t('feature.check_access.lost_reason.fast_sleep_streaks_lost');
|
|
|
break;
|
|
break;
|
|
|
case 'SLEEP_STREAK_NOT_GROWING':
|
|
case 'SLEEP_STREAK_NOT_GROWING':
|
|
|
- debugger
|
|
|
|
|
desc = t('feature.check_access.lost_reason.sleep_streak_not_growing');
|
|
desc = t('feature.check_access.lost_reason.sleep_streak_not_growing');
|
|
|
break;
|
|
break;
|
|
|
case 'NOT_SATISFIED_AFTER_DELETE':
|
|
case 'NOT_SATISFIED_AFTER_DELETE':
|
|
|
- desc = t('feature.check_access.lost_reason.not_satisfied_after_delete');
|
|
|
|
|
|
|
+ desc = t('feature.check_access.lost_reason.not_satisfied_after_delete',{day:condition.streak_fast_min_required});
|
|
|
break;
|
|
break;
|
|
|
case 'NA':
|
|
case 'NA':
|
|
|
default:
|
|
default:
|
|
@@ -287,9 +287,9 @@ export default function CheckAccess(props: { record: any, count: number }) {
|
|
|
setShowFastAlert(true)
|
|
setShowFastAlert(true)
|
|
|
setKeepContent(false)
|
|
setKeepContent(false)
|
|
|
setAlertTitle(t('feature.check_access.lose_access.title'))
|
|
setAlertTitle(t('feature.check_access.lose_access.title'))
|
|
|
- setAlertContent(t('feature.check_access.lose_access.desc', { type: desc, require_days: condition.streak_fast_min_required }))
|
|
|
|
|
|
|
+ setAlertContent(t('feature.check_access.lose_access.desc', { reason: desc, require_days: condition.streak_fast_min_required }))
|
|
|
setShowCancel(false)
|
|
setShowCancel(false)
|
|
|
- setConfirmText(t('feature.check_access.lose_access.cancel'))
|
|
|
|
|
|
|
+ setConfirmText(t('feature.check_access.lose_access.btn'))
|
|
|
// setConfirmText('Become a PRO member')
|
|
// setConfirmText('Become a PRO member')
|
|
|
setSubConfirmText('')
|
|
setSubConfirmText('')
|
|
|
Taro.setStorage({ key: 'showedDisqualifiedAlert', data: true })
|
|
Taro.setStorage({ key: 'showedDisqualifiedAlert', data: true })
|