expo-screen-orientation 8.0.1 → 8.0.2
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/CHANGELOG.md +7 -0
- package/android/build.gradle +2 -2
- package/ios/ScreenOrientationRegistry.swift +27 -16
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 8.0.2 — 2024-12-19
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- [iOS] Fixed crash when multiple threads access same member in swift ([#33572](https://github.com/expo/expo/pull/33572) by [@chrfalch](https://github.com/chrfalch))
|
|
18
|
+
- Fixed event listeners on web. ([#33361](https://github.com/expo/expo/pull/33361) by [@aleqsio](https://github.com/aleqsio))
|
|
19
|
+
|
|
13
20
|
## 8.0.1 — 2024-12-05
|
|
14
21
|
|
|
15
22
|
### 🐛 Bug fixes
|
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
2
|
|
|
3
3
|
group = 'host.exp.exponent'
|
|
4
|
-
version = '8.0.
|
|
4
|
+
version = '8.0.2'
|
|
5
5
|
|
|
6
6
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
7
|
apply from: expoModulesCorePlugin
|
|
@@ -14,6 +14,6 @@ android {
|
|
|
14
14
|
namespace "expo.modules.screenorientation"
|
|
15
15
|
defaultConfig {
|
|
16
16
|
versionCode 7
|
|
17
|
-
versionName '8.0.
|
|
17
|
+
versionName '8.0.2'
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -17,6 +17,7 @@ public class ScreenOrientationRegistry: NSObject, UIApplicationDelegate {
|
|
|
17
17
|
public var currentScreenOrientation: UIInterfaceOrientation
|
|
18
18
|
var orientationControllers: [ScreenOrientationController] = []
|
|
19
19
|
var controllerInterfaceMasks: [ObjectIdentifier: UIInterfaceOrientationMask] = [:]
|
|
20
|
+
private let queue = DispatchQueue(label: "expo.screenorientationregistry", attributes: .concurrent)
|
|
20
21
|
@objc
|
|
21
22
|
public var currentTraitCollection: UITraitCollection?
|
|
22
23
|
var lastOrientationMask: UIInterfaceOrientationMask
|
|
@@ -110,7 +111,9 @@ public class ScreenOrientationRegistry: NSObject, UIApplicationDelegate {
|
|
|
110
111
|
public func setMask(_ mask: UIInterfaceOrientationMask, forController controller: any ScreenOrientationController) {
|
|
111
112
|
let controllerIdentifier = ObjectIdentifier(controller)
|
|
112
113
|
|
|
113
|
-
|
|
114
|
+
queue.async(flags: .barrier) {
|
|
115
|
+
self.controllerInterfaceMasks[controllerIdentifier] = mask
|
|
116
|
+
}
|
|
114
117
|
enforceDesiredDeviceOrientation(withOrientationMask: mask)
|
|
115
118
|
}
|
|
116
119
|
|
|
@@ -121,18 +124,20 @@ public class ScreenOrientationRegistry: NSObject, UIApplicationDelegate {
|
|
|
121
124
|
*/
|
|
122
125
|
@objc
|
|
123
126
|
public func requiredOrientationMask() -> UIInterfaceOrientationMask {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
+
return queue.sync {
|
|
128
|
+
if controllerInterfaceMasks.isEmpty {
|
|
129
|
+
return []
|
|
130
|
+
}
|
|
127
131
|
|
|
128
|
-
|
|
129
|
-
|
|
132
|
+
// We want to apply an orientation mask which is an intersection of locks applied by the modules.
|
|
133
|
+
var mask = doesDeviceHaveNotch ? UIInterfaceOrientationMask.allButUpsideDown : UIInterfaceOrientationMask.all
|
|
130
134
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
for moduleMask in controllerInterfaceMasks {
|
|
136
|
+
mask = mask.intersection(moduleMask.value)
|
|
137
|
+
}
|
|
134
138
|
|
|
135
|
-
|
|
139
|
+
return mask
|
|
140
|
+
}
|
|
136
141
|
}
|
|
137
142
|
|
|
138
143
|
// MARK: - Events
|
|
@@ -199,21 +204,27 @@ public class ScreenOrientationRegistry: NSObject, UIApplicationDelegate {
|
|
|
199
204
|
Called at the end of the screen orientation change. Notifies the controllers about the orientation change.
|
|
200
205
|
*/
|
|
201
206
|
func screenOrientationDidChange(_ newScreenOrientation: UIInterfaceOrientation) {
|
|
202
|
-
|
|
207
|
+
queue.async(flags: .barrier) {
|
|
208
|
+
self.currentScreenOrientation = newScreenOrientation
|
|
203
209
|
|
|
204
|
-
|
|
205
|
-
|
|
210
|
+
for controller in self.orientationControllers {
|
|
211
|
+
controller.screenOrientationDidChange(newScreenOrientation)
|
|
212
|
+
}
|
|
206
213
|
}
|
|
207
214
|
}
|
|
208
215
|
|
|
209
216
|
public func registerController(_ controller: ScreenOrientationController) {
|
|
210
|
-
|
|
217
|
+
queue.sync {
|
|
218
|
+
self.orientationControllers.append(controller)
|
|
219
|
+
}
|
|
211
220
|
}
|
|
212
221
|
|
|
213
222
|
public func unregisterController(_ controller: ScreenOrientationController) {
|
|
214
223
|
let controllerIdentifier = ObjectIdentifier(controller)
|
|
215
224
|
|
|
216
|
-
|
|
217
|
-
|
|
225
|
+
queue.sync {
|
|
226
|
+
self.controllerInterfaceMasks.removeValue(forKey: controllerIdentifier)
|
|
227
|
+
self.orientationControllers.removeAll(where: { $0 === controller })
|
|
228
|
+
}
|
|
218
229
|
}
|
|
219
230
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-screen-orientation",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.2",
|
|
4
4
|
"description": "Expo universal module for managing device's screen orientation",
|
|
5
5
|
"main": "build/ScreenOrientation.js",
|
|
6
6
|
"types": "build/ScreenOrientation.d.ts",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"expo": "*",
|
|
43
43
|
"react-native": "*"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "a246df22c427d8c6c905de0915ed50f721fdf062"
|
|
46
46
|
}
|