瀏覽代碼

remove one singal

leon 1 年之前
父節點
當前提交
5583799e2f

+ 2 - 2
ios/AppDelegate.mm

@@ -246,7 +246,7 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
 - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
 {
   //  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
-#if DEBUG
+#if DEBUGaa
   return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
 #else
   return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
@@ -524,7 +524,7 @@ initParams:
 
 - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler{
   NSLog(@"%@",notification);
-  [UIApplication sharedApplication].applicationIconBadgeNumber = 100;
+//  [UIApplication sharedApplication].applicationIconBadgeNumber = 100;
   completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert);
 }
 

文件差異過大導致無法顯示
+ 0 - 2
ios/hola.xcodeproj/project.pbxproj


+ 1 - 1
ios/hola/Info.plist

@@ -32,7 +32,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>119</string>
+	<string>122</string>
 	<key>ITSAppUsesNonExemptEncryption</key>
 	<false/>
 	<key>LSApplicationCategoryType</key>

+ 0 - 1
package.json

@@ -106,7 +106,6 @@
 		"react-native-leaflet-maps": "^0.2.1",
 		"react-native-linear-gradient": "^2.8.3",
 		"react-native-localize": "^3.1.0",
-		"react-native-onesignal": "^5.1.3",
 		"react-native-pager-view": "~6.0.1",
 		"react-native-permissions": "^4.1.5",
 		"react-native-purchases": "^7.27.4",

+ 0 - 2
src/app.tsx

@@ -20,13 +20,11 @@ let LogBox;
 let StatusBar;
 let ActionSheetProvider;
 let messaging;
-let PushNotification;
 if (process.env.TARO_ENV == 'rn') {
   LogBox = require("react-native").LogBox
   StatusBar = require("react-native").StatusBar
   ActionSheetProvider = require('@expo/react-native-action-sheet').ActionSheetProvider
   messaging = require('@react-native-firebase/messaging').default
-  PushNotification = require('react-native-push-notification')
 }
 
 

+ 19 - 19
src/features/trackTimeDuration/components/SetSchedule.rn.tsx

@@ -23,7 +23,7 @@ import { kIsIOS, rpxToPx, vibrate } from "@/utils/tools";
 import { PixelRatio } from "react-native";
 import { clientId } from "@/services/user";
 import showAlert from "@/components/basic/Alert";
-import { OneSignal } from 'react-native-onesignal';
+// import { OneSignal } from 'react-native-onesignal';
 
 let useNavigation;
 
@@ -124,24 +124,24 @@ export default function Component() {
             })
         }
         else {
-            OneSignal.Notifications.canRequestPermission().then((status) => {
-                if (status) {
-                    OneSignal.Notifications.getPermissionAsync().then((res) => {
-                        if (res) {
-                            global.notification = 'authorized'
-                            uploadPermissions()
-                        }
-                        else {
-                            global.notification = 'denied'
-                            uploadPermissions()
-                        }
-                    })
-                }
-                else {
-                    global.notification = 'not_determined'
-                    uploadPermissions()
-                }
-            })
+            // OneSignal.Notifications.canRequestPermission().then((status) => {
+            //     if (status) {
+            //         OneSignal.Notifications.getPermissionAsync().then((res) => {
+            //             if (res) {
+            //                 global.notification = 'authorized'
+            //                 uploadPermissions()
+            //             }
+            //             else {
+            //                 global.notification = 'denied'
+            //                 uploadPermissions()
+            //             }
+            //         })
+            //     }
+            //     else {
+            //         global.notification = 'not_determined'
+            //         uploadPermissions()
+            //     }
+            // })
         }
 
     }, [])

+ 20 - 20
src/pages/clock/SetGoal.tsx

@@ -16,12 +16,12 @@ import showAlert from "@/components/basic/Alert";
 import Taro from "@tarojs/taro";
 import { getLocalPush } from "@/features/trackTimeDuration/actions/TrackTimeActions";
 
