@capawesome/capacitor-screen-orientation 6.0.0 → 7.0.0
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/CapawesomeCapacitorScreenOrientation.podspec +1 -1
- package/Package.swift +28 -0
- package/README.md +1 -1
- package/android/build.gradle +9 -9
- package/dist/docs.json +1 -1
- package/dist/plugin.cjs.js +0 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +0 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/ScreenOrientation.swift +4 -4
- package/ios/Plugin/ScreenOrientationPlugin.swift +8 -1
- package/package.json +25 -18
- package/ios/Plugin/ScreenOrientationPlugin.h +0 -10
- package/ios/Plugin/ScreenOrientationPlugin.m +0 -10
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
13
|
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
-
s.ios.deployment_target = '
|
|
14
|
+
s.ios.deployment_target = '14.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
16
|
s.swift_version = '5.1'
|
|
17
17
|
end
|
package/Package.swift
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// swift-tools-version: 5.9
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "CapawesomeCapacitorScreenOrientation",
|
|
6
|
+
platforms: [.iOS(.v14)],
|
|
7
|
+
products: [
|
|
8
|
+
.library(
|
|
9
|
+
name: "CapawesomeCapacitorScreenOrientation",
|
|
10
|
+
targets: ["ScreenOrientationPlugin"])
|
|
11
|
+
],
|
|
12
|
+
dependencies: [
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
|
|
14
|
+
],
|
|
15
|
+
targets: [
|
|
16
|
+
.target(
|
|
17
|
+
name: "ScreenOrientationPlugin",
|
|
18
|
+
dependencies: [
|
|
19
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
20
|
+
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
21
|
+
],
|
|
22
|
+
path: "ios/Sources/ScreenOrientationPlugin"),
|
|
23
|
+
.testTarget(
|
|
24
|
+
name: "ScreenOrientationPluginTests",
|
|
25
|
+
dependencies: ["ScreenOrientationPlugin"],
|
|
26
|
+
path: "ios/Tests/ScreenOrientationPluginTests")
|
|
27
|
+
]
|
|
28
|
+
)
|
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ const getCurrentOrientation = async () => {
|
|
|
58
58
|
* [`lock(...)`](#lock)
|
|
59
59
|
* [`unlock()`](#unlock)
|
|
60
60
|
* [`getCurrentOrientation()`](#getcurrentorientation)
|
|
61
|
-
* [`addListener('screenOrientationChange', ...)`](#addlistenerscreenorientationchange)
|
|
61
|
+
* [`addListener('screenOrientationChange', ...)`](#addlistenerscreenorientationchange-)
|
|
62
62
|
* [`removeAllListeners()`](#removealllisteners)
|
|
63
63
|
* [Interfaces](#interfaces)
|
|
64
64
|
* [Type Aliases](#type-aliases)
|
package/android/build.gradle
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
ext {
|
|
2
2
|
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.
|
|
4
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1
|
|
5
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
@@ -11,7 +11,7 @@ buildscript {
|
|
|
11
11
|
mavenCentral()
|
|
12
12
|
}
|
|
13
13
|
dependencies {
|
|
14
|
-
classpath 'com.android.tools.build:gradle:8.2
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.7.2'
|
|
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
|
-
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
22
|
+
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
|
|
23
23
|
defaultConfig {
|
|
24
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
25
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
24
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
|
|
26
26
|
versionCode 1
|
|
27
27
|
versionName "1.0"
|
|
28
28
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -37,8 +37,8 @@ android {
|
|
|
37
37
|
abortOnError false
|
|
38
38
|
}
|
|
39
39
|
compileOptions {
|
|
40
|
-
sourceCompatibility JavaVersion.
|
|
41
|
-
targetCompatibility JavaVersion.
|
|
40
|
+
sourceCompatibility JavaVersion.VERSION_21
|
|
41
|
+
targetCompatibility JavaVersion.VERSION_21
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
package/dist/docs.json
CHANGED
package/dist/plugin.cjs.js
CHANGED
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var OrientationType;\n(function (OrientationType) {\n /**\n * The orientation is either landscape-primary or landscape-secondary.\n */\n OrientationType[\"LANDSCAPE\"] = \"landscape\";\n /**\n * The orientation is in the primary landscape mode.\n */\n OrientationType[\"LANDSCAPE_PRIMARY\"] = \"landscape-primary\";\n /**\n * The orientation is in the secondary landscape mode.\n */\n OrientationType[\"LANDSCAPE_SECONDARY\"] = \"landscape-secondary\";\n /**\n * The orientation is either portrait-primary or portrait-secondary.\n */\n OrientationType[\"PORTRAIT\"] = \"portrait\";\n /**\n * The orientation is in the primary portrait mode.\n */\n OrientationType[\"PORTRAIT_PRIMARY\"] = \"portrait-primary\";\n /**\n * The orientation is in the secondary portrait mode.\n */\n OrientationType[\"PORTRAIT_SECONDARY\"] = \"portrait-secondary\";\n})(OrientationType || (OrientationType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst ScreenOrientation = registerPlugin('ScreenOrientation', {\n web: () => import('./web').then(m => new m.ScreenOrientationWeb()),\n});\nexport * from './definitions';\nexport { ScreenOrientation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { OrientationType } from './definitions';\nexport class ScreenOrientationWeb extends WebPlugin {\n constructor() {\n super();\n this.isSupported = 'orientation' in screen;\n this.handleOrientationChange = async () => {\n const result = await this.getCurrentOrientation();\n const changeEvent = {\n type: result.type,\n };\n this.notifyListeners('screenOrientationChange', changeEvent);\n };\n if (this.isSupported) {\n screen.orientation.addEventListener('change', this.handleOrientationChange);\n }\n }\n async lock(options) {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n await screen.orientation.lock(options.type);\n }\n async unlock() {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n screen.orientation.unlock();\n }\n async getCurrentOrientation() {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n switch (screen.orientation.type) {\n case 'landscape-primary':\n return { type: OrientationType.LANDSCAPE_PRIMARY };\n case 'landscape-secondary':\n return { type: OrientationType.LANDSCAPE_SECONDARY };\n case 'portrait-secondary':\n return { type: OrientationType.PORTRAIT_SECONDARY };\n default:\n return { type: OrientationType.PORTRAIT_PRIMARY };\n }\n }\n throwUnsupportedError() {\n throw this.unavailable('Screen Orientation API not available in this browser.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["OrientationType","registerPlugin","WebPlugin"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var OrientationType;\n(function (OrientationType) {\n /**\n * The orientation is either landscape-primary or landscape-secondary.\n */\n OrientationType[\"LANDSCAPE\"] = \"landscape\";\n /**\n * The orientation is in the primary landscape mode.\n */\n OrientationType[\"LANDSCAPE_PRIMARY\"] = \"landscape-primary\";\n /**\n * The orientation is in the secondary landscape mode.\n */\n OrientationType[\"LANDSCAPE_SECONDARY\"] = \"landscape-secondary\";\n /**\n * The orientation is either portrait-primary or portrait-secondary.\n */\n OrientationType[\"PORTRAIT\"] = \"portrait\";\n /**\n * The orientation is in the primary portrait mode.\n */\n OrientationType[\"PORTRAIT_PRIMARY\"] = \"portrait-primary\";\n /**\n * The orientation is in the secondary portrait mode.\n */\n OrientationType[\"PORTRAIT_SECONDARY\"] = \"portrait-secondary\";\n})(OrientationType || (OrientationType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst ScreenOrientation = registerPlugin('ScreenOrientation', {\n web: () => import('./web').then(m => new m.ScreenOrientationWeb()),\n});\nexport * from './definitions';\nexport { ScreenOrientation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { OrientationType } from './definitions';\nexport class ScreenOrientationWeb extends WebPlugin {\n constructor() {\n super();\n this.isSupported = 'orientation' in screen;\n this.handleOrientationChange = async () => {\n const result = await this.getCurrentOrientation();\n const changeEvent = {\n type: result.type,\n };\n this.notifyListeners('screenOrientationChange', changeEvent);\n };\n if (this.isSupported) {\n screen.orientation.addEventListener('change', this.handleOrientationChange);\n }\n }\n async lock(options) {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n await screen.orientation.lock(options.type);\n }\n async unlock() {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n screen.orientation.unlock();\n }\n async getCurrentOrientation() {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n switch (screen.orientation.type) {\n case 'landscape-primary':\n return { type: OrientationType.LANDSCAPE_PRIMARY };\n case 'landscape-secondary':\n return { type: OrientationType.LANDSCAPE_SECONDARY };\n case 'portrait-secondary':\n return { type: OrientationType.PORTRAIT_SECONDARY };\n default:\n return { type: OrientationType.PORTRAIT_PRIMARY };\n }\n }\n throwUnsupportedError() {\n throw this.unavailable('Screen Orientation API not available in this browser.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["OrientationType","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,eAAe,EAAE;AAC5B;AACA;AACA;AACA,IAAI,eAAe,CAAC,WAAW,CAAC,GAAG,WAAW;AAC9C;AACA;AACA;AACA,IAAI,eAAe,CAAC,mBAAmB,CAAC,GAAG,mBAAmB;AAC9D;AACA;AACA;AACA,IAAI,eAAe,CAAC,qBAAqB,CAAC,GAAG,qBAAqB;AAClE;AACA;AACA;AACA,IAAI,eAAe,CAAC,UAAU,CAAC,GAAG,UAAU;AAC5C;AACA;AACA;AACA,IAAI,eAAe,CAAC,kBAAkB,CAAC,GAAG,kBAAkB;AAC5D;AACA;AACA;AACA,IAAI,eAAe,CAAC,oBAAoB,CAAC,GAAG,oBAAoB;AAChE,CAAC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IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;AAC/B,YAAY,IAAI,CAAC,qBAAqB,EAAE;AACxC;AACA,QAAQ,QAAQ,MAAM,CAAC,WAAW,CAAC,IAAI;AACvC,YAAY,KAAK,mBAAmB;AACpC,gBAAgB,OAAO,EAAE,IAAI,EAAEF,uBAAe,CAAC,iBAAiB,EAAE;AAClE,YAAY,KAAK,qBAAqB;AACtC,gBAAgB,OAAO,EAAE,IAAI,EAAEA,uBAAe,CAAC,mBAAmB,EAAE;AACpE,YAAY,KAAK,oBAAoB;AACrC,gBAAgB,OAAO,EAAE,IAAI,EAAEA,uBAAe,CAAC,kBAAkB,EAAE;AACnE,YAAY;AACZ,gBAAgB,OAAO,EAAE,IAAI,EAAEA,uBAAe,CAAC,gBAAgB,EAAE;AACjE;AACA;AACA,IAAI,qBAAqB,GAAG;AAC5B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,uDAAuD,CAAC;AACvF;AACA;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var OrientationType;\n(function (OrientationType) {\n /**\n * The orientation is either landscape-primary or landscape-secondary.\n */\n OrientationType[\"LANDSCAPE\"] = \"landscape\";\n /**\n * The orientation is in the primary landscape mode.\n */\n OrientationType[\"LANDSCAPE_PRIMARY\"] = \"landscape-primary\";\n /**\n * The orientation is in the secondary landscape mode.\n */\n OrientationType[\"LANDSCAPE_SECONDARY\"] = \"landscape-secondary\";\n /**\n * The orientation is either portrait-primary or portrait-secondary.\n */\n OrientationType[\"PORTRAIT\"] = \"portrait\";\n /**\n * The orientation is in the primary portrait mode.\n */\n OrientationType[\"PORTRAIT_PRIMARY\"] = \"portrait-primary\";\n /**\n * The orientation is in the secondary portrait mode.\n */\n OrientationType[\"PORTRAIT_SECONDARY\"] = \"portrait-secondary\";\n})(OrientationType || (OrientationType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst ScreenOrientation = registerPlugin('ScreenOrientation', {\n web: () => import('./web').then(m => new m.ScreenOrientationWeb()),\n});\nexport * from './definitions';\nexport { ScreenOrientation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { OrientationType } from './definitions';\nexport class ScreenOrientationWeb extends WebPlugin {\n constructor() {\n super();\n this.isSupported = 'orientation' in screen;\n this.handleOrientationChange = async () => {\n const result = await this.getCurrentOrientation();\n const changeEvent = {\n type: result.type,\n };\n this.notifyListeners('screenOrientationChange', changeEvent);\n };\n if (this.isSupported) {\n screen.orientation.addEventListener('change', this.handleOrientationChange);\n }\n }\n async lock(options) {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n await screen.orientation.lock(options.type);\n }\n async unlock() {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n screen.orientation.unlock();\n }\n async getCurrentOrientation() {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n switch (screen.orientation.type) {\n case 'landscape-primary':\n return { type: OrientationType.LANDSCAPE_PRIMARY };\n case 'landscape-secondary':\n return { type: OrientationType.LANDSCAPE_SECONDARY };\n case 'portrait-secondary':\n return { type: OrientationType.PORTRAIT_SECONDARY };\n default:\n return { type: OrientationType.PORTRAIT_PRIMARY };\n }\n }\n throwUnsupportedError() {\n throw this.unavailable('Screen Orientation API not available in this browser.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["OrientationType","registerPlugin","WebPlugin"],"mappings":";;;AAAWA
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var OrientationType;\n(function (OrientationType) {\n /**\n * The orientation is either landscape-primary or landscape-secondary.\n */\n OrientationType[\"LANDSCAPE\"] = \"landscape\";\n /**\n * The orientation is in the primary landscape mode.\n */\n OrientationType[\"LANDSCAPE_PRIMARY\"] = \"landscape-primary\";\n /**\n * The orientation is in the secondary landscape mode.\n */\n OrientationType[\"LANDSCAPE_SECONDARY\"] = \"landscape-secondary\";\n /**\n * The orientation is either portrait-primary or portrait-secondary.\n */\n OrientationType[\"PORTRAIT\"] = \"portrait\";\n /**\n * The orientation is in the primary portrait mode.\n */\n OrientationType[\"PORTRAIT_PRIMARY\"] = \"portrait-primary\";\n /**\n * The orientation is in the secondary portrait mode.\n */\n OrientationType[\"PORTRAIT_SECONDARY\"] = \"portrait-secondary\";\n})(OrientationType || (OrientationType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst ScreenOrientation = registerPlugin('ScreenOrientation', {\n web: () => import('./web').then(m => new m.ScreenOrientationWeb()),\n});\nexport * from './definitions';\nexport { ScreenOrientation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { OrientationType } from './definitions';\nexport class ScreenOrientationWeb extends WebPlugin {\n constructor() {\n super();\n this.isSupported = 'orientation' in screen;\n this.handleOrientationChange = async () => {\n const result = await this.getCurrentOrientation();\n const changeEvent = {\n type: result.type,\n };\n this.notifyListeners('screenOrientationChange', changeEvent);\n };\n if (this.isSupported) {\n screen.orientation.addEventListener('change', this.handleOrientationChange);\n }\n }\n async lock(options) {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n await screen.orientation.lock(options.type);\n }\n async unlock() {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n screen.orientation.unlock();\n }\n async getCurrentOrientation() {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n switch (screen.orientation.type) {\n case 'landscape-primary':\n return { type: OrientationType.LANDSCAPE_PRIMARY };\n case 'landscape-secondary':\n return { type: OrientationType.LANDSCAPE_SECONDARY };\n case 'portrait-secondary':\n return { type: OrientationType.PORTRAIT_SECONDARY };\n default:\n return { type: OrientationType.PORTRAIT_PRIMARY };\n }\n }\n throwUnsupportedError() {\n throw this.unavailable('Screen Orientation API not available in this browser.');\n }\n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-
|
|
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":
|
|
@@ -6,7 +6,14 @@ import Capacitor
|
|
|
6
6
|
* here: https://capacitorjs.com/docs/plugins/ios
|
|
7
7
|
*/
|
|
8
8
|
@objc(ScreenOrientationPlugin)
|
|
9
|
-
public class ScreenOrientationPlugin: CAPPlugin {
|
|
9
|
+
public class ScreenOrientationPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
10
|
+
public let identifier = "ScreenOrientationPlugin"
|
|
11
|
+
public let jsName = "ScreenOrientation"
|
|
12
|
+
public let pluginMethods: [CAPPluginMethod] = [
|
|
13
|
+
CAPPluginMethod(name: "lock", returnType: CAPPluginReturnPromise),
|
|
14
|
+
CAPPluginMethod(name: "unlock", returnType: CAPPluginReturnPromise),
|
|
15
|
+
CAPPluginMethod(name: "getCurrentOrientation", returnType: CAPPluginReturnPromise)
|
|
16
|
+
]
|
|
10
17
|
public let screenOrientationChangeEvent = "screenOrientationChange"
|
|
11
18
|
private var implementation: ScreenOrientation?
|
|
12
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capawesome/capacitor-screen-orientation",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
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",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"android/build.gradle",
|
|
12
12
|
"dist/",
|
|
13
13
|
"ios/Plugin/",
|
|
14
|
-
"CapawesomeCapacitorScreenOrientation.podspec"
|
|
14
|
+
"CapawesomeCapacitorScreenOrientation.podspec",
|
|
15
|
+
"Package.swift"
|
|
15
16
|
],
|
|
16
17
|
"author": "Robin Genz <mail@robingenz.dev>",
|
|
17
18
|
"license": "MIT",
|
|
@@ -36,7 +37,12 @@
|
|
|
36
37
|
"keywords": [
|
|
37
38
|
"capacitor",
|
|
38
39
|
"plugin",
|
|
39
|
-
"native"
|
|
40
|
+
"native",
|
|
41
|
+
"ionic",
|
|
42
|
+
"android",
|
|
43
|
+
"ios",
|
|
44
|
+
"web",
|
|
45
|
+
"screen orientation"
|
|
40
46
|
],
|
|
41
47
|
"scripts": {
|
|
42
48
|
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
@@ -49,30 +55,31 @@
|
|
|
49
55
|
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
50
56
|
"swiftlint": "node-swiftlint",
|
|
51
57
|
"docgen": "docgen --api ScreenOrientationPlugin --output-readme README.md --output-json dist/docs.json",
|
|
52
|
-
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.
|
|
58
|
+
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
53
59
|
"clean": "rimraf ./dist",
|
|
54
60
|
"watch": "tsc --watch",
|
|
55
61
|
"ios:pod:install": "cd ios && pod install --repo-update && cd ..",
|
|
62
|
+
"ios:spm:install": "cd ios && swift package resolve && cd ..",
|
|
56
63
|
"prepublishOnly": "npm run build"
|
|
57
64
|
},
|
|
58
65
|
"devDependencies": {
|
|
59
|
-
"@capacitor/android": "
|
|
60
|
-
"@capacitor/cli": "
|
|
61
|
-
"@capacitor/core": "
|
|
62
|
-
"@capacitor/docgen": "0.
|
|
63
|
-
"@capacitor/ios": "
|
|
64
|
-
"@ionic/eslint-config": "0.
|
|
65
|
-
"@ionic/swiftlint-config": "
|
|
66
|
-
"eslint": "
|
|
67
|
-
"prettier": "
|
|
68
|
-
"prettier-plugin-java": "
|
|
69
|
-
"rimraf": "
|
|
70
|
-
"rollup": "
|
|
71
|
-
"swiftlint": "
|
|
66
|
+
"@capacitor/android": "7.0.0",
|
|
67
|
+
"@capacitor/cli": "7.0.0",
|
|
68
|
+
"@capacitor/core": "7.0.0",
|
|
69
|
+
"@capacitor/docgen": "0.3.0",
|
|
70
|
+
"@capacitor/ios": "7.0.0",
|
|
71
|
+
"@ionic/eslint-config": "0.4.0",
|
|
72
|
+
"@ionic/swiftlint-config": "2.0.0",
|
|
73
|
+
"eslint": "8.57.0",
|
|
74
|
+
"prettier": "3.4.2",
|
|
75
|
+
"prettier-plugin-java": "2.6.7",
|
|
76
|
+
"rimraf": "6.0.1",
|
|
77
|
+
"rollup": "4.30.1",
|
|
78
|
+
"swiftlint": "2.0.0",
|
|
72
79
|
"typescript": "4.1.5"
|
|
73
80
|
},
|
|
74
81
|
"peerDependencies": {
|
|
75
|
-
"@capacitor/core": "
|
|
82
|
+
"@capacitor/core": ">=7.0.0"
|
|
76
83
|
},
|
|
77
84
|
"swiftlint": "@ionic/swiftlint-config",
|
|
78
85
|
"eslintConfig": {
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#import <UIKit/UIKit.h>
|
|
2
|
-
|
|
3
|
-
//! Project version number for Plugin.
|
|
4
|
-
FOUNDATION_EXPORT double PluginVersionNumber;
|
|
5
|
-
|
|
6
|
-
//! Project version string for Plugin.
|
|
7
|
-
FOUNDATION_EXPORT const unsigned char PluginVersionString[];
|
|
8
|
-
|
|
9
|
-
// In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
|
|
10
|
-
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#import <Foundation/Foundation.h>
|
|
2
|
-
#import <Capacitor/Capacitor.h>
|
|
3
|
-
|
|
4
|
-
// Define the plugin using the CAP_PLUGIN Macro, and
|
|
5
|
-
// each method the plugin supports using the CAP_PLUGIN_METHOD macro.
|
|
6
|
-
CAP_PLUGIN(ScreenOrientationPlugin, "ScreenOrientation",
|
|
7
|
-
CAP_PLUGIN_METHOD(lock, CAPPluginReturnPromise);
|
|
8
|
-
CAP_PLUGIN_METHOD(unlock, CAPPluginReturnPromise);
|
|
9
|
-
CAP_PLUGIN_METHOD(getCurrentOrientation, CAPPluginReturnPromise);
|
|
10
|
-
)
|