@capawesome/capacitor-screenshot 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/CapawesomeCapacitorScreenshot.podspec +1 -1
- package/Package.swift +28 -0
- package/android/build.gradle +9 -9
- package/dist/plugin.cjs.js +1 -7
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +1 -7
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/Screenshot.swift +1 -1
- package/ios/Plugin/ScreenshotPlugin.swift +6 -1
- package/package.json +19 -17
- package/ios/Plugin/ScreenshotPlugin.h +0 -10
- package/ios/Plugin/ScreenshotPlugin.m +0 -8
|
@@ -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: "CapawesomeCapacitorScreenshot",
|
|
6
|
+
platforms: [.iOS(.v14)],
|
|
7
|
+
products: [
|
|
8
|
+
.library(
|
|
9
|
+
name: "CapawesomeCapacitorScreenshot",
|
|
10
|
+
targets: ["ScreenshotPlugin"])
|
|
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: "ScreenshotPlugin",
|
|
18
|
+
dependencies: [
|
|
19
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
20
|
+
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
21
|
+
],
|
|
22
|
+
path: "ios/Sources/ScreenshotPlugin"),
|
|
23
|
+
.testTarget(
|
|
24
|
+
name: "ScreenshotPluginTests",
|
|
25
|
+
dependencies: ["ScreenshotPlugin"],
|
|
26
|
+
path: "ios/Tests/ScreenshotPluginTests")
|
|
27
|
+
]
|
|
28
|
+
)
|
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.screenshot"
|
|
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/plugin.cjs.js
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var core = require('@capacitor/core');
|
|
6
4
|
var html2canvas = require('html2canvas');
|
|
7
5
|
|
|
8
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
-
|
|
10
|
-
var html2canvas__default = /*#__PURE__*/_interopDefaultLegacy(html2canvas);
|
|
11
|
-
|
|
12
6
|
const Screenshot = core.registerPlugin('Screenshot', {
|
|
13
7
|
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.ScreenshotWeb()),
|
|
14
8
|
});
|
|
15
9
|
|
|
16
10
|
class ScreenshotWeb extends core.WebPlugin {
|
|
17
11
|
async take() {
|
|
18
|
-
const canvas = await
|
|
12
|
+
const canvas = await html2canvas(document.body);
|
|
19
13
|
return { uri: canvas.toDataURL() };
|
|
20
14
|
}
|
|
21
15
|
}
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Screenshot = registerPlugin('Screenshot', {\n web: () => import('./web').then(m => new m.ScreenshotWeb()),\n});\nexport * from './definitions';\nexport { Screenshot };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport html2canvas from 'html2canvas';\nexport class ScreenshotWeb extends WebPlugin {\n async take() {\n const canvas = await html2canvas(document.body);\n return { uri: canvas.toDataURL() };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Screenshot = registerPlugin('Screenshot', {\n web: () => import('./web').then(m => new m.ScreenshotWeb()),\n});\nexport * from './definitions';\nexport { Screenshot };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport html2canvas from 'html2canvas';\nexport class ScreenshotWeb extends WebPlugin {\n async take() {\n const canvas = await html2canvas(document.body);\n return { uri: canvas.toDataURL() };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;AACK,MAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;AAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;AAC/D,CAAC;;ACDM,MAAM,aAAa,SAASC,cAAS,CAAC;AAC7C,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;AACvD,QAAQ,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE;AAC1C;AACA;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
var capacitorScreenshot = (function (exports, core, html2canvas) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
5
|
-
|
|
6
|
-
var html2canvas__default = /*#__PURE__*/_interopDefaultLegacy(html2canvas);
|
|
7
|
-
|
|
8
4
|
const Screenshot = core.registerPlugin('Screenshot', {
|
|
9
5
|
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.ScreenshotWeb()),
|
|
10
6
|
});
|
|
11
7
|
|
|
12
8
|
class ScreenshotWeb extends core.WebPlugin {
|
|
13
9
|
async take() {
|
|
14
|
-
const canvas = await
|
|
10
|
+
const canvas = await html2canvas(document.body);
|
|
15
11
|
return { uri: canvas.toDataURL() };
|
|
16
12
|
}
|
|
17
13
|
}
|
|
@@ -23,8 +19,6 @@ var capacitorScreenshot = (function (exports, core, html2canvas) {
|
|
|
23
19
|
|
|
24
20
|
exports.Screenshot = Screenshot;
|
|
25
21
|
|
|
26
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
27
|
-
|
|
28
22
|
return exports;
|
|
29
23
|
|
|
30
24
|
})({}, capacitorExports, html2canvas);
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Screenshot = registerPlugin('Screenshot', {\n web: () => import('./web').then(m => new m.ScreenshotWeb()),\n});\nexport * from './definitions';\nexport { Screenshot };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport html2canvas from 'html2canvas';\nexport class ScreenshotWeb extends WebPlugin {\n async take() {\n const canvas = await html2canvas(document.body);\n return { uri: canvas.toDataURL() };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Screenshot = registerPlugin('Screenshot', {\n web: () => import('./web').then(m => new m.ScreenshotWeb()),\n});\nexport * from './definitions';\nexport { Screenshot };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport html2canvas from 'html2canvas';\nexport class ScreenshotWeb extends WebPlugin {\n async take() {\n const canvas = await html2canvas(document.body);\n return { uri: canvas.toDataURL() };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;IAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;IAC/D,CAAC;;ICDM,MAAM,aAAa,SAASC,cAAS,CAAC;IAC7C,IAAI,MAAM,IAAI,GAAG;IACjB,QAAQ,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;IACvD,QAAQ,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE;IAC1C;IACA;;;;;;;;;;;;;;;"}
|
|
@@ -21,7 +21,7 @@ import WebKit
|
|
|
21
21
|
if let error = error {
|
|
22
22
|
completion(nil, error)
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
if let image, let imageData = image.jpegData(compressionQuality: 1.0) {
|
|
26
26
|
let filename = UUID().uuidString + ".jpg"
|
|
27
27
|
guard let cacheDirectory = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first else {
|
|
@@ -6,7 +6,12 @@ import Capacitor
|
|
|
6
6
|
* here: https://capacitorjs.com/docs/plugins/ios
|
|
7
7
|
*/
|
|
8
8
|
@objc(ScreenshotPlugin)
|
|
9
|
-
public class ScreenshotPlugin: CAPPlugin {
|
|
9
|
+
public class ScreenshotPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
10
|
+
public let identifier = "ScreenshotPlugin"
|
|
11
|
+
public let jsName = "Screenshot"
|
|
12
|
+
public let pluginMethods: [CAPPluginMethod] = [
|
|
13
|
+
CAPPluginMethod(name: "take", returnType: CAPPluginReturnPromise)
|
|
14
|
+
]
|
|
10
15
|
public let tag = "Screenshot"
|
|
11
16
|
private var implementation: Screenshot?
|
|
12
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capawesome/capacitor-screenshot",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Capacitor plugin for taking screenshots.",
|
|
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
|
-
"CapawesomeCapacitorScreenshot.podspec"
|
|
14
|
+
"CapawesomeCapacitorScreenshot.podspec",
|
|
15
|
+
"Package.swift"
|
|
15
16
|
],
|
|
16
17
|
"author": "Robin Genz <mail@robingenz.dev>",
|
|
17
18
|
"license": "MIT",
|
|
@@ -53,31 +54,32 @@
|
|
|
53
54
|
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
54
55
|
"swiftlint": "node-swiftlint",
|
|
55
56
|
"docgen": "docgen --api ScreenshotPlugin --output-readme README.md --output-json dist/docs.json",
|
|
56
|
-
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.
|
|
57
|
+
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
57
58
|
"clean": "rimraf ./dist",
|
|
58
59
|
"watch": "tsc --watch",
|
|
59
60
|
"ios:pod:install": "cd ios && pod install --repo-update && cd ..",
|
|
61
|
+
"ios:spm:install": "cd ios && swift package resolve && cd ..",
|
|
60
62
|
"prepublishOnly": "npm run build"
|
|
61
63
|
},
|
|
62
64
|
"devDependencies": {
|
|
63
|
-
"@capacitor/android": "
|
|
64
|
-
"@capacitor/cli": "
|
|
65
|
-
"@capacitor/core": "
|
|
66
|
-
"@capacitor/docgen": "0.
|
|
67
|
-
"@capacitor/ios": "
|
|
68
|
-
"@ionic/eslint-config": "0.
|
|
69
|
-
"@ionic/swiftlint-config": "
|
|
70
|
-
"eslint": "
|
|
65
|
+
"@capacitor/android": "7.0.0",
|
|
66
|
+
"@capacitor/cli": "7.0.0",
|
|
67
|
+
"@capacitor/core": "7.0.0",
|
|
68
|
+
"@capacitor/docgen": "0.3.0",
|
|
69
|
+
"@capacitor/ios": "7.0.0",
|
|
70
|
+
"@ionic/eslint-config": "0.4.0",
|
|
71
|
+
"@ionic/swiftlint-config": "2.0.0",
|
|
72
|
+
"eslint": "8.57.0",
|
|
71
73
|
"html2canvas": "1.4.1",
|
|
72
|
-
"prettier": "
|
|
73
|
-
"prettier-plugin-java": "
|
|
74
|
-
"rimraf": "
|
|
75
|
-
"rollup": "
|
|
76
|
-
"swiftlint": "
|
|
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",
|
|
77
79
|
"typescript": "4.1.5"
|
|
78
80
|
},
|
|
79
81
|
"peerDependencies": {
|
|
80
|
-
"@capacitor/core": "
|
|
82
|
+
"@capacitor/core": ">=7.0.0",
|
|
81
83
|
"html2canvas": "^1.4.1"
|
|
82
84
|
},
|
|
83
85
|
"swiftlint": "@ionic/swiftlint-config",
|
|
@@ -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,8 +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(ScreenshotPlugin, "Screenshot",
|
|
7
|
-
CAP_PLUGIN_METHOD(take, CAPPluginReturnPromise);
|
|
8
|
-
)
|