mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-18 09:35:20 +02:00
116 lines
4.2 KiB
Objective-C
116 lines
4.2 KiB
Objective-C
#import "AppDelegate.h"
|
|
|
|
#import <React/RCTBridge.h>
|
|
#import <React/RCTBundleURLProvider.h>
|
|
#import <React/RCTRootView.h>
|
|
#import <React/RCTLinkingManager.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];
|
|
|
|
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];
|
|
|
|
// 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
|
|
}
|
|
|
|
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
|
|
return [RCTLinkingManager application:app openURL:url options:options];
|
|
}
|
|
|
|
@end
|