1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-30 10:36:35 +02:00
joplin/packages/app-mobile/ios/Joplin/AppDelegate.mm

98 lines
3.0 KiB
Plaintext
Raw Normal View History

2022-12-27 21:37:15 +02:00
#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
2023-02-19 21:00:17 +02:00
#import <React/RCTLinkingManager.h>
2022-12-27 21:37:15 +02:00
#import <RNCPushNotificationIOS.h>
#import "RNQuickActionManager.h"
@implementation AppDelegate
2023-02-19 21:00:17 +02:00
// ===================================================
// BEGIN Linking support
// ===================================================
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [RCTLinkingManager application:application openURL:url options:options];
}
// ===================================================
// END Linking support
// ===================================================
2022-12-27 21:37:15 +02:00
// ===================================================
// 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
{
2023-06-10 18:02:58 +02:00
self.moduleName = @"Joplin";
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
self.initialProps = @{};
2022-12-27 21:37:15 +02:00
// BEGIN react-native-push-notification-ios
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
// END react-native-push-notification-ios
2023-06-10 18:02:58 +02:00
return [super application:application didFinishLaunchingWithOptions:launchOptions];
2023-01-08 15:39:27 +02:00
}
2022-12-27 21:37:15 +02:00
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
return [self bundleURL];
}
- (NSURL *)bundleURL
2022-12-27 21:37:15 +02:00
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
2023-02-19 21:00:17 +02:00
@end