@capawesome/capacitor-screen-orientation 7.0.1 → 7.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/README.md +17 -0
- package/ios/Plugin/ScreenOrientation.swift +5 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Capacitor plugin to lock/unlock the screen orientation.
|
|
4
4
|
|
|
5
|
+
<div class="capawesome-z29o10a">
|
|
6
|
+
<a href="https://cloud.capawesome.io/" target="_blank">
|
|
7
|
+
<img alt="Deliver Live Updates to your Capacitor app with Capawesome Cloud" src="https://cloud.capawesome.io/assets/banners/cloud-deploy-real-time-app-updates.png?t=1" />
|
|
8
|
+
</a>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
5
11
|
## Installation
|
|
6
12
|
|
|
7
13
|
```bash
|
|
@@ -11,6 +17,8 @@ npx cap sync
|
|
|
11
17
|
|
|
12
18
|
### iOS
|
|
13
19
|
|
|
20
|
+
#### General
|
|
21
|
+
|
|
14
22
|
On iOS you must add the following to your app's `AppDelegate.swift`:
|
|
15
23
|
|
|
16
24
|
```diff
|
|
@@ -24,6 +32,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
|
24
32
|
+ }
|
|
25
33
|
```
|
|
26
34
|
|
|
35
|
+
#### iPad Orientation Lock
|
|
36
|
+
|
|
37
|
+
On iPad, you must add the following to your app's `Info.plist`:
|
|
38
|
+
|
|
39
|
+
```xml
|
|
40
|
+
<key>UIRequiresFullScreen</key>
|
|
41
|
+
<true/>
|
|
42
|
+
```
|
|
43
|
+
|
|
27
44
|
## Configuration
|
|
28
45
|
|
|
29
46
|
No configuration required for this plugin.
|
|
@@ -30,9 +30,7 @@ import Capacitor
|
|
|
30
30
|
strongSelf.requestGeometryUpdate(orientationValue: nextOrientationValue, orientationMask: nextOrientationMask)
|
|
31
31
|
ScreenOrientation.supportedInterfaceOrientations = nextOrientationMask
|
|
32
32
|
UINavigationController.attemptRotationToDeviceOrientation()
|
|
33
|
-
|
|
34
|
-
strongSelf.requestGeometryUpdate(orientationValue: currentOrientationValue, orientationMask: currentOrientationMask)
|
|
35
|
-
}
|
|
33
|
+
strongSelf.requestGeometryUpdate(orientationValue: currentOrientationValue, orientationMask: currentOrientationMask)
|
|
36
34
|
strongSelf.notifyOrientationChangeListeners(orientationType)
|
|
37
35
|
completion()
|
|
38
36
|
}
|
|
@@ -40,11 +38,14 @@ import Capacitor
|
|
|
40
38
|
|
|
41
39
|
@objc public func unlock(completion: @escaping () -> Void) {
|
|
42
40
|
DispatchQueue.main.async {
|
|
43
|
-
|
|
41
|
+
let orientationMask = UIInterfaceOrientationMask.all
|
|
42
|
+
ScreenOrientation.supportedInterfaceOrientations = orientationMask
|
|
44
43
|
UINavigationController.attemptRotationToDeviceOrientation()
|
|
45
44
|
guard let orientationType = self.lastOrientationType else {
|
|
46
45
|
return
|
|
47
46
|
}
|
|
47
|
+
let orientationValue = self.convertOrientationTypeToValue(orientationType)
|
|
48
|
+
self.requestGeometryUpdate(orientationValue: orientationValue, orientationMask: orientationMask)
|
|
48
49
|
self.notifyOrientationChangeListeners(orientationType)
|
|
49
50
|
completion()
|
|
50
51
|
}
|
package/package.json
CHANGED