Skip to content

Commit e061ba0

Browse files
YogendraShelkevadymv-mendix
authored andcommitted
fix: ios build
1 parent 3f38138 commit e061ba0

3 files changed

Lines changed: 13 additions & 14 deletions

File tree

ios/DeveloperApp/AppDelegate.swift

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,16 @@ class AppDelegate: ReactAppProvider {
1515

1616
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
1717
SessionCookieStore.restore() //iOS does not persist session cookies across app restarts, this helps persisting session cookies to match behaviour with Android
18-
super.setUpProvider()
19-
super.application(application, didFinishLaunchingWithOptions: launchOptions)
18+
setUpProvider(dependencyProvider: RCTAppDependencyProvider())
2019
clearKeychainIfNecessary()
2120
setUpDevice()
2221
setUpGoogleMaps()
2322
setUpPushNotifications(application)
2423
updateRootViewController(showOnboarding() ? .launchTutorial : .openApp)
25-
return true
24+
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
2625
}
2726

28-
override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
27+
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
2928
RCTLinkingManager.application(app, open: url, options: options)
3029
guard let appUrl = AppPreferences.appUrl, !appUrl.isEmpty, !ReactAppProvider.isReactAppActive() else {
3130
return true
@@ -37,11 +36,11 @@ class AppDelegate: ReactAppProvider {
3736
return true
3837
}
3938

40-
override func applicationDidEnterBackground(_ application: UIApplication) {
39+
func applicationDidEnterBackground(_ application: UIApplication) {
4140
SessionCookieStore.persist() //iOS does not persist session cookies across app restarts, this helps persisting session cookies to match behaviour with Android
4241
}
4342

44-
override func applicationWillTerminate(_ application: UIApplication) {
43+
func applicationWillTerminate(_ application: UIApplication) {
4544
SessionCookieStore.persist() //iOS does not persist session cookies across app restarts, this helps persisting session cookies to match behaviour with Android
4645
}
4746

@@ -60,7 +59,7 @@ extension AppDelegate {
6059

6160
static var orientationLock = UIInterfaceOrientationMask.portrait // By default lock orientation only portrait mode.
6261

63-
override func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
62+
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
6463
return AppDelegate.orientationLock
6564
}
6665

@@ -74,9 +73,9 @@ extension AppDelegate {
7473
extension AppDelegate {
7574
private func updateRootViewController(_ storyboard: UIStoryboard) {
7675
window = MendixReactWindow(frame: UIScreen.main.bounds)
77-
window.rootViewController = storyboard.instantiateInitialViewController()
78-
window.makeKeyAndVisible()
79-
window.overrideUserInterfaceStyle = .light // Force Light Mode
76+
window?.rootViewController = storyboard.instantiateInitialViewController()
77+
window?.makeKeyAndVisible()
78+
window?.overrideUserInterfaceStyle = .light // Force Light Mode
8079
IQKeyboardManager.shared().isEnabled = false
8180
}
8281

@@ -154,7 +153,7 @@ extension AppDelegate: UNUserNotificationCenterDelegate, MessagingDelegate {
154153
}
155154

156155
#if DEBUG
157-
override func application(_ application: UIApplication,
156+
func application(_ application: UIApplication,
158157
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
159158
print("APNs token retrieved: \(deviceToken)")
160159
Messaging.messaging().apnsToken = deviceToken

ios/DeveloperApp/MendixApp/MendixAppViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class MendixAppViewController: UIViewController, ReactNativeDelegate {
1616

1717
// Set all orientations available while launching the mendix app.
1818
AppDelegate.orientationLock = .all
19-
AppDelegate.delegateInstance()?.window.overrideUserInterfaceStyle = .unspecified
19+
AppDelegate.delegateInstance()?.window?.overrideUserInterfaceStyle = .unspecified
2020
ReactNative.shared.delegate = self
2121
ReactNative.shared.start()
2222
}
@@ -31,7 +31,7 @@ class MendixAppViewController: UIViewController, ReactNativeDelegate {
3131
super.viewDidDisappear(animated)
3232
// Set orientation to only portrait mode, while exiting the mendix app.
3333
AppDelegate.orientationLock = .portrait
34-
AppDelegate.delegateInstance()?.window.overrideUserInterfaceStyle = .light
34+
AppDelegate.delegateInstance()?.window?.overrideUserInterfaceStyle = .light
3535
}
3636

3737
func onAppClosed() {

ios/DeveloperApp/OpenApp/TabViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class TabViewController: UITabBarController {
1717

1818
func setSelectedIndex(index:Int){
1919
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate,
20-
let tabBarController = appDelegate.window.rootViewController as? UITabBarController else {
20+
let tabBarController = appDelegate.window?.rootViewController as? UITabBarController else {
2121
return
2222
}
2323
tabBarController.selectedIndex = index

0 commit comments

Comments
 (0)