-let OneSignal
+// let OneSignal
 let NativeAppEventEmitter
 let Jto
 let uploadPermissions, checkNotification, PushNotification
 if (process.env.TARO_ENV == 'rn') {
-    OneSignal = require('react-native-onesignal').OneSignal
+    // OneSignal = require('react-native-onesignal').OneSignal
     NativeAppEventEmitter = require('react-native').NativeAppEventEmitter
     Jto = require('react-native').NativeModules.NativeBridge;
     uploadPermissions = require('@/utils/native_permission_check').uploadPermissions;
@@ -89,24 +89,24 @@ export default function SetGoal() {
             })
         }
         else {
-            OneSignal.Notifications.canRequestPermission().then((status) => {
-                if (status) {
-                    OneSignal.Notifications.getPermissionAsync().then((res) => {
-                        if (res) {
-                            global.notification = 'authorized'
-                            uploadPermissions()
-                        }
-                        else {
-                            global.notification = 'denied'
-                            uploadPermissions()
-                        }
-                    })
-                }
-                else {
-                    global.notification = 'not_determined'
-                    uploadPermissions()
-                }
-            })
+            // OneSignal.Notifications.canRequestPermission().then((status) => {
+            //     if (status) {
+            //         OneSignal.Notifications.getPermissionAsync().then((res) => {
+            //             if (res) {
+            //                 global.notification = 'authorized'
+            //                 uploadPermissions()
+            //             }
+            //             else {
+            //                 global.notification = 'denied'
+            //                 uploadPermissions()
+            //             }
+            //         })
+            //     }
+            //     else {
+            //         global.notification = 'not_determined'
+            //         uploadPermissions()
+            //     }
+            // })
 
         }
     }

+ 20 - 20
src/pages/notification/setting.tsx

@@ -30,7 +30,7 @@ import { systemLocation } from "@/services/common";
 
 let useNavigation;
 let AppState;
-let OneSignal
+// let OneSignal
 let NativeAppEventEmitter
 let Jto
 let PushNotification
@@ -38,7 +38,7 @@ let checkNotification
 let Linking;
 let LeafletView;
 if (process.env.TARO_ENV == 'rn') {
-    OneSignal = require('react-native-onesignal').OneSignal
+    // OneSignal = require('react-native-onesignal').OneSignal
     NativeAppEventEmitter = require('react-native').NativeAppEventEmitter
     Jto = require('react-native').NativeModules.NativeBridge;
     PushNotification = require('react-native-push-notification')
@@ -163,24 +163,24 @@ export default function Page() {
             })
         }
         else {
-            OneSignal.Notifications.canRequestPermission().then((status) => {
-                if (status) {
-                    OneSignal.Notifications.getPermissionAsync().then((res) => {
-                        if (res) {
-                            global.notification = 'authorized'
-                            setIsAuthorized(true)
-                        }
-                        else {
-                            global.notification = 'denied'
-                            setIsAuthorized(false)
-                        }
-                    })
-                }
-                else {
-                    global.notification = 'not_determined'
-                    setIsAuthorized(false)
-                }
-            })
+            // OneSignal.Notifications.canRequestPermission().then((status) => {
+            //     if (status) {
+            //         OneSignal.Notifications.getPermissionAsync().then((res) => {
+            //             if (res) {
+            //                 global.notification = 'authorized'
+            //                 setIsAuthorized(true)
+            //             }
+            //             else {
+            //                 global.notification = 'denied'
+            //                 setIsAuthorized(false)
+            //             }
+            //         })
+            //     }
+            //     else {
+            //         global.notification = 'not_determined'
+            //         setIsAuthorized(false)
+            //     }
+            // })
 
         }
     }

+ 46 - 48
src/utils/native_permission_check.tsx

@@ -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()

+ 25 - 25
src/utils/push.tsx

