|
|
@@ -1,8 +1,6 @@
|
|
|
import { getLocalPush } from '@/features/trackTimeDuration/actions/TrackTimeActions';
|
|
|
import { clientInfo } from '@/services/common';
|
|
|
import Taro from '@tarojs/taro';
|
|
|
-// import JPush from 'jpush-react-native';
|
|
|
-import { PushNotification } from 'react-native-push-notification';
|
|
|
import { Alert, Linking } from 'react-native';
|
|
|
import { check, PERMISSIONS, RESULTS, checkMultiple } from 'react-native-permissions';
|
|
|
import { kIsIOS } from './tools';
|
|
|
@@ -14,36 +12,36 @@ export const uploadPermissions = () => {
|
|
|
checkMultiple([PERMISSIONS.ANDROID.CAMERA,
|
|
|
PERMISSIONS.ANDROID.ACCESS_COARSE_LOCATION,
|
|
|
PERMISSIONS.ANDROID.POST_NOTIFICATIONS]).then(statuses => {
|
|
|
- const OneSignal = require('react-native-onesignal').OneSignal
|
|
|
- OneSignal.initialize("2bbf5339-7ab8-4c5c-9a66-c3a8eaea188e");
|
|
|
- OneSignal.Notifications.getPermissionAsync().then((res) => {
|
|
|
- if (res) {
|
|
|
- global.notification = 'authorized'
|
|
|
- }
|
|
|
- else {
|
|
|
- global.notification = 'denied'
|
|
|
- }
|
|
|
- var Jto = require('react-native').NativeModules.NativeBridge;
|
|
|
- Jto.checkSystemLocationService().then(enableLocation => {
|
|
|
- clientInfo({
|
|
|
- perm: {
|
|
|
- android: {
|
|
|
- camera: statuses[PERMISSIONS.ANDROID.CAMERA],
|
|
|
- location: {
|
|
|
- location_services_enabled: enableLocation,
|
|
|
- authorization_status: statuses[PERMISSIONS.ANDROID.ACCESS_COARSE_LOCATION]
|
|
|
- },
|
|
|
- notification: {
|
|
|
- authorization_status: global.notification
|
|
|
- }
|
|
|
- }
|
|
|
+ // const OneSignal = require('react-native-onesignal').OneSignal
|
|
|
+ // OneSignal.initialize("2bbf5339-7ab8-4c5c-9a66-c3a8eaea188e");
|
|
|
+ // OneSignal.Notifications.getPermissionAsync().then((res) => {
|
|
|
+ // if (res) {
|
|
|
+ // global.notification = 'authorized'
|
|
|
+ // }
|
|
|
+ // else {
|
|
|
+ // global.notification = 'denied'
|
|
|
+ // }
|
|
|
+ // var Jto = require('react-native').NativeModules.NativeBridge;
|
|
|
+ // Jto.checkSystemLocationService().then(enableLocation => {
|
|
|
+ // clientInfo({
|
|
|
+ // perm: {
|
|
|
+ // android: {
|
|
|
+ // camera: statuses[PERMISSIONS.ANDROID.CAMERA],
|
|
|
+ // location: {
|
|
|
+ // location_services_enabled: enableLocation,
|
|
|
+ // authorization_status: statuses[PERMISSIONS.ANDROID.ACCESS_COARSE_LOCATION]
|
|
|
+ // },
|
|
|
+ // notification: {
|
|
|
+ // authorization_status: global.notification
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // })
|
|
|
|
|
|
|
|
|
- })
|
|
|
+ // })
|
|
|
});
|
|
|
return
|
|
|
}
|
|
|
@@ -75,15 +73,15 @@ export const uploadPermissions = () => {
|
|
|
|
|
|
export const checkNotification = () => {
|
|
|
if (Taro.getSystemInfoSync().platform == 'android') {
|
|
|
- const OneSignal = require('react-native-onesignal').OneSignal
|
|
|
- OneSignal.Notifications.canRequestPermission().then((res) => {
|
|
|
- if (res) {
|
|
|
- OneSignal.Notifications.requestPermission(true);
|
|
|
- }
|
|
|
- else {
|
|
|
- Linking.openSettings()
|
|
|
- }
|
|
|
- })
|
|
|
+ // const OneSignal = require('react-native-onesignal').OneSignal
|
|
|
+ // OneSignal.Notifications.canRequestPermission().then((res) => {
|
|
|
+ // if (res) {
|
|
|
+ // OneSignal.Notifications.requestPermission(true);
|
|
|
+ // }
|
|
|
+ // else {
|
|
|
+ // Linking.openSettings()
|
|
|
+ // }
|
|
|
+ // })
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -96,16 +94,16 @@ export const checkNotification = () => {
|
|
|
}
|
|
|
else {
|
|
|
// Linking.openSettings()
|
|
|
- const OneSignal = require('react-native-onesignal').OneSignal
|
|
|
- OneSignal.Notifications.requestPermission(true).then((response) => {
|
|
|
- if (response) {
|
|
|
- global.notification = 'authorized'
|
|
|
- uploadPermissions()
|
|
|
- } else {
|
|
|
- global.notification = 'denied'
|
|
|
- uploadPermissions()
|
|
|
- }
|
|
|
- });
|
|
|
+ // const OneSignal = require('react-native-onesignal').OneSignal
|
|
|
+ // OneSignal.Notifications.requestPermission(true).then((response) => {
|
|
|
+ // if (response) {
|
|
|
+ // global.notification = 'authorized'
|
|
|
+ // uploadPermissions()
|
|
|
+ // } else {
|
|
|
+ // global.notification = 'denied'
|
|
|
+ // uploadPermissions()
|
|
|
+ // }
|
|
|
+ // });
|
|
|
}
|
|
|
// const test = require('@/utils/push').default
|
|
|
// test()
|