|
|
@@ -149,104 +149,6 @@ export default function Page() {
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
- // Taro.request({
|
|
|
- // url:'https://api.fast.dev.liveplus.fun/api/static-resource-urls',
|
|
|
- // method:'GET',
|
|
|
- // data:{},
|
|
|
- // timeout:20000,
|
|
|
- // success(result) {
|
|
|
- // showAlert({
|
|
|
- // title:'success',
|
|
|
- // content:JSON.stringify(result)
|
|
|
- // })
|
|
|
- // },
|
|
|
- // fail(res) {
|
|
|
- // showAlert({
|
|
|
- // title:'fail',
|
|
|
- // content:JSON.stringify(res)
|
|
|
- // })
|
|
|
- // },
|
|
|
- // })
|
|
|
-
|
|
|
- if (process.env.TARO_ENV == 'weapp') {
|
|
|
- loadWXCache()
|
|
|
- }
|
|
|
- else {
|
|
|
- loadRNCache()
|
|
|
-
|
|
|
- // PushNotification.configure({
|
|
|
- // onRegister: function (token) {
|
|
|
- // console.log('TOKEN:', token);
|
|
|
- // },
|
|
|
-
|
|
|
- // onNotification: function (notification) {
|
|
|
- // console.log('NOTIFICATION:', notification);
|
|
|
- // // notification.finish(PushNotificationIOS.FetchResult.NoData);
|
|
|
- // },
|
|
|
- // popInitialNotification: true,
|
|
|
- // });
|
|
|
-
|
|
|
- // var channelId = "your-channel-id" + new Date().getTime()
|
|
|
- // PushNotification.createChannel({
|
|
|
- // channelId: channelId, // (required)
|
|
|
- // channelName: "My channel", // (required)
|
|
|
- // channelDescription: "A channel to categorise your notifications", // (optional) default: undefined.
|
|
|
- // playSound: false, // (optional) default: true
|
|
|
- // soundName: "default", // (optional) See `soundName` parameter of `localNotification` function
|
|
|
- // importance: Importance.HIGH, // (optional) default: Importance.HIGH. Int value of the Android notification importance
|
|
|
- // vibrate: true, // (optional) default: true. Creates the default vibration pattern if true.
|
|
|
- // }, (created) => {
|
|
|
- // console.log('create channel result',created)
|
|
|
- // PushNotification.localNotificationSchedule({
|
|
|
- // //... You can use all the options from localNotifications
|
|
|
- // channelId: channelId,
|
|
|
- // title: 'Leon test',
|
|
|
- // message: "Local notification push", // (required)
|
|
|
- // date: new Date(Date.now() + 10 * 1000), // in 60 secs
|
|
|
- // allowWhileIdle: true, // (optional) set notification to work while on doze, default: false
|
|
|
- // // repeatType:'minute',
|
|
|
- // /* Android Only Properties */
|
|
|
- // // repeatTime: 1, // (optional) Increment of configured repeatType. Check 'Repeating Notifications' section for more info.
|
|
|
- // });
|
|
|
- // })
|
|
|
-
|
|
|
- // PushNotification.localNotificationSchedule({
|
|
|
- // //... You can use all the options from localNotifications
|
|
|
- // title: 'Leon test2',
|
|
|
- // message: "Local notification push2", // (required)
|
|
|
- // date: new Date(Date.now() + 15 * 1000), // in 60 secs
|
|
|
- // allowWhileIdle: true, // (optional) set notification to work while on doze, default: false
|
|
|
- // // repeatType:'minute',
|
|
|
- // /* Android Only Properties */
|
|
|
- // // repeatTime: 1, // (optional) Increment of configured repeatType. Check 'Repeating Notifications' section for more info.
|
|
|
- // });
|
|
|
-
|
|
|
- // PushNotification.localNotificationSchedule({
|
|
|
- // //... You can use all the options from localNotifications
|
|
|
- // channelId: "your-channel-id"+new Date().getTime(),
|
|
|
- // title: 'Leon test',
|
|
|
- // message: "Local notification push", // (required)
|
|
|
- // date: new Date(Date.now() + 10 * 1000), // in 60 secs
|
|
|
- // allowWhileIdle: true, // (optional) set notification to work while on doze, default: false
|
|
|
- // // repeatType:'minute',
|
|
|
- // /* Android Only Properties */
|
|
|
- // // repeatTime: 1, // (optional) Increment of configured repeatType. Check 'Repeating Notifications' section for more info.
|
|
|
- // });
|
|
|
-
|
|
|
- // PushNotification.localNotificationSchedule({
|
|
|
- // title: "My notification title",
|
|
|
- // message: "My notification message",
|
|
|
- // date: new Date(Date.now() + 10 * 1000), // first trigger in 30 secs
|
|
|
- // // channelId: 'DemoAppID',
|
|
|
- // repeatType: 'time',
|
|
|
- // repeatTime: 30 * 1000 // repeats every 30 seconds (value has to be defined in miliseconds when the repeatType is 'time')
|
|
|
- // });
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
|
JPush.setBadge({
|
|
|
badge: 0,
|
|
|
@@ -260,31 +162,10 @@ export default function Page() {
|
|
|
})
|
|
|
|
|
|
AppState.addEventListener('change', handleAppStateChange);
|
|
|
-
|
|
|
- /*
|
|
|
- if (Taro.getSystemInfoSync().platform == 'ios') {
|
|
|
- setTimeout(() => {
|
|
|
- var Jto = require('react-native').NativeModules.NativeBridge;
|
|
|
- // Jto.authNotification()
|
|
|
- Jto.getNotificationAuthStatus()
|
|
|
- }, 5000)
|
|
|
- NativeAppEventEmitter.addListener('notificationResult', (data) => {
|
|
|
- console.log(data)
|
|
|
- showAlert({
|
|
|
- title:'notification status',
|
|
|
- content:data
|
|
|
- })
|
|
|
- })
|
|
|
- }*/
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}, [])
|
|
|
|
|
|
- async function demo() {
|
|
|
- }
|
|
|
-
|
|
|
useEffect(() => {
|
|
|
console.log(user.isLogin)
|
|
|
getCheckData()
|
|
|
@@ -307,16 +188,15 @@ export default function Page() {
|
|
|
if (Taro.getSystemInfoSync().platform == 'ios') {
|
|
|
var Jto = require('react-native').NativeModules.NativeBridge;
|
|
|
Jto.getNotificationAuthStatus()
|
|
|
- Jto.rnPageLoaded()
|
|
|
+ // Jto.rnPageLoaded()
|
|
|
NativeAppEventEmitter.addListener('notificationResult', (data) => {
|
|
|
console.log('notification auth result', data)
|
|
|
global.notification = data;
|
|
|
uploadPermissions()
|
|
|
})
|
|
|
- NativeAppEventEmitter.addListener('notificationReceive', (data) => {
|
|
|
- console.log('notification receive action 222', data)
|
|
|
- debugger
|
|
|
- })
|
|
|
+ // NativeAppEventEmitter.addListener('notificationReceive', (data) => {
|
|
|
+ // console.log('notification receive action 222', data)
|
|
|
+ // })
|
|
|
}
|
|
|
|
|
|
// uploadPermissions()
|
|
|
@@ -574,43 +454,6 @@ export default function Page() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- function loadWXCache() {
|
|
|
- var showDayRing = Taro.getStorageSync('showDayRing') || false;
|
|
|
- var showNightRing = Taro.getStorageSync('showNightRing') || false;
|
|
|
- dispatch(showDay(showDayRing))
|
|
|
- dispatch(showNight(showNightRing))
|
|
|
- var gps = Taro.getStorageSync('gps')
|
|
|
- if (gps) {
|
|
|
- global.locationDetail = JSON.parse(gps)
|
|
|
- }
|
|
|
- var userData = Taro.getStorageSync('userData')
|
|
|
- if (userData) {
|
|
|
- dispatch(getInfoSuccess(JSON.parse(userData)));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- async function loadRNCache() {
|
|
|
- var showDayRing = await getStorage('showDayRing') || false;
|
|
|
- var showNightRing = await getStorage('showNightRing') || false;
|
|
|
- dispatch(showDay(showDayRing))
|
|
|
- dispatch(showNight(showNightRing))
|
|
|
- var gps = await getStorage('gps')
|
|
|
- if (gps) {
|
|
|
- global.locationDetail = JSON.parse(gps)
|
|
|
- }
|
|
|
- var userData = await getStorage('userData')
|
|
|
- console.log(userData)
|
|
|
- if (userData) {
|
|
|
- dispatch(getInfoSuccess(JSON.parse(userData)));
|
|
|
- }
|
|
|
- // //测试直接登录
|
|
|
- // else {
|
|
|
- // userData = '{"metrics_times":0,"ongoing":false,"id":"fe6641e66a0e411937a52511e19851cd","mobile_bind":false,"mobile":"","avatar":"https://api.fast.dev.liveplus.fun/api/avatars/fast_441b5a21.svg","nickname":"fast_441b5a21","type":"GENERAL","lv":1,"invite_code":"LVQ5","input_invite_code":true,"reg_time":1712838856000,"login_bind":{"wx":false,"wx_mp":false,"wx_pub":false,"qq":false,"weibo":false},"test_user":true,"manager_user":false,"web_user":false,"rjv_balance":0,"day_level":1,"scenario_select_count":77,"push_enabled":false,"is_new_user":true,"lang":"en","timezone":{},"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhY2NvdW50Iiwic3ViIjoiZmU2NjQxZTY2YTBlNDExOTM3YTUyNTExZTE5ODUxY2QiLCJpc3MiOiJmYXN0Iiwibmlja25hbWUiOiJmYXN0XzQ0MWI1YTIxIiwidHlwIjoiQmVhcmVyIiwic2Vzc2lvbl9zdGF0ZSI6IjA0NTcxOGYzN2Y5NTYzYjcxMTNkMWZhODI5NmE2MjQ2IiwiZXhwIjoxNzQ2Njg4NTYxLCJpYXQiOjE3MTUxNTI1NjF9.x1CguOILCTjT8lKcEdSEeuS9ACc5QK2G4Rxmcz9OMLQ","need_improve":false}'
|
|
|
- // dispatch(getInfoSuccess(JSON.parse(userData)));
|
|
|
- // }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
function getCheckData() {
|
|
|
|
|
|
Promise.all([getClocks(), getPlans()]).then((list) => {
|
|
|
@@ -635,6 +478,13 @@ export default function Page() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (process.env.TARO_ENV == 'rn' && user.isLogin) {
|
|
|
+ if (Taro.getSystemInfoSync().platform == 'ios') {
|
|
|
+ var Jto = require('react-native').NativeModules.NativeBridge;
|
|
|
+ Jto.rnPageLoaded()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
setLoaded(true)
|
|
|
}).catch((e) => {
|
|
|
setErrorPage(true)
|