@@ -4,7 +4,7 @@ import { clientId } from '@/services/user';
 // import JPush from 'jpush-react-native';
 import { title } from 'process';
 import { uploadPermissions } from './native_permission_check';
-import {OneSignal} from 'react-native-onesignal'
+// import {OneSignal} from 'react-native-onesignal'
 import Taro from '@tarojs/taro';
 import { kIsIOS } from './tools';
 
@@ -63,35 +63,35 @@ export default function jgPush() {
         return;
     }
 
-    const LogLevel = require('react-native-onesignal').LogLevel
-    // const OneSignal = require('react-native-onesignal').OneSignal
+    // const LogLevel = require('react-native-onesignal').LogLevel
+    // // const OneSignal = require('react-native-onesignal').OneSignal
 
-    OneSignal.Debug.setLogLevel(LogLevel.Verbose);
+    // OneSignal.Debug.setLogLevel(LogLevel.Verbose);
 
-    // OneSignal Initialization
-    OneSignal.initialize("2bbf5339-7ab8-4c5c-9a66-c3a8eaea188e");
+    // // OneSignal Initialization
+    // OneSignal.initialize("2bbf5339-7ab8-4c5c-9a66-c3a8eaea188e");
 
-    // requestPermission will show the native iOS or Android notification permission prompt.
-    // We recommend removing the following code and instead using an In-App Message to prompt for notification permission
-    // OneSignal.Notifications.requestPermission(true);
+    // // requestPermission will show the native iOS or Android notification permission prompt.
+    // // We recommend removing the following code and instead using an In-App Message to prompt for notification permission
+    // // OneSignal.Notifications.requestPermission(true);
 
-    // Method for listening for notification clicks
-    OneSignal.Notifications.addEventListener('click', (event) => {
-        console.log('OneSignal: notification clicked:', event);
-    });
+    // // Method for listening for notification clicks
+    // OneSignal.Notifications.addEventListener('click', (event) => {
+    //     console.log('OneSignal: notification clicked:', event);
+    // });
 
-    OneSignal.User.getOnesignalId().then((id) => {
-        var str = OneSignal.User.pushSubscription.getPushSubscriptionId();
-        console.log('OneSignal: device id:', id,str);
-        global.oneID = id
-        setTimeout(() => {
-            clientId(false)
-        }, 3000)
-        // showAlert({
-        //     title: 'OneSignal',
-        //     content: 'device id: ' + id
-        // })
-    })
+    // OneSignal.User.getOnesignalId().then((id) => {
+    //     var str = OneSignal.User.pushSubscription.getPushSubscriptionId();
+    //     console.log('OneSignal: device id:', id,str);
+    //     global.oneID = id
+    //     setTimeout(() => {
+    //         clientId(false)
+    //     }, 3000)
+    //     // showAlert({
+    //     //     title: 'OneSignal',
+    //     //     content: 'device id: ' + id
+    //     // })
+    // })
 
 
 }

+ 0 - 7
yarn.lock

@@ -16870,13 +16870,6 @@ react-native-modal@^13.0.0:
     prop-types "^15.6.2"
     react-native-animatable "1.3.3"
 
-react-native-onesignal@^5.1.3:
-  version "5.1.3"
-  resolved "https://registry.yarnpkg.com/react-native-onesignal/-/react-native-onesignal-5.1.3.tgz#2da1819255a329dca6571ddef22184410c26b627"
-  integrity sha512-ynHUqN6TaV98xghA05GddwBXF41jgb7BboP2xucvvJljxEw6CICnaiMfcupsxGNNHm74FBLsl5JK3qMuoLpoJw==
-  dependencies:
-    invariant "^2.2.2"
-
 react-native-pager-view@~6.0.1:
   version "6.0.2"
   resolved "https://registry.npmmirror.com/react-native-pager-view/-/react-native-pager-view-6.0.2.tgz#447b85fcb9f35225c4d6885c18689a7d30c181d9"

部分文件因文件數量過多而無法顯示