leon il y a 1 an
Parent
commit
bdc7401b6e

+ 15 - 0
ios/AppDelegate.mm

@@ -79,9 +79,24 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
   self.window.rootViewController = rootViewController;
   [self.window makeKeyAndVisible];
   [super application:application didFinishLaunchingWithOptions:launchOptions];
+  
+  [self registerForPushNotifications];
   return YES;
 }
 
+- (void)registerForPushNotifications {
+    UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
+    [center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error) {
+        if (granted) {
+            dispatch_async(dispatch_get_main_queue(), ^{
+                [[UIApplication sharedApplication] registerForRemoteNotifications];
+            });
+        } else {
+            // 用户拒绝通知或发生错误
+        }
+    }];
+}
+
 /// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
 ///
 /// @see: https://reactjs.org/blog/2022/03/29/react-v18.html

+ 2 - 0
src/features/trackTimeDuration/components/TimelineFastSleep.tsx

@@ -220,6 +220,8 @@ export default function TimelineFastSleep(props: {
             }
         }
 
+        debugger
+
         timelineItems.push(
             {
                 status: status,

+ 1 - 0
src/services/http/request.ts

@@ -66,6 +66,7 @@ export async function request<T>(param: RequestParam): Promise<T> {
 
         var split = new Date().toString().split(' ');
         var timeZoneFormatted = split[split.length - 2];
+        console.log(split,timeZoneFormatted);
         // var timeZoneLocation = Intl.DateTimeFormat().resolvedOptions().timeZone
 
         header['content-type'] = 'application/json'