summaryrefslogtreecommitdiff
path: root/ios/iHealthScanner/AppDelegate.swift
diff options
context:
space:
mode:
authorhc <haocheng.xie@respiree.com>2026-04-10 17:39:12 +0800
committerhc <haocheng.xie@respiree.com>2026-04-10 17:39:22 +0800
commite4fb9966e762852bf17f21c8406501d42fae0b61 (patch)
tree658bbdba977ff7846a17ee94b8ed6b676f6ce9dd /ios/iHealthScanner/AppDelegate.swift
Initial commit: iHealth BLE scanner app with patched SDK v1.5.0
Diffstat (limited to 'ios/iHealthScanner/AppDelegate.swift')
-rw-r--r--ios/iHealthScanner/AppDelegate.swift48
1 files changed, 48 insertions, 0 deletions
diff --git a/ios/iHealthScanner/AppDelegate.swift b/ios/iHealthScanner/AppDelegate.swift
new file mode 100644
index 0000000..b27dd5a
--- /dev/null
+++ b/ios/iHealthScanner/AppDelegate.swift
@@ -0,0 +1,48 @@
1import UIKit
2import React
3import React_RCTAppDelegate
4import ReactAppDependencyProvider
5
6@main
7class AppDelegate: UIResponder, UIApplicationDelegate {
8 var window: UIWindow?
9
10 var reactNativeDelegate: ReactNativeDelegate?
11 var reactNativeFactory: RCTReactNativeFactory?
12
13 func application(
14 _ application: UIApplication,
15 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
16 ) -> Bool {
17 let delegate = ReactNativeDelegate()
18 let factory = RCTReactNativeFactory(delegate: delegate)
19 delegate.dependencyProvider = RCTAppDependencyProvider()
20
21 reactNativeDelegate = delegate
22 reactNativeFactory = factory
23
24 window = UIWindow(frame: UIScreen.main.bounds)
25
26 factory.startReactNative(
27 withModuleName: "iHealthScanner",
28 in: window,
29 launchOptions: launchOptions
30 )
31
32 return true
33 }
34}
35
36class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
37 override func sourceURL(for bridge: RCTBridge) -> URL? {
38 self.bundleURL()
39 }
40
41 override func bundleURL() -> URL? {
42#if DEBUG
43 RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
44#else
45 Bundle.main.url(forResource: "main", withExtension: "jsbundle")
46#endif
47 }
48}