|
|
@@ -52,6 +52,7 @@ import { setWXFollow } from "@/store/permission";
|
|
|
import Discovery from "@/features/trackTimeDuration/components/Discovery";
|
|
|
import NoData from "@/components/view/NoData";
|
|
|
import { getLocalPush } from "@/features/trackTimeDuration/actions/TrackTimeActions";
|
|
|
+import { TimeFormatter } from "@/utils/time_format";
|
|
|
|
|
|
const utc = require('dayjs/plugin/utc')
|
|
|
const timezone = require('dayjs/plugin/timezone')
|
|
|
@@ -146,7 +147,6 @@ export default function Page() {
|
|
|
}
|
|
|
}
|
|
|
if (global.pauseIndexTimer || pauseTimer) {
|
|
|
- console.log('pause')
|
|
|
return
|
|
|
}
|
|
|
setCount((prevCounter) => prevCounter + 1)
|
|
|
@@ -176,9 +176,7 @@ export default function Page() {
|
|
|
}, [])
|
|
|
|
|
|
useEffect(() => {
|
|
|
- console.log(user.isLogin)
|
|
|
getCheckData()
|
|
|
- // global.pauseIndexTimer = !user.isLogin
|
|
|
|
|
|
|
|
|
|
|
|
@@ -343,9 +341,11 @@ export default function Page() {
|
|
|
if (nextAppState != 'active') {
|
|
|
return
|
|
|
}
|
|
|
- if (nextAppState == 'active')
|
|
|
+ if (nextAppState == 'active') {
|
|
|
checkTimeZone()
|
|
|
- updateNotificationStatus()
|
|
|
+ updateNotificationStatus()
|
|
|
+ }
|
|
|
+
|
|
|
};
|
|
|
|
|
|
function updateNotificationStatus() {
|
|
|
@@ -439,7 +439,8 @@ export default function Page() {
|
|
|
timeZoneId = getTimezoneId()
|
|
|
timeZoneName = getTimezoneName()
|
|
|
}
|
|
|
- clientInfo({
|
|
|
+
|
|
|
+ var clientInfoParams = {
|
|
|
client: {
|
|
|
client_type: process.env.TARO_ENV == 'weapp' ? 'MP' : 'APP',
|
|
|
client_version: process.env.TARO_ENV == 'weapp' ? WX_VERSION : APP_VERSION,//Taro.getAccountInfoSync().miniProgram.version : '1.0',//'1.0'
|
|
|
@@ -459,12 +460,18 @@ export default function Page() {
|
|
|
platform: systemInfo.platform,
|
|
|
system: systemInfo.system
|
|
|
},
|
|
|
- perm: {
|
|
|
- wifi_enabled: systemInfo.wifiEnabled,
|
|
|
- location_authorized: systemInfo.locationAuthorized,
|
|
|
- location_enabled: systemInfo.locationEnabled
|
|
|
+ }
|
|
|
+
|
|
|
+ if (process.env.TARO_ENV == 'weapp') {
|
|
|
+ (clientInfoParams as any).perm = {
|
|
|
+ wxmp: {
|
|
|
+ wifi_enabled: systemInfo.wifiEnabled,
|
|
|
+ location_authorized: systemInfo.locationAuthorized,
|
|
|
+ location_enabled: systemInfo.locationEnabled
|
|
|
+ }
|
|
|
}
|
|
|
- })
|
|
|
+ }
|
|
|
+ clientInfo(clientInfoParams)
|
|
|
}
|
|
|
|
|
|
function getCheckData() {
|
|
|
@@ -626,14 +633,6 @@ export default function Page() {
|
|
|
global.popScheduleAlert = (scenario, startTime) => {
|
|
|
if (process.env.TARO_ENV == 'weapp') {
|
|
|
if (permission.wxPubFollow) {
|
|
|
- // showAlert({
|
|
|
- // title: t('feature.track_time_duration.reminders.schedule_title'),
|
|
|
- // content: scenario.name == 'FAST' ?
|
|
|
- // t('feature.track_time_duration.reminders.enable_schedule_fast_content', { time: startTime }) :
|
|
|
- // t('feature.track_time_duration.reminders.enable_schedule_sleep_content', { time: startTime }),
|
|
|
- // showCancel: false,
|
|
|
- // confirmText: t('feature.track_time_duration.reminders.ok')
|
|
|
- // })
|
|
|
}
|
|
|
else {
|
|
|
showAlert({
|
|
|
@@ -654,14 +653,6 @@ export default function Page() {
|
|
|
PushNotification.checkPermissions((res) => {
|
|
|
//允许授权
|
|
|
if (res.authorizationStatus == 2) {
|
|
|
- // showAlert({
|
|
|
- // title: t('feature.track_time_duration.reminders.schedule_title'),
|
|
|
- // content: scenario.name == 'FAST' ?
|
|
|
- // t('feature.track_time_duration.reminders.enable_schedule_fast_content', { time: startTime }) :
|
|
|
- // t('feature.track_time_duration.reminders.enable_schedule_sleep_content', { time: startTime }),
|
|
|
- // showCancel: false,
|
|
|
- // confirmText: t('feature.track_time_duration.reminders.ok')
|
|
|
- // })
|
|
|
}
|
|
|
else {
|
|
|
showAlert({
|
|
|
@@ -686,12 +677,6 @@ export default function Page() {
|
|
|
global.popMixScheduleAlert = (time1, time2) => {
|
|
|
if (process.env.TARO_ENV == 'weapp') {
|
|
|
if (permission.wxPubFollow) {
|
|
|
- // showAlert({
|
|
|
- // title: t('feature.track_time_duration.reminders.schedule_title'),
|
|
|
- // content: t('feature.track_time_duration.reminders.enable_schedule_mix_content', { time1: time1, time2: time2 }),
|
|
|
- // showCancel: false,
|
|
|
- // confirmText: t('feature.track_time_duration.reminders.ok')
|
|
|
- // })
|
|
|
}
|
|
|
else {
|
|
|
showAlert({
|
|
|
@@ -713,12 +698,6 @@ export default function Page() {
|
|
|
PushNotification.checkPermissions((res) => {
|
|
|
//允许授权
|
|
|
if (res.authorizationStatus == 2) {
|
|
|
- // showAlert({
|
|
|
- // title: t('feature.track_time_duration.reminders.schedule_title'),
|
|
|
- // content: t('feature.track_time_duration.reminders.enable_schedule_mix_content', { time1: time1, time2: time2 }),
|
|
|
- // showCancel: false,
|
|
|
- // confirmText: t('feature.track_time_duration.reminders.ok')
|
|
|
- // })
|
|
|
}
|
|
|
else {
|
|
|
showAlert({
|
|
|
@@ -801,8 +780,14 @@ export default function Page() {
|
|
|
var timestamp = new Date().getTime()
|
|
|
|
|
|
function render() {
|
|
|
+ var smallTitle = ''
|
|
|
+ const weekday = TimeFormatter.getDayOfWeek(new Date().getDay(), true);
|
|
|
+ const date = global.language == 'en' ? dayjs().format('MMMM DD') : dayjs().format('M月D日 ')
|
|
|
+ smallTitle = global.language == 'en' ? (weekday + ', ' + date) : (date + weekday);
|
|
|
+
|
|
|
+
|
|
|
if (!loaded) {
|
|
|
- return <Layout type={TemplateType.customHeader} header={headerView()} title={t('page.clock.title')} titleShowStyle={NaviBarTitleShowType.scrollToShow}>
|
|
|
+ return <Layout type={TemplateType.customHeader} header={headerView()} title={smallTitle} titleShowStyle={NaviBarTitleShowType.scrollToShow}>
|
|
|
<View style={{ width: rpxToPx(750), height: rpxToPx(900), display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
|
|
|
<AtActivityIndicator size={40} color="#fff" />
|
|
|
{
|
|
|
@@ -811,7 +796,7 @@ export default function Page() {
|
|
|
</View>
|
|
|
</Layout>
|
|
|
}
|
|
|
- return <Layout type={TemplateType.customHeader} header={headerView()} title={t('page.clock.title')} titleShowStyle={NaviBarTitleShowType.scrollToShow}>
|
|
|
+ return <Layout type={TemplateType.customHeader} header={headerView()} title={smallTitle} titleShowStyle={NaviBarTitleShowType.scrollToShow}>
|
|
|
|
|
|
<View className="index_container">
|
|
|
{
|
|
|
@@ -872,38 +857,33 @@ export default function Page() {
|
|
|
user.isLogin && <Streaks count={count} />
|
|
|
}
|
|
|
|
|
|
+
|
|
|
{
|
|
|
- user.isLogin && user.test_user && homeData && (homeData as any).access && <View style={{ display: 'flex', flexDirection: 'column' }}>
|
|
|
- <Text style={{ color: '#fff', fontSize: 15 }}>current status:{(homeData as any).access.current.qualification.status}</Text>
|
|
|
- <Text style={{ color: '#fff', fontSize: 15 }}>previous status:{(homeData as any).access.previous.qualification.status}</Text>
|
|
|
- <Text style={{ color: '#fff', fontSize: 15 }}>trigger event:{(homeData as any).access.current.qualification.trigger_event}</Text>
|
|
|
- <Text style={{ color: '#fff', fontSize: 15 }}>lost_access_total:{(homeData as any).access.current.qualification.condition.lost_access_total}</Text>
|
|
|
- <Text style={{ color: '#fff', fontSize: 15 }}>streak_fast_min_required:{(homeData as any).access.current.qualification.condition.streak_fast_min_required}</Text>
|
|
|
+ user.isLogin && !showErrorPage && <View className="index_section" style={{height:rpxToPx(120)}}>
|
|
|
+ <Text className="index_main_title">{t('feature.pro.for_pro')}</Text>
|
|
|
</View>
|
|
|
}
|
|
|
|
|
|
{
|
|
|
- !showErrorPage && <View className="index_section">
|
|
|
- <Text className="index_section_title">昼夜节律</Text>
|
|
|
+ user.isLogin && !showErrorPage && <View className="index_section">
|
|
|
+ <Text className="index_section_title">{t('feature.day_night.group_title')}</Text>
|
|
|
</View>
|
|
|
}
|
|
|
{
|
|
|
- !showErrorPage && <DayNightSwiper count={count} schedule={schedules} homeData={homeData} />
|
|
|
+ user.isLogin && !showErrorPage && <DayNightSwiper count={count} schedule={schedules} homeData={homeData} />
|
|
|
}
|
|
|
|
|
|
{
|
|
|
- (process.env.TARO_ENV == 'weapp'||user.test_user) && <View className="index_section">
|
|
|
- <Text className="index_section_title">{t('page.explore.journal')}</Text>
|
|
|
+ user.isLogin && (process.env.TARO_ENV == 'weapp'||true) && <View className="index_section">
|
|
|
+ <Text className="index_section_title">{t('page.explore.title')}</Text>
|
|
|
</View>
|
|
|
}
|
|
|
|
|
|
{
|
|
|
- (process.env.TARO_ENV == 'weapp'||user.test_user) && <Discovery />
|
|
|
+ user.isLogin && (process.env.TARO_ENV == 'weapp'||true) && <Discovery />
|
|
|
}
|
|
|
|
|
|
- {
|
|
|
- process.env.TARO_ENV == 'weapp' && <View style={{ height: 100 }} />
|
|
|
- }
|
|
|
+
|
|
|
{
|
|
|
modalContent()
|
|
|
}
|
|
|
@@ -914,17 +894,22 @@ export default function Page() {
|
|
|
{
|
|
|
homeData && <DurationPicker record={(homeData as any).current_record} />
|
|
|
}
|
|
|
+
|
|
|
+ {
|
|
|
+ user.isLogin && user.test_user && homeData && (homeData as any).access && <View style={{ display: 'flex', flexDirection: 'column' }}>
|
|
|
+ <Text style={{ color: '#fff', fontSize: 15 }}>current status:{(homeData as any).access.current.qualification.status}</Text>
|
|
|
+ <Text style={{ color: '#fff', fontSize: 15 }}>previous status:{(homeData as any).access.previous.qualification.status}</Text>
|
|
|
+ <Text style={{ color: '#fff', fontSize: 15 }}>trigger event:{(homeData as any).access.current.qualification.trigger_event}</Text>
|
|
|
+ <Text style={{ color: '#fff', fontSize: 15 }}>lost_access_total:{(homeData as any).access.current.qualification.condition.lost_access_total}</Text>
|
|
|
+ <Text style={{ color: '#fff', fontSize: 15 }}>streak_fast_min_required:{(homeData as any).access.current.qualification.condition.streak_fast_min_required}</Text>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
+ {
|
|
|
+ process.env.TARO_ENV == 'weapp' && <View style={{ height: 100 }} />
|
|
|
+ }
|
|
|
<Tabbar index={0} />
|
|
|
</View>
|
|
|
</Layout>
|
|
|
}
|
|
|
-
|
|
|
- // if (process.env.TARO_ENV == 'rn') {
|
|
|
- // return <ScrollView>
|
|
|
- // {
|
|
|
- // render()
|
|
|
- // }
|
|
|
- // </ScrollView>
|
|
|
- // }
|
|
|
return render()
|
|
|
}
|