mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-15 09:04:04 +02:00
107 lines
3.9 KiB
Objective-C
107 lines
3.9 KiB
Objective-C
#import "AppDelegate.h"
|
|
|
|
#import <React/RCTBridge.h>
|
|
#import <React/RCTBundleURLProvider.h>
|
|
#import <React/RCTRootView.h>
|
|
#import <UserNotifications/UserNotifications.h>
|
|
#import <RNCPushNotificationIOS.h>
|
|
#import "RNQuickActionManager.h"
|
|
|
|
#ifdef FB_SONARKIT_ENABLED
|
|
#import <FlipperKit/FlipperClient.h>
|
|
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
|
|
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
|
|
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
|
|
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
|
|
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
|
|
|
|
static void InitializeFlipper(UIApplication *application) {
|
|
FlipperClient *client = [FlipperClient sharedClient];
|
|
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
|
|
[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
|
|
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
|
|
[client addPlugin:[FlipperKitReactPlugin new]];
|
|
[client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
|
|
[client start];
|
|
}
|
|
#endif
|
|
|
|
@implementation AppDelegate
|
|
|
|
// ===================================================
|
|
// BEGIN react-native-quick-actions
|
|
// ===================================================
|
|
- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL succeeded)) completionHandler {
|
|
[RNQuickActionManager onQuickActionPress:shortcutItem completionHandler:completionHandler];
|
|
}
|
|
// ===================================================
|
|
// END react-native-quick-actions
|
|
// ===================================================
|
|
|
|
|
|
|
|
|
|
// ===================================================
|
|
// BEGIN react-native-push-notification-ios
|
|
// ===================================================
|
|
|
|
// IOS 10+ Required for localNotification event
|
|
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
|
|
didReceiveNotificationResponse:(UNNotificationResponse *)response
|
|
withCompletionHandler:(void (^)(void))completionHandler
|
|
{
|
|
[RNCPushNotificationIOS didReceiveNotificationResponse:response];
|
|
completionHandler();
|
|
}
|
|
// IOS 4-10 Required for the localNotification event.
|
|
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
|
|
{
|
|
[RNCPushNotificationIOS didReceiveLocalNotification:notification];
|
|
}
|
|
|
|
// ===================================================
|
|
// END react-native-push-notification-ios
|
|
// ===================================================
|
|
|
|
|
|
|
|
|
|
|
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
{
|
|
#ifdef FB_SONARKIT_ENABLED
|
|
InitializeFlipper(application);
|
|
#endif
|
|
|
|
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
|
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
|
|
moduleName:@"Joplin"
|
|
initialProperties:nil];
|
|
|
|
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
|
|
|
|
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
UIViewController *rootViewController = [UIViewController new];
|
|
rootViewController.view = rootView;
|
|
self.window.rootViewController = rootViewController;
|
|
[self.window makeKeyAndVisible];
|
|
|
|
// BEGIN react-native-push-notification-ios
|
|
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
|
|
center.delegate = self;
|
|
// END react-native-push-notification-ios
|
|
|
|
return YES;
|
|
}
|
|
|
|
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
|
|
{
|
|
#if DEBUG
|
|
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
|
|
#else
|
|
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
|
|
#endif
|
|
}
|
|
|
|
@end
|