-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAppDelegate.swift
More file actions
56 lines (47 loc) · 1.82 KB
/
Copy pathAppDelegate.swift
File metadata and controls
56 lines (47 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import UIKit
import React
import MendixNative
@main
class AppDelegate: ReactAppProvider {
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
SessionCookieStore.restore()
setUpProvider()
guard let bundleUrl = bundleURL() else {
let message = "No script URL provided. Make sure the metro packager is running or you have embedded a JS bundle in your application bundle."
NativeErrorHandler().handle(message: message, stackTrace: [])
return false
}
ReactNative.shared.setup(
MendixApp.init(
identifier: nil,
bundleUrl: bundleUrl,
runtimeUrl: URL(string: "http://localhost:8081")!,
warningsFilter: .none,
isDeveloperApp: false,
clearDataAtLaunch: false,
splashScreenPresenter: nil,
reactLoading: nil,
enableThreeFingerGestures: false
),
launchOptions: launchOptions
)
ReactNative.shared.start()
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
func applicationDidEnterBackground(_ application: UIApplication) {
SessionCookieStore.persist()
}
func applicationWillTerminate(_ application: UIApplication) {
SessionCookieStore.persist()
}
override func sourceURL(for bridge: RCTBridge) -> URL? {
self.bundleURL()
}
override func bundleURL() -> URL? {
#if DEBUG
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
}
}