- /**
- * Copyright (c) 2015-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- #import "AppDelegate.h"
- #import <UserNotifications/UserNotifications.h>
- #import <React/RCTBundleURLProvider.h>
- #import <React/RCTRootView.h>
- #import "RNSplashScreen.h"
- #if RCT_DEV
- #import <React/RCTDevLoadingView.h>
- #endif
- #import <React/RCTLinkingManager.h>
- #import <RNCPushNotificationIOS.h>
- #import "SDImageCodersManager.h"
- #import <SDWebImageWebPCoder/SDImageWebPCoder.h>
- @implementation AppDelegate
- - (BOOL)application:(UIApplication *)application
- openURL:(NSURL *)url
- options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
- {
- return [RCTLinkingManager application:application openURL:url options:options];
- }
- - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler {
- return [RCTLinkingManager application:application
- continueUserActivity:userActivity
- restorationHandler:restorationHandler];
- }
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- {
- // [IAPPromotionObserver startObserving];
- // [FIRApp configure];
- NSURL *jsCodeLocation;
- for (NSString* family in [UIFont familyNames])
- {
- NSLog(@"%@", family);
- for (NSString* name in [UIFont fontNamesForFamilyName: family])
- {
- NSLog(@" %@", name);
- }
- }
- [SDImageCodersManager.sharedManager addCoder:SDImageWebPCoder.sharedCoder];
- jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios"];
- RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self
- launchOptions:launchOptions];
- RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
- moduleName:@"MyApp"
- initialProperties:${}];
- if (@available(iOS 13.0, *)) {
- rootView.backgroundColor = [UIColor systemBackgroundColor];
- } else {
- rootView.backgroundColor = [UIColor whiteColor];
- }
- self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
- UIViewController *rootViewController = [UIViewController new];
- rootViewController.view = rootView;
- self.window.rootViewController = rootViewController;
- [self.window makeKeyAndVisible];
- [RNSplashScreen show];
- UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
- center.delegate = self;
- return YES;
- }
- // Required to register for notifications
- - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
- {
- [RNCPushNotificationIOS didRegisterUserNotificationSettings:notificationSettings];
- }
- // Required for the register event.
- - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
- {
- [RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
- }
- // Required for the notification event. You must call the completion handler after handling the remote notification.
- - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
- fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
- {
- [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
- }
- // Required for the registrationError event.
- - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
- {
- [RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error];
- }
- // Required for the localNotification event.
- - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
- {
- [RNCPushNotificationIOS didReceiveLocalNotification:notification];
- }
- //Called when a notification is delivered to a foreground app.
- -(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
- {
- NSLog(@"User Info : %@",notification.request.content.userInfo);
- completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge);
- }
- @end
[text] AppDetegate.m
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new:
File Description
- AppDetegate.m
- Paste Code
- 01 Oct-2022
- 4.59 Kb
You can Share it: