@capawesome/capacitor-screen-orientation 5.0.1 → 6.0.1
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
CHANGED
|
@@ -111,7 +111,7 @@ Gets the current device orientation type.
|
|
|
111
111
|
### addListener('screenOrientationChange', ...)
|
|
112
112
|
|
|
113
113
|
```typescript
|
|
114
|
-
addListener(eventName: 'screenOrientationChange', listenerFunc: ScreenOrientationChangeListener) => Promise<PluginListenerHandle>
|
|
114
|
+
addListener(eventName: 'screenOrientationChange', listenerFunc: ScreenOrientationChangeListener) => Promise<PluginListenerHandle>
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
Listen for screen orientation changes.
|
|
@@ -121,7 +121,7 @@ Listen for screen orientation changes.
|
|
|
121
121
|
| **`eventName`** | <code>'screenOrientationChange'</code> |
|
|
122
122
|
| **`listenerFunc`** | <code><a href="#screenorientationchangelistener">ScreenOrientationChangeListener</a></code> |
|
|
123
123
|
|
|
124
|
-
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>>
|
|
124
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
125
125
|
|
|
126
126
|
--------------------
|
|
127
127
|
|
package/android/build.gradle
CHANGED
|
@@ -11,7 +11,7 @@ buildscript {
|
|
|
11
11
|
mavenCentral()
|
|
12
12
|
}
|
|
13
13
|
dependencies {
|
|
14
|
-
classpath 'com.android.tools.build:gradle:8.
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.2.1'
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -19,10 +19,10 @@ apply plugin: 'com.android.library'
|
|
|
19
19
|
|
|
20
20
|
android {
|
|
21
21
|
namespace "io.capawesome.capacitorjs.plugins.screenorientation"
|
|
22
|
-
|
|
22
|
+
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
|
|
23
23
|
defaultConfig {
|
|
24
24
|
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
25
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
|
|
26
26
|
versionCode 1
|
|
27
27
|
versionName "1.0"
|
|
28
28
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
package/dist/docs.json
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
"name": "addListener",
|
|
50
|
-
"signature": "(eventName: 'screenOrientationChange', listenerFunc: ScreenOrientationChangeListener) => Promise<PluginListenerHandle>
|
|
50
|
+
"signature": "(eventName: 'screenOrientationChange', listenerFunc: ScreenOrientationChangeListener) => Promise<PluginListenerHandle>",
|
|
51
51
|
"parameters": [
|
|
52
52
|
{
|
|
53
53
|
"name": "eventName",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"type": "ScreenOrientationChangeListener"
|
|
61
61
|
}
|
|
62
62
|
],
|
|
63
|
-
"returns": "Promise<PluginListenerHandle>
|
|
63
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
64
64
|
"tags": [],
|
|
65
65
|
"docs": "Listen for screen orientation changes.",
|
|
66
66
|
"complexTypes": [
|
|
@@ -15,7 +15,7 @@ export interface ScreenOrientationPlugin {
|
|
|
15
15
|
/**
|
|
16
16
|
* Listen for screen orientation changes.
|
|
17
17
|
*/
|
|
18
|
-
addListener(eventName: 'screenOrientationChange', listenerFunc: ScreenOrientationChangeListener): Promise<PluginListenerHandle
|
|
18
|
+
addListener(eventName: 'screenOrientationChange', listenerFunc: ScreenOrientationChangeListener): Promise<PluginListenerHandle>;
|
|
19
19
|
/**
|
|
20
20
|
* Remove all listeners for this plugin.
|
|
21
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA0CA,MAAM,CAAN,IAAY,eAyBX;AAzBD,WAAY,eAAe;IACzB;;OAEG;IACH,0CAAuB,CAAA;IACvB;;OAEG;IACH,0DAAuC,CAAA;IACvC;;OAEG;IACH,8DAA2C,CAAA;IAC3C;;OAEG;IACH,wCAAqB,CAAA;IACrB;;OAEG;IACH,wDAAqC,CAAA;IACrC;;OAEG;IACH,4DAAyC,CAAA;AAC3C,CAAC,EAzBW,eAAe,KAAf,eAAe,QAyB1B","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface ScreenOrientationPlugin {\n /**\n * Locks the device orientation.\n */\n lock(options: LockOptions): Promise<void>;\n /**\n * Unlocks the device orientation.\n */\n unlock(): Promise<void>;\n /**\n * Gets the current device orientation type.\n */\n getCurrentOrientation(): Promise<GetCurrentOrientationResult>;\n /**\n * Listen for screen orientation changes.\n */\n addListener(\n eventName: 'screenOrientationChange',\n listenerFunc: ScreenOrientationChangeListener,\n ): Promise<PluginListenerHandle
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA0CA,MAAM,CAAN,IAAY,eAyBX;AAzBD,WAAY,eAAe;IACzB;;OAEG;IACH,0CAAuB,CAAA;IACvB;;OAEG;IACH,0DAAuC,CAAA;IACvC;;OAEG;IACH,8DAA2C,CAAA;IAC3C;;OAEG;IACH,wCAAqB,CAAA;IACrB;;OAEG;IACH,wDAAqC,CAAA;IACrC;;OAEG;IACH,4DAAyC,CAAA;AAC3C,CAAC,EAzBW,eAAe,KAAf,eAAe,QAyB1B","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface ScreenOrientationPlugin {\n /**\n * Locks the device orientation.\n */\n lock(options: LockOptions): Promise<void>;\n /**\n * Unlocks the device orientation.\n */\n unlock(): Promise<void>;\n /**\n * Gets the current device orientation type.\n */\n getCurrentOrientation(): Promise<GetCurrentOrientationResult>;\n /**\n * Listen for screen orientation changes.\n */\n addListener(\n eventName: 'screenOrientationChange',\n listenerFunc: ScreenOrientationChangeListener,\n ): Promise<PluginListenerHandle>;\n /**\n * Remove all listeners for this plugin.\n */\n removeAllListeners(): Promise<void>;\n}\n\nexport interface LockOptions {\n /**\n * The orientation lock type.\n */\n type: OrientationType;\n}\n\nexport interface GetCurrentOrientationResult {\n /**\n * The current orientation type.\n */\n type: OrientationType;\n}\n\nexport enum OrientationType {\n /**\n * The orientation is either landscape-primary or landscape-secondary.\n */\n LANDSCAPE = 'landscape',\n /**\n * The orientation is in the primary landscape mode.\n */\n LANDSCAPE_PRIMARY = 'landscape-primary',\n /**\n * The orientation is in the secondary landscape mode.\n */\n LANDSCAPE_SECONDARY = 'landscape-secondary',\n /**\n * The orientation is either portrait-primary or portrait-secondary.\n */\n PORTRAIT = 'portrait',\n /**\n * The orientation is in the primary portrait mode.\n */\n PORTRAIT_PRIMARY = 'portrait-primary',\n /**\n * The orientation is in the secondary portrait mode.\n */\n PORTRAIT_SECONDARY = 'portrait-secondary',\n}\n\n/**\n * Callback to receive the screen orientation change notifications.\n */\nexport type ScreenOrientationChangeListener = (\n change: ScreenOrientationChange,\n) => void;\n\nexport interface ScreenOrientationChange {\n /**\n * The current orientation type.\n */\n type: OrientationType;\n}\n"]}
|
|
@@ -57,7 +57,7 @@ import Capacitor
|
|
|
57
57
|
}
|
|
58
58
|
completion(cachedOrientationType)
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
@objc private func requestGeometryUpdate(orientationValue: Int, orientationMask: UIInterfaceOrientationMask) {
|
|
62
62
|
if #available(iOS 16, *) {
|
|
63
63
|
let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene
|
|
@@ -100,7 +100,7 @@ import Capacitor
|
|
|
100
100
|
self.currentOrientationType = orientationType
|
|
101
101
|
self.plugin.notifyOrientationChangeListeners(orientationType)
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
@objc private func convertOrientationValueToMask(_ orientationValue: Int) -> UIInterfaceOrientationMask {
|
|
105
105
|
switch orientationValue {
|
|
106
106
|
case UIInterfaceOrientation.landscapeLeft.rawValue:
|
|
@@ -113,14 +113,14 @@ import Capacitor
|
|
|
113
113
|
return UIInterfaceOrientationMask.portraitUpsideDown
|
|
114
114
|
default:
|
|
115
115
|
let isPortrait = UIApplication.shared.windows.first?.windowScene?.interfaceOrientation.isPortrait ?? false
|
|
116
|
-
return isPortrait ? UIInterfaceOrientationMask.portrait : UIInterfaceOrientationMask.
|
|
116
|
+
return isPortrait ? UIInterfaceOrientationMask.portrait : UIInterfaceOrientationMask.landscape
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
@objc private func convertOrientationTypeToMask(_ orientationType: String) -> UIInterfaceOrientationMask {
|
|
121
121
|
switch orientationType {
|
|
122
122
|
case "landscape":
|
|
123
|
-
return UIInterfaceOrientationMask.
|
|
123
|
+
return UIInterfaceOrientationMask.landscape
|
|
124
124
|
case "landscape-primary":
|
|
125
125
|
return UIInterfaceOrientationMask.landscapeLeft
|
|
126
126
|
case "landscape-secondary":
|
|
@@ -7,5 +7,4 @@ CAP_PLUGIN(ScreenOrientationPlugin, "ScreenOrientation",
|
|
|
7
7
|
CAP_PLUGIN_METHOD(lock, CAPPluginReturnPromise);
|
|
8
8
|
CAP_PLUGIN_METHOD(unlock, CAPPluginReturnPromise);
|
|
9
9
|
CAP_PLUGIN_METHOD(getCurrentOrientation, CAPPluginReturnPromise);
|
|
10
|
-
CAP_PLUGIN_METHOD(removeAllListeners, CAPPluginReturnNone);
|
|
11
10
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capawesome/capacitor-screen-orientation",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "Capacitor plugin to lock/unlock the screen orientation.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -52,14 +52,15 @@
|
|
|
52
52
|
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
|
|
53
53
|
"clean": "rimraf ./dist",
|
|
54
54
|
"watch": "tsc --watch",
|
|
55
|
+
"ios:pod:install": "cd ios && pod install --repo-update && cd ..",
|
|
55
56
|
"prepublishOnly": "npm run build"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
|
-
"@capacitor/android": "
|
|
59
|
-
"@capacitor/cli": "
|
|
60
|
-
"@capacitor/core": "
|
|
59
|
+
"@capacitor/android": "6.0.0",
|
|
60
|
+
"@capacitor/cli": "6.0.0",
|
|
61
|
+
"@capacitor/core": "6.0.0",
|
|
61
62
|
"@capacitor/docgen": "0.2.0",
|
|
62
|
-
"@capacitor/ios": "
|
|
63
|
+
"@capacitor/ios": "6.0.0",
|
|
63
64
|
"@ionic/eslint-config": "0.3.0",
|
|
64
65
|
"@ionic/swiftlint-config": "1.1.2",
|
|
65
66
|
"eslint": "7.32.0",
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
"typescript": "4.1.5"
|
|
72
73
|
},
|
|
73
74
|
"peerDependencies": {
|
|
74
|
-
"@capacitor/core": "^
|
|
75
|
+
"@capacitor/core": "^6.0.0"
|
|
75
76
|
},
|
|
76
77
|
"swiftlint": "@ionic/swiftlint-config",
|
|
77
78
|
"eslintConfig": {
|