|
@@ -111,11 +111,11 @@ export const uploadLocalPushInfo = (params) => {
|
|
|
|
|
|
|
|
export const getLocalPush = () => {
|
|
export const getLocalPush = () => {
|
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
|
- console.log('appppple')
|
|
|
|
|
PushNotification.checkPermissions((res)=>{
|
|
PushNotification.checkPermissions((res)=>{
|
|
|
- console.log('sssss',res)
|
|
|
|
|
|
|
+ console.log('aaaaaaaa',res)
|
|
|
|
|
+ console.log('aaaaaaaa',res.alert)
|
|
|
//允许授权
|
|
//允许授权
|
|
|
- if (res.authorizationStatus == 2){
|
|
|
|
|
|
|
+ if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)){
|
|
|
request({
|
|
request({
|
|
|
url: API_LOCAL_PUSHES, method: 'GET', data: {}
|
|
url: API_LOCAL_PUSHES, method: 'GET', data: {}
|
|
|
}).then(res => {
|
|
}).then(res => {
|
|
@@ -144,10 +144,6 @@ export const getLocalPush = () => {
|
|
|
});
|
|
});
|
|
|
PushNotification.cancelAllLocalNotifications()
|
|
PushNotification.cancelAllLocalNotifications()
|
|
|
|
|
|
|
|
- if (messages.length == 0) {
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
if (kIsIOS) {
|
|
if (kIsIOS) {
|
|
|
var Jto = require('react-native').NativeModules.NativeBridge;
|
|
var Jto = require('react-native').NativeModules.NativeBridge;
|
|
|
Jto.addLocalPush(messages)
|
|
Jto.addLocalPush(messages)
|
|
@@ -177,7 +173,8 @@ export const getLocalPush = () => {
|
|
|
//... You can use all the options from localNotifications
|
|
//... You can use all the options from localNotifications
|
|
|
channelId: item.id,
|
|
channelId: item.id,
|
|
|
title: item.title,
|
|
title: item.title,
|
|
|
- message: item.content + ' ', // (required)
|
|
|
|
|
|
|
+ message: item.body + '\nPress for actions >>', // (required)
|
|
|
|
|
+ // date:new Date(new Date().getTime()+10*1000),
|
|
|
date: new Date(item.once), // in 60 secs
|
|
date: new Date(item.once), // in 60 secs
|
|
|
allowWhileIdle: true, // (optional) set notification to work while on doze, default: false
|
|
allowWhileIdle: true, // (optional) set notification to work while on doze, default: false
|
|
|
messageId: item.id,
|
|
messageId: item.id,
|
|
@@ -191,7 +188,7 @@ export const getLocalPush = () => {
|
|
|
const date = dayjs().format('YYYY-MM-DD')
|
|
const date = dayjs().format('YYYY-MM-DD')
|
|
|
const { HolaModule } = NativeModules
|
|
const { HolaModule } = NativeModules
|
|
|
debugger
|
|
debugger
|
|
|
- HolaModule.addLocalPush(item.title, item.content, time)
|
|
|
|
|
|
|
+ HolaModule.addLocalPush(item.title, item.body+ '\nPress for actions >>', time)
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
PushNotification.localNotificationSchedule({
|
|
PushNotification.localNotificationSchedule({
|