@applicaster/quick-brick-native-apple 5.20.4 → 5.20.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apple/QuickBrickApple.podspec.json +2 -2
- package/apple/ios/Extensions/UIInterfaceOrientationMask+ReactNative.swift +33 -0
- package/apple/ios/ReactNative/QuickBrickViewController.swift +119 -112
- package/apple/ios/ReactNativeEventEmitter.swift +7 -3
- package/apple/ios/ReactNativeOrientation.swift +71 -0
- package/apple/universal/ReactNative/ReactNativeManager.swift +4 -2
- package/package.json +1 -1
- package/apple/ios/Extensions/UIDeviceOrientation+Extension.swift +0 -31
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "QuickBrickApple",
|
|
3
|
-
"version": "5.20.
|
|
3
|
+
"version": "5.20.6",
|
|
4
4
|
"platforms": {
|
|
5
5
|
"ios": "14.0",
|
|
6
6
|
"tvos": "14.0"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"authors": "Applicaster LTD.",
|
|
17
17
|
"source": {
|
|
18
18
|
"git": "https://github.com/applicaster/Zapp-Frameworks.git",
|
|
19
|
-
"tag": "@@applicaster/quick-brick-native-apple/5.20.
|
|
19
|
+
"tag": "@@applicaster/quick-brick-native-apple/5.20.6"
|
|
20
20
|
},
|
|
21
21
|
"requires_arc": true,
|
|
22
22
|
"source_files": "universal/**/*.{m,swift}",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// UIInterfaceOrientationMask+ReactNative.swift
|
|
3
|
+
// QuickBrickApple
|
|
4
|
+
//
|
|
5
|
+
// Created by Anton Kononenko on 10/11/22.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
extension UIInterfaceOrientationMask {
|
|
11
|
+
func toString() -> String {
|
|
12
|
+
switch self {
|
|
13
|
+
case .portrait:
|
|
14
|
+
return "portrait"
|
|
15
|
+
case .landscapeRight:
|
|
16
|
+
return "landscapeRight"
|
|
17
|
+
case .landscapeLeft:
|
|
18
|
+
return "landscapeLeft"
|
|
19
|
+
case .landscape:
|
|
20
|
+
return "landscape"
|
|
21
|
+
case .portraitUpsideDown:
|
|
22
|
+
return "portraitUpsideDown"
|
|
23
|
+
case .portrait:
|
|
24
|
+
return "portrait"
|
|
25
|
+
case .all:
|
|
26
|
+
return "all"
|
|
27
|
+
case .allButUpsideDown:
|
|
28
|
+
return "allButUpsideDown"
|
|
29
|
+
default:
|
|
30
|
+
return "all"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -17,7 +17,6 @@ class QuickBrickViewController: UIViewController, UILayerViewControllerProtocol
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
lazy var logger = Logger.getLogger(for: QuickBrickViewControllerLogs.subsystem)
|
|
20
|
-
var currentOrientation = UIDevice.current.orientation
|
|
21
20
|
|
|
22
21
|
var orientationStack = [UIInterfaceOrientationMask.all]
|
|
23
22
|
var orientationMask: UIInterfaceOrientationMask = QuickBrickViewController.initialOrientationMask
|
|
@@ -26,6 +25,10 @@ class QuickBrickViewController: UIViewController, UILayerViewControllerProtocol
|
|
|
26
25
|
orientationMask
|
|
27
26
|
}
|
|
28
27
|
|
|
28
|
+
override var prefersHomeIndicatorAutoHidden: Bool {
|
|
29
|
+
homeIndicatorAutoHidden
|
|
30
|
+
}
|
|
31
|
+
|
|
29
32
|
override public var shouldAutorotate: Bool {
|
|
30
33
|
true
|
|
31
34
|
}
|
|
@@ -47,146 +50,150 @@ class QuickBrickViewController: UIViewController, UILayerViewControllerProtocol
|
|
|
47
50
|
else {
|
|
48
51
|
return false
|
|
49
52
|
}
|
|
53
|
+
|
|
50
54
|
return value.boolValue
|
|
51
55
|
}
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
var currentInterfaceOrientation: UIInterfaceOrientation = .unknown
|
|
58
|
+
func getUIOrientation() -> UIInterfaceOrientation {
|
|
59
|
+
guard let interfaceOrientation = UIApplication.shared.windows.first?.windowScene?.interfaceOrientation else {
|
|
60
|
+
return .unknown
|
|
61
|
+
}
|
|
62
|
+
return interfaceOrientation
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
var currentDeviceOrientation: UIDeviceOrientation = .unknown
|
|
66
|
+
func getDeviceOrientation() -> UIDeviceOrientation {
|
|
67
|
+
UIDevice.current.orientation
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public func allowOrientationForScreen(_ orientation: ReactNativeOrientation) {
|
|
71
|
+
orientationMask = orientation.toInterfaceOrientationMask()
|
|
72
|
+
// TODO: Remove orientation stack
|
|
67
73
|
orientationStack.append(orientationMask)
|
|
68
|
-
|
|
74
|
+
forceOrientationWithMaskIfNeeded(orientationMask)
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
/// Release Orientation for specific screen to previous state
|
|
72
78
|
public func releaseOrientationForScreen() {
|
|
73
79
|
if orientationStack.count > 1 {
|
|
74
80
|
_ = orientationStack.dropLast()
|
|
75
|
-
|
|
81
|
+
forceOrientationWithMaskIfNeeded(orientationStack.last ?? UIInterfaceOrientationMask.all)
|
|
76
82
|
}
|
|
77
83
|
}
|
|
78
84
|
|
|
79
|
-
override func viewWillTransition(to
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
override func viewWillTransition(to size: CGSize,
|
|
86
|
+
with coordinator: UIViewControllerTransitionCoordinator) {
|
|
87
|
+
super.viewWillTransition(to: size, with: coordinator)
|
|
88
|
+
let isLandscape = size.width > size.height
|
|
89
|
+
let interfaceOrientation = isLandscape ?
|
|
90
|
+
UIInterfaceOrientation.landscapeLeft :
|
|
91
|
+
UIInterfaceOrientation.portrait
|
|
92
|
+
|
|
93
|
+
let reactNativeToOrientation = ReactNativeOrientation.fromInterfaceOrientation(orientation: interfaceOrientation)
|
|
94
|
+
let reactNativefromOrientation = ReactNativeOrientation.fromInterfaceOrientation(orientation: currentInterfaceOrientation)
|
|
95
|
+
currentInterfaceOrientation = interfaceOrientation
|
|
96
|
+
|
|
97
|
+
ReactNativeEventEmitter.orientationChange(toOrientation: reactNativeToOrientation,
|
|
98
|
+
fromOrientation: reactNativefromOrientation)
|
|
99
|
+
|
|
100
|
+
logger?.debugLog(message: "viewWillTransition: interface orientation was changed to: \(interfaceOrientation.toString())",
|
|
101
|
+
category: QuickBrickViewControllerLogs.forceOrientation.category)
|
|
82
102
|
}
|
|
83
103
|
|
|
84
104
|
override func viewWillAppear(_ animated: Bool) {
|
|
85
105
|
super.viewWillAppear(animated)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return UIInterfaceOrientationMask.landscapeLeft
|
|
106
|
-
case JS_LANDSCAPE_SENSOR:
|
|
107
|
-
return UIInterfaceOrientationMask.landscape
|
|
108
|
-
case JS_PORTAIT_REVERSED:
|
|
109
|
-
return UIInterfaceOrientationMask.portraitUpsideDown
|
|
110
|
-
case JS_PORTAIT_SENSOR:
|
|
111
|
-
return UIInterfaceOrientationMask.portrait
|
|
112
|
-
case JS_FULL_SENSOR:
|
|
113
|
-
return UIInterfaceOrientationMask.all
|
|
114
|
-
case JS_SENSOR:
|
|
115
|
-
return UIInterfaceOrientationMask.allButUpsideDown
|
|
116
|
-
default:
|
|
117
|
-
return UIInterfaceOrientationMask.all
|
|
106
|
+
UIDevice.current.beginGeneratingDeviceOrientationNotifications()
|
|
107
|
+
NotificationCenter.default.addObserver(self,
|
|
108
|
+
selector: #selector(deviceDidRotate(notification:)),
|
|
109
|
+
name: UIDevice.orientationDidChangeNotification,
|
|
110
|
+
object: nil)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
override func viewDidAppear(_ animated: Bool) {
|
|
114
|
+
super.viewDidAppear(animated)
|
|
115
|
+
// Initial device orientation
|
|
116
|
+
currentDeviceOrientation = getDeviceOrientation()
|
|
117
|
+
currentInterfaceOrientation = getUIOrientation()
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
override func viewWillDisappear(_ animated: Bool) {
|
|
121
|
+
super.viewWillDisappear(animated)
|
|
122
|
+
NotificationCenter.default.removeObserver(self)
|
|
123
|
+
if UIDevice.current.isGeneratingDeviceOrientationNotifications {
|
|
124
|
+
UIDevice.current.endGeneratingDeviceOrientationNotifications()
|
|
118
125
|
}
|
|
119
126
|
}
|
|
120
127
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return
|
|
129
|
-
case UIInterfaceOrientationMask.landscapeLeft:
|
|
130
|
-
return UIInterfaceOrientation.landscapeLeft
|
|
131
|
-
case UIInterfaceOrientationMask.all:
|
|
132
|
-
return UIInterfaceOrientation.portrait
|
|
133
|
-
case UIInterfaceOrientationMask.allButUpsideDown:
|
|
134
|
-
return UIInterfaceOrientation.portrait
|
|
135
|
-
case UIInterfaceOrientationMask.portraitUpsideDown:
|
|
136
|
-
return UIInterfaceOrientation.portraitUpsideDown
|
|
137
|
-
default:
|
|
138
|
-
return UIInterfaceOrientation.portrait
|
|
128
|
+
@objc func deviceDidRotate(notification _: NSNotification) {
|
|
129
|
+
let deviceOrientation = getDeviceOrientation()
|
|
130
|
+
|
|
131
|
+
// In this cases we does not want to send notifications
|
|
132
|
+
if deviceOrientation == .unknown ||
|
|
133
|
+
deviceOrientation == .faceDown ||
|
|
134
|
+
deviceOrientation == .faceUp {
|
|
135
|
+
return
|
|
139
136
|
}
|
|
137
|
+
|
|
138
|
+
let reactNativeToOrientation = ReactNativeOrientation.fromDeviceOrientation(orientation: deviceOrientation)
|
|
139
|
+
let reactNativeFromOrientation = ReactNativeOrientation.fromDeviceOrientation(orientation: currentDeviceOrientation)
|
|
140
|
+
currentDeviceOrientation = deviceOrientation
|
|
141
|
+
|
|
142
|
+
ReactNativeEventEmitter.orientationChange(toOrientation: reactNativeToOrientation,
|
|
143
|
+
fromOrientation: reactNativeFromOrientation,
|
|
144
|
+
physicalChange: true)
|
|
145
|
+
|
|
146
|
+
logger?.debugLog(message: "deviceDidRotate: device oritation changed to: \(deviceOrientation.toString())",
|
|
147
|
+
category: QuickBrickViewControllerLogs.forceOrientation.category)
|
|
140
148
|
}
|
|
141
149
|
|
|
142
|
-
private func
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
if statusBarOrientation == UIInterfaceOrientation.landscapeLeft {
|
|
152
|
-
forceOrientation(UIInterfaceOrientation.landscapeLeft)
|
|
153
|
-
} else {
|
|
154
|
-
forceOrientation(UIInterfaceOrientation.landscapeRight)
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
case UIInterfaceOrientationMask.landscapeRight:
|
|
158
|
-
if UIDevice.current.orientation.rawValue != UIInterfaceOrientation.landscapeRight.rawValue {
|
|
159
|
-
forceOrientation(UIInterfaceOrientation.landscapeRight)
|
|
160
|
-
}
|
|
161
|
-
case UIInterfaceOrientationMask.landscapeLeft:
|
|
162
|
-
if UIDevice.current.orientation.rawValue != UIInterfaceOrientation.landscapeLeft.rawValue {
|
|
163
|
-
forceOrientation(UIInterfaceOrientation.landscapeLeft)
|
|
164
|
-
}
|
|
165
|
-
case UIInterfaceOrientationMask.all:
|
|
166
|
-
break
|
|
167
|
-
case UIInterfaceOrientationMask.allButUpsideDown:
|
|
168
|
-
if !UIDevice.current.orientation.isLandscape, UIDevice.current.orientation.rawValue != UIInterfaceOrientation.portrait.rawValue {
|
|
169
|
-
forceOrientation(UIInterfaceOrientation.portrait)
|
|
170
|
-
}
|
|
171
|
-
case UIInterfaceOrientationMask.portraitUpsideDown:
|
|
172
|
-
if UIDevice.current.orientation.rawValue != UIInterfaceOrientation.portraitUpsideDown.rawValue {
|
|
173
|
-
forceOrientation(UIInterfaceOrientation.portraitUpsideDown)
|
|
174
|
-
}
|
|
175
|
-
default:
|
|
176
|
-
break
|
|
150
|
+
private func forceOrientationWithMaskIfNeeded(_ orientationMask: UIInterfaceOrientationMask) {
|
|
151
|
+
if #available(iOS 16.0, *) {
|
|
152
|
+
logger?.debugLog(message: "\(QuickBrickViewControllerLogs.forceOrientation.message) UI orientation to: \(orientationMask.toString())",
|
|
153
|
+
category: QuickBrickViewControllerLogs.forceOrientation.category)
|
|
154
|
+
|
|
155
|
+
let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene
|
|
156
|
+
windowScene?.requestGeometryUpdate(.iOS(interfaceOrientations: orientationMask))
|
|
157
|
+
UIViewController.attemptRotationToDeviceOrientation()
|
|
158
|
+
return
|
|
177
159
|
}
|
|
160
|
+
|
|
161
|
+
if isSupportOrientation(mask: orientationMask,
|
|
162
|
+
interfaceOrientation: currentInterfaceOrientation) {
|
|
163
|
+
return
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
logger?.debugLog(message: "\(QuickBrickViewControllerLogs.forceOrientation.message) UI orientation to: \(orientationMask.toString())",
|
|
167
|
+
category: QuickBrickViewControllerLogs.forceOrientation.category)
|
|
168
|
+
|
|
169
|
+
changeOrienation(orientationMask: orientationMask)
|
|
178
170
|
}
|
|
179
171
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
172
|
+
func changeOrienation(orientationMask: UIInterfaceOrientationMask) {
|
|
173
|
+
func setDeviceOrientation(_ orientaion: UIDeviceOrientation) {
|
|
174
|
+
UIDevice.current.setValue(orientaion.rawValue,
|
|
175
|
+
forKey: "orientation")
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if orientationMask == .landscapeRight {
|
|
179
|
+
setDeviceOrientation(UIDeviceOrientation.landscapeLeft)
|
|
180
|
+
} else if orientationMask == .landscapeLeft {
|
|
181
|
+
setDeviceOrientation(UIDeviceOrientation.landscapeRight)
|
|
182
|
+
} else if orientationMask == .landscape {
|
|
183
|
+
if currentDeviceOrientation == .landscapeLeft || currentDeviceOrientation == .landscapeRight {
|
|
184
|
+
setDeviceOrientation(currentDeviceOrientation)
|
|
185
|
+
} else {
|
|
186
|
+
setDeviceOrientation(UIDeviceOrientation.landscapeRight)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
} else if orientationMask == .portrait {
|
|
190
|
+
setDeviceOrientation(UIDeviceOrientation.portrait)
|
|
191
|
+
}
|
|
184
192
|
|
|
185
|
-
UIDevice.current.setValue(orientation.rawValue, forKey: "orientation")
|
|
186
193
|
UIViewController.attemptRotationToDeviceOrientation()
|
|
187
194
|
}
|
|
188
195
|
|
|
189
|
-
|
|
190
|
-
|
|
196
|
+
func isSupportOrientation(mask: UIInterfaceOrientationMask, interfaceOrientation: UIInterfaceOrientation) -> Bool {
|
|
197
|
+
(mask.rawValue & (1 << interfaceOrientation.rawValue)) != 0
|
|
191
198
|
}
|
|
192
199
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// ReactNativeEventEmitter.swift
|
|
3
3
|
// QuickBrickApple
|
|
4
4
|
//
|
|
5
|
-
// Created by
|
|
5
|
+
// Created by Anton Kononenko on 10/11/2022.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import Foundation
|
|
@@ -12,9 +12,13 @@ import React
|
|
|
12
12
|
open class ReactNativeEventEmitter: RCTEventEmitter {
|
|
13
13
|
public static var emitter: RCTEventEmitter!
|
|
14
14
|
|
|
15
|
-
public static func orientationChange(toOrientation:
|
|
15
|
+
public static func orientationChange(toOrientation: ReactNativeOrientation,
|
|
16
|
+
fromOrientation: ReactNativeOrientation,
|
|
17
|
+
physicalChange: Bool = false) {
|
|
16
18
|
if toOrientation.rawValue > 0 {
|
|
17
|
-
emitter
|
|
19
|
+
emitter?.sendEvent(withName: "orientationChange", body: ["toOrientation": toOrientation.rawValue,
|
|
20
|
+
"fromOrientation": fromOrientation.rawValue,
|
|
21
|
+
"physicalChange": physicalChange])
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
24
|
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ReactNativeOrientation.swift
|
|
3
|
+
// QuickBrickApple
|
|
4
|
+
//
|
|
5
|
+
// Created by Anna Bauza on 03/02/2020.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
import ZappCore
|
|
10
|
+
|
|
11
|
+
public enum ReactNativeOrientation: Int {
|
|
12
|
+
case unknown = 0
|
|
13
|
+
case portrait = 1
|
|
14
|
+
case landscapeRight = 2
|
|
15
|
+
case landscapeLeft = 4
|
|
16
|
+
case portraitUpsideDown = 8
|
|
17
|
+
case landscape = 6
|
|
18
|
+
case all = 15
|
|
19
|
+
case allButUpsideDown = 7
|
|
20
|
+
|
|
21
|
+
static func fromInterfaceOrientation(orientation: UIInterfaceOrientation) -> ReactNativeOrientation {
|
|
22
|
+
switch orientation {
|
|
23
|
+
case .portrait:
|
|
24
|
+
return .portrait
|
|
25
|
+
case .landscapeLeft:
|
|
26
|
+
return .landscapeLeft
|
|
27
|
+
case .landscapeRight:
|
|
28
|
+
return .landscapeRight
|
|
29
|
+
case .portraitUpsideDown:
|
|
30
|
+
return .portraitUpsideDown
|
|
31
|
+
default:
|
|
32
|
+
return .unknown
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static func fromDeviceOrientation(orientation: UIDeviceOrientation) -> ReactNativeOrientation {
|
|
37
|
+
switch orientation {
|
|
38
|
+
case .portrait:
|
|
39
|
+
return .portrait
|
|
40
|
+
case .landscapeLeft:
|
|
41
|
+
return .landscapeRight
|
|
42
|
+
case .landscapeRight:
|
|
43
|
+
return .landscapeLeft
|
|
44
|
+
case .portraitUpsideDown:
|
|
45
|
+
return .portraitUpsideDown
|
|
46
|
+
default:
|
|
47
|
+
return .unknown
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
func toInterfaceOrientationMask() -> UIInterfaceOrientationMask {
|
|
52
|
+
switch self {
|
|
53
|
+
case .portrait:
|
|
54
|
+
return .portrait
|
|
55
|
+
case .landscapeLeft:
|
|
56
|
+
return .landscapeLeft
|
|
57
|
+
case .landscapeRight:
|
|
58
|
+
return .landscapeRight
|
|
59
|
+
case .landscape:
|
|
60
|
+
return .landscape
|
|
61
|
+
case .portraitUpsideDown:
|
|
62
|
+
return .portraitUpsideDown
|
|
63
|
+
case .all:
|
|
64
|
+
return .all
|
|
65
|
+
case .allButUpsideDown:
|
|
66
|
+
return .allButUpsideDown
|
|
67
|
+
default:
|
|
68
|
+
return .portrait
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -200,8 +200,10 @@ extension ReactNativeManager: QuickBrickManagerDelegate {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
public func allowOrientationForScreen(_ payload: [String: Any]) {
|
|
203
|
-
if let qbViewController = reactNativeViewController() as? QuickBrickViewController,
|
|
204
|
-
|
|
203
|
+
if let qbViewController = reactNativeViewController() as? QuickBrickViewController,
|
|
204
|
+
let orientation = payload["orientation"] as? Int,
|
|
205
|
+
let reactNativeOrientation = ReactNativeOrientation(rawValue: orientation) {
|
|
206
|
+
qbViewController.allowOrientationForScreen(reactNativeOrientation)
|
|
205
207
|
}
|
|
206
208
|
}
|
|
207
209
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-native-apple",
|
|
3
|
-
"version": "5.20.
|
|
3
|
+
"version": "5.20.6",
|
|
4
4
|
"description": "iOS and tvOS native code for QuickBrick applications. This package is used to provide native logic for QuickBrick",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// UIDeviceOrientation+Extension.swift
|
|
3
|
-
// QuickBrickApple
|
|
4
|
-
//
|
|
5
|
-
// Created by Anton Kononenko on 8/30/21.
|
|
6
|
-
// Copyright © 2021 Anton Kononenko. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
import Foundation
|
|
10
|
-
import React
|
|
11
|
-
|
|
12
|
-
extension UIDeviceOrientation {
|
|
13
|
-
func mapOrientation() -> Int {
|
|
14
|
-
var orientation = 0
|
|
15
|
-
|
|
16
|
-
switch self {
|
|
17
|
-
case .portrait:
|
|
18
|
-
orientation = 1
|
|
19
|
-
case .landscapeRight:
|
|
20
|
-
orientation = 2
|
|
21
|
-
case .landscapeLeft:
|
|
22
|
-
orientation = 4
|
|
23
|
-
case .portraitUpsideDown:
|
|
24
|
-
orientation = 8
|
|
25
|
-
default:
|
|
26
|
-
orientation = 0
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return orientation
|
|
30
|
-
}
|
|
31
|
-
}
|