Files
notesnook/apps/mobile/ios/Notesnook/AppDelegate.m

57 lines
1.7 KiB
Mathematica
Raw Normal View History

2019-11-15 01:17:59 +05:00
#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
2020-10-29 12:23:13 +05:00
#import "RNSplashScreen.h"
2020-11-07 13:15:58 +05:00
#import <React/RCTLinkingManager.h>
2020-11-23 11:25:51 +05:00
#import <MMKV.h>
2020-04-09 13:02:37 +05:00
@implementation AppDelegate
2019-11-15 01:17:59 +05:00
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
2020-11-18 18:16:21 +05:00
2020-04-09 13:02:37 +05:00
2019-11-15 01:17:59 +05:00
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
2020-04-28 18:12:46 +05:00
moduleName:@"Notesnook"
2019-11-15 01:17:59 +05:00
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];
2020-10-29 12:23:13 +05:00
[RNSplashScreen show];
2019-11-15 01:17:59 +05:00
return YES;
}
2020-11-23 11:25:51 +05:00
- (void)applicationWillTerminate:(UIApplication *)application {
2021-01-17 12:52:23 +05:00
MMKV *kv = [MMKV mmkvWithID:@"default" mode:MMKVMultiProcess];
2020-11-23 11:25:51 +05:00
[kv removeValueForKey:@"appState"];
}
2020-11-07 13:15:58 +05:00
2019-11-15 01:17:59 +05:00
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
2020-11-07 13:15:58 +05:00
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [RCTLinkingManager application:application openURL:url options:options];
}
2019-11-15 01:17:59 +05:00
@end