-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMendixAppViewController.swift
More file actions
44 lines (37 loc) · 1.33 KB
/
MendixAppViewController.swift
File metadata and controls
44 lines (37 loc) · 1.33 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
import UIKit
import MendixNative
import React_RCTAppDelegate
class MendixAppViewController: UIViewController, ReactNativeDelegate {
override func becomeFirstResponder() -> Bool {
return true
}
override var preferredStatusBarStyle: UIStatusBarStyle {
return .darkContent
}
override func viewDidLoad() {
super.viewDidLoad()
// Set all orientations available while launching the mendix app.
AppDelegate.orientationLock = .all
AppDelegate.delegateInstance()?.window?.overrideUserInterfaceStyle = .unspecified
ReactNative.shared.delegate = self
ReactNative.shared.start()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
_ = becomeFirstResponder()
setNeedsStatusBarAppearanceUpdate()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
// Set orientation to only portrait mode, while exiting the mendix app.
AppDelegate.orientationLock = .portrait
AppDelegate.delegateInstance()?.window?.overrideUserInterfaceStyle = .light
}
func onAppClosed() {
if let appDelegate = AppDelegate.delegateInstance(), appDelegate.previewingSampleApp == true {
appDelegate.previewingSampleApp = false
StorageHelper.clearAll()
}
self.navigationController?.popViewController(animated: true)
}
}