|
@@ -19,11 +19,12 @@ import CircadianDetailPopup from './CircadianDetailPopup';
|
|
|
import showAlert from '@/components/basic/Alert';
|
|
import showAlert from '@/components/basic/Alert';
|
|
|
import CheckAccess from './CheckAccess';
|
|
import CheckAccess from './CheckAccess';
|
|
|
import { ColorType } from '@/context/themes/color';
|
|
import { ColorType } from '@/context/themes/color';
|
|
|
|
|
+import IndexConsoleMuti from './IndexConsoleMuti';
|
|
|
|
|
|
|
|
let useNavigation;
|
|
let useNavigation;
|
|
|
|
|
|
|
|
-let Linking,PushNotification;
|
|
|
|
|
-let checkNotification;
|
|
|
|
|
|
|
+let Linking, PushNotification;
|
|
|
|
|
+let checkNotification;
|
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
|
useNavigation = require("@react-navigation/native").useNavigation
|
|
useNavigation = require("@react-navigation/native").useNavigation
|
|
|
Linking = require('react-native').Linking;
|
|
Linking = require('react-native').Linking;
|
|
@@ -50,12 +51,13 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
const permission = useSelector((state: any) => state.permission);
|
|
const permission = useSelector((state: any) => state.permission);
|
|
|
const common = useSelector((state: any) => state.common);
|
|
const common = useSelector((state: any) => state.common);
|
|
|
const [firstEnter, setFirstEnter] = useState(true);
|
|
const [firstEnter, setFirstEnter] = useState(true);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
const dayMilliSeconds = 24 * 3600 * 1000;
|
|
const dayMilliSeconds = 24 * 3600 * 1000;
|
|
|
const [btnDisable, setBtnDisable] = useState(false)
|
|
const [btnDisable, setBtnDisable] = useState(false)
|
|
|
const [showStageModal, setShowStageModal] = useState(false)
|
|
const [showStageModal, setShowStageModal] = useState(false)
|
|
|
const [showTimePicker, setShowTimePicker] = useState(false);
|
|
const [showTimePicker, setShowTimePicker] = useState(false);
|
|
|
const [showMutiPicker, setShowMutiPicker] = useState(false);
|
|
const [showMutiPicker, setShowMutiPicker] = useState(false);
|
|
|
|
|
+ const [mutiEvent, setMutiEvent] = useState('start_fast');
|
|
|
const dispatch = useDispatch();
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
|
|
|
|
|
|
@@ -79,7 +81,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
|
// console.error('current status',status)
|
|
// console.error('current status',status)
|
|
|
var NativeAppEventEmitter = require('react-native').NativeAppEventEmitter;
|
|
var NativeAppEventEmitter = require('react-native').NativeAppEventEmitter;
|
|
|
- if (nativePushListener){
|
|
|
|
|
|
|
+ if (nativePushListener) {
|
|
|
(nativePushListener as any).remove()
|
|
(nativePushListener as any).remove()
|
|
|
}
|
|
}
|
|
|
if (kIsIOS) {
|
|
if (kIsIOS) {
|
|
@@ -88,14 +90,14 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
}
|
|
}
|
|
|
nativePushListener = NativeAppEventEmitter.addListener('notificationReceive', (data) => {
|
|
nativePushListener = NativeAppEventEmitter.addListener('notificationReceive', (data) => {
|
|
|
console.log('notification receive action', data)
|
|
console.log('notification receive action', data)
|
|
|
- const { category_id, action_id,id } = data
|
|
|
|
|
|
|
+ const { category_id, action_id, id } = data
|
|
|
uploadLocalPushInfo({
|
|
uploadLocalPushInfo({
|
|
|
- messageId:id
|
|
|
|
|
|
|
+ messageId: id
|
|
|
})
|
|
})
|
|
|
switch (action_id) {
|
|
switch (action_id) {
|
|
|
case 'START_TIMER_NOW':
|
|
case 'START_TIMER_NOW':
|
|
|
{
|
|
{
|
|
|
- if (category_id == 'REMINDER_FS_START_FAST'){
|
|
|
|
|
|
|
+ if (category_id == 'REMINDER_FS_START_FAST') {
|
|
|
operateType = 'startFast'
|
|
operateType = 'startFast'
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
@@ -107,7 +109,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
break;
|
|
break;
|
|
|
case 'PICK_EARLIER_START':
|
|
case 'PICK_EARLIER_START':
|
|
|
{
|
|
{
|
|
|
- if (category_id == 'REMINDER_FS_START_FAST'){
|
|
|
|
|
|
|
+ if (category_id == 'REMINDER_FS_START_FAST') {
|
|
|
tapStartFast(null)
|
|
tapStartFast(null)
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
@@ -117,7 +119,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
break;
|
|
break;
|
|
|
case 'END_TIMER_NOW':
|
|
case 'END_TIMER_NOW':
|
|
|
{
|
|
{
|
|
|
- if (category_id == 'REMINDER_FS_END_FAST'){
|
|
|
|
|
|
|
+ if (category_id == 'REMINDER_FS_END_FAST') {
|
|
|
operateType = 'endFast'
|
|
operateType = 'endFast'
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
@@ -129,7 +131,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
break;
|
|
break;
|
|
|
case 'PICK_EARLIER_END':
|
|
case 'PICK_EARLIER_END':
|
|
|
{
|
|
{
|
|
|
- if (category_id == 'REMINDER_FS_END_FAST'){
|
|
|
|
|
|
|
+ if (category_id == 'REMINDER_FS_END_FAST') {
|
|
|
tapEndFast(null)
|
|
tapEndFast(null)
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
@@ -199,6 +201,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
vibrate()
|
|
vibrate()
|
|
|
|
|
+ setMutiEvent('start_sleep')
|
|
|
setShowMutiPicker(true);
|
|
setShowMutiPicker(true);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -256,6 +259,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
vibrate()
|
|
vibrate()
|
|
|
|
|
+ setMutiEvent('end_sleep')
|
|
|
setShowMutiPicker(true);
|
|
setShowMutiPicker(true);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -307,11 +311,12 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
icon: 'none'
|
|
icon: 'none'
|
|
|
})
|
|
})
|
|
|
vibrate()
|
|
vibrate()
|
|
|
|
|
+ setMutiEvent('end_fast')
|
|
|
setShowMutiPicker(true);
|
|
setShowMutiPicker(true);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (status == 'ONGOING1'){
|
|
|
|
|
|
|
+ if (status == 'ONGOING1') {
|
|
|
// showAlert({
|
|
// showAlert({
|
|
|
// title:t('feature.heads_up.alert_title'),
|
|
// title:t('feature.heads_up.alert_title'),
|
|
|
// content:t('feature.heads_up.ongoing1_content'),
|
|
// content:t('feature.heads_up.ongoing1_content'),
|
|
@@ -319,36 +324,39 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
// confirmText:t('feature.heads_up.ongoing1_confirm'),
|
|
// confirmText:t('feature.heads_up.ongoing1_confirm'),
|
|
|
// showCancel:true,
|
|
// showCancel:true,
|
|
|
// cancel:()=>{
|
|
// cancel:()=>{
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// },
|
|
// },
|
|
|
// confirm:()=>{
|
|
// confirm:()=>{
|
|
|
// tapEndFastOperate()
|
|
// tapEndFastOperate()
|
|
|
// }
|
|
// }
|
|
|
// })
|
|
// })
|
|
|
|
|
+ setMutiEvent('end_fast')
|
|
|
setShowMutiPicker(true);
|
|
setShowMutiPicker(true);
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- else if (status == 'ONGOING2'){
|
|
|
|
|
- showAlert({
|
|
|
|
|
- title:t('feature.heads_up.alert_title'),
|
|
|
|
|
- content:t('feature.heads_up.ongoing2_content'),
|
|
|
|
|
- cancelText:t('feature.heads_up.ongoing2_cancel'),
|
|
|
|
|
- confirmText:t('feature.heads_up.ongoing2_confirm'),
|
|
|
|
|
- showCancel:true,
|
|
|
|
|
- cancel:()=>{
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
- confirm:()=>{
|
|
|
|
|
- tapEndFastOperate()
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ else if (status == 'ONGOING2') {
|
|
|
|
|
+ setMutiEvent('end_fast')
|
|
|
|
|
+ setShowMutiPicker(true);
|
|
|
|
|
+ // showAlert({
|
|
|
|
|
+ // title: t('feature.heads_up.alert_title'),
|
|
|
|
|
+ // content: t('feature.heads_up.ongoing2_content'),
|
|
|
|
|
+ // cancelText: t('feature.heads_up.ongoing2_cancel'),
|
|
|
|
|
+ // confirmText: t('feature.heads_up.ongoing2_confirm'),
|
|
|
|
|
+ // showCancel: true,
|
|
|
|
|
+ // cancel: () => {
|
|
|
|
|
+
|
|
|
|
|
+ // },
|
|
|
|
|
+ // confirm: () => {
|
|
|
|
|
+ // tapEndFastOperate()
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
tapEndFastOperate()
|
|
tapEndFastOperate()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function tapEndFastOperate(){
|
|
|
|
|
|
|
+ function tapEndFastOperate() {
|
|
|
operateType = 'endFast'
|
|
operateType = 'endFast'
|
|
|
global.pauseIndexTimer = true
|
|
global.pauseIndexTimer = true
|
|
|
global.set_time = new Date().getTime()
|
|
global.set_time = new Date().getTime()
|
|
@@ -583,9 +591,9 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- PushNotification.checkPermissions((res)=>{
|
|
|
|
|
|
|
+ PushNotification.checkPermissions((res) => {
|
|
|
//允许授权
|
|
//允许授权
|
|
|
- if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)){
|
|
|
|
|
|
|
+ if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)) {
|
|
|
getLocalPush()
|
|
getLocalPush()
|
|
|
// showAlert({
|
|
// showAlert({
|
|
|
// title: t('feature.track_time_duration.reminders.fast_end_title'),
|
|
// title: t('feature.track_time_duration.reminders.fast_end_title'),
|
|
@@ -655,9 +663,9 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- PushNotification.checkPermissions((res)=>{
|
|
|
|
|
|
|
+ PushNotification.checkPermissions((res) => {
|
|
|
//允许授权
|
|
//允许授权
|
|
|
- if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)){
|
|
|
|
|
|
|
+ if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)) {
|
|
|
getLocalPush()
|
|
getLocalPush()
|
|
|
// showAlert({
|
|
// showAlert({
|
|
|
// title: t('feature.track_time_duration.reminders.wake_title'),
|
|
// title: t('feature.track_time_duration.reminders.wake_title'),
|
|
@@ -712,7 +720,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}).catch((e) => {
|
|
}).catch((e) => {
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
setBtnDisable(false)
|
|
setBtnDisable(false)
|
|
|
var picker = limitPickerRef.current;
|
|
var picker = limitPickerRef.current;
|
|
|
(picker as any).resetPickerData()
|
|
(picker as any).resetPickerData()
|
|
@@ -741,7 +749,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
global.checkAccess((res as any).access)
|
|
global.checkAccess((res as any).access)
|
|
|
// checkAccessProvisional((res as any).access,showFastAlert)
|
|
// checkAccessProvisional((res as any).access,showFastAlert)
|
|
|
}).catch((e) => {
|
|
}).catch((e) => {
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
setBtnDisable(false)
|
|
setBtnDisable(false)
|
|
|
var picker = limitPickerRef.current;
|
|
var picker = limitPickerRef.current;
|
|
|
(picker as any).resetPickerData()
|
|
(picker as any).resetPickerData()
|
|
@@ -786,7 +794,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
</Modal>
|
|
</Modal>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function mutiContent(){
|
|
|
|
|
|
|
+ function mutiContent() {
|
|
|
return <Modal
|
|
return <Modal
|
|
|
testInfo={null}
|
|
testInfo={null}
|
|
|
dismiss={() => {
|
|
dismiss={() => {
|
|
@@ -799,10 +807,9 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
</Modal>
|
|
</Modal>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function mutiPickerContent(){
|
|
|
|
|
- return <View>
|
|
|
|
|
- <Text style={{color:'#fff'}}>hell world</Text>
|
|
|
|
|
- </View>
|
|
|
|
|
|
|
+ function mutiPickerContent() {
|
|
|
|
|
+ global.set_time = new Date().getTime()
|
|
|
|
|
+ return <IndexConsoleMuti status={status} event={mutiEvent} close={() => setShowMutiPicker(false)} />
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function single() {
|
|
function single() {
|
|
@@ -811,7 +818,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
{
|
|
{
|
|
|
status == 'WAIT_FOR_START' &&
|
|
status == 'WAIT_FOR_START' &&
|
|
|
<View onClick={tapStartFast} className='console_btn'>
|
|
<View onClick={tapStartFast} className='console_btn'>
|
|
|
- <Text style={{ fontWeight: 'bold',color:ColorType.black }}>{t('feature.track_time_duration.common.start_fast')}</Text>
|
|
|
|
|
|
|
+ <Text style={{ fontWeight: 'bold', color: ColorType.black }}>{t('feature.track_time_duration.common.start_fast')}</Text>
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
{/* {
|
|
{/* {
|
|
@@ -819,7 +826,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
} */}
|
|
} */}
|
|
|
{
|
|
{
|
|
|
status == 'ONGOING' && <View onClick={tapEndFast} className={status == 'ONGOING' ? 'console_btn' : 'console_btn btn_disable'}>
|
|
status == 'ONGOING' && <View onClick={tapEndFast} className={status == 'ONGOING' ? 'console_btn' : 'console_btn btn_disable'}>
|
|
|
- <Text style={{ fontWeight: 'bold',color:ColorType.black }}>{t('feature.track_time_duration.common.end_fast')}</Text>
|
|
|
|
|
|
|
+ <Text style={{ fontWeight: 'bold', color: ColorType.black }}>{t('feature.track_time_duration.common.end_fast')}</Text>
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
{
|
|
{
|
|
@@ -858,7 +865,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
{
|
|
{
|
|
|
status == 'WAIT_FOR_START' ?
|
|
status == 'WAIT_FOR_START' ?
|
|
|
<View onClick={tapStartFast} className='console_btn'>
|
|
<View onClick={tapStartFast} className='console_btn'>
|
|
|
- <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32),color:ColorType.black }}>{t('feature.track_time_duration.common.start_fast')}</Text>
|
|
|
|
|
|
|
+ <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32), color: ColorType.black }}>{t('feature.track_time_duration.common.start_fast')}</Text>
|
|
|
</View> :
|
|
</View> :
|
|
|
<View onClick={() => { tapStage(0) }} className='stage_btn'>
|
|
<View onClick={() => { tapStage(0) }} className='stage_btn'>
|
|
|
<Text style={{ flex: 1, color: '#fff' }}>{t('feature.track_time_duration.stage.a')}</Text>
|
|
<Text style={{ flex: 1, color: '#fff' }}>{t('feature.track_time_duration.stage.a')}</Text>
|
|
@@ -877,7 +884,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
{
|
|
{
|
|
|
status != 'ONGOING1' && <Image className='lock' src={require('@assets/images/lock.png')} />
|
|
status != 'ONGOING1' && <Image className='lock' src={require('@assets/images/lock.png')} />
|
|
|
}
|
|
}
|
|
|
- <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32),color:ColorType.black }}>{t('feature.track_time_duration.common.start_sleep')}</Text>
|
|
|
|
|
|
|
+ <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32), color: ColorType.black }}>{t('feature.track_time_duration.common.start_sleep')}</Text>
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
{
|
|
{
|
|
@@ -899,7 +906,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
{
|
|
{
|
|
|
status != 'ONGOING2' && <Image className='lock' src={require('@assets/images/lock.png')} />
|
|
status != 'ONGOING2' && <Image className='lock' src={require('@assets/images/lock.png')} />
|
|
|
}
|
|
}
|
|
|
- <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32),color:ColorType.black }}>{t('feature.track_time_duration.common.end_sleep')}</Text>
|
|
|
|
|
|
|
+ <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32), color: ColorType.black }}>{t('feature.track_time_duration.common.end_sleep')}</Text>
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
{
|
|
{
|
|
@@ -916,7 +923,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
|
|
|
{
|
|
{
|
|
|
status == 'WAIT_FOR_START' && <Image className='lock' src={require('@assets/images/lock.png')} />
|
|
status == 'WAIT_FOR_START' && <Image className='lock' src={require('@assets/images/lock.png')} />
|
|
|
}
|
|
}
|
|
|
- <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32),color:ColorType.black }}>{t('feature.track_time_duration.common.end_fast')}</Text>
|
|
|
|
|
|
|
+ <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32), color: ColorType.black }}>{t('feature.track_time_duration.common.end_fast')}</Text>
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
{
|
|
{
|