cty-mui-core 1.0.28 → 1.0.30
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/components/camera.js +2 -2
- package/components/device-info.js +23 -3
- package/components/image-picker.js +11 -17
- package/components/video-capture.js +2 -2
- package/dist/cjs/{audio-recorder-BKbTidei.js → audio-recorder-DD-m7fzZ.js} +1 -1
- package/dist/cjs/cty-camera-photo.cjs.entry.js +2 -2
- package/dist/cjs/cty-camera_2.cjs.entry.js +4 -4
- package/dist/cjs/cty-canvas-video.cjs.entry.js +1 -1
- package/dist/cjs/cty-keyboard.cjs.entry.js +1 -1
- package/dist/cjs/cty-media-capture.cjs.entry.js +2 -2
- package/dist/cjs/cty-record.cjs.entry.js +2 -2
- package/dist/cjs/cty-share-sheet.cjs.entry.js +2 -2
- package/dist/cjs/cty-video.cjs.entry.js +1 -1
- package/dist/cjs/{device-info-C7UUXx-P.js → device-info-tw8uyU3o.js} +23 -3
- package/dist/cjs/{image-picker-DAK_um5_.js → image-picker-z0grMzCR.js} +12 -18
- package/dist/cjs/index.cjs.js +5 -5
- package/dist/cjs/{share-C5S5TwgG.js → share-CEJHAXCK.js} +1 -1
- package/dist/cjs/{video-capture-DAMSxk8m.js → video-capture-y5hiX1MC.js} +3 -3
- package/dist/collection/components/camera/camera.js +2 -2
- package/dist/collection/utils/native/image-picker.js +11 -17
- package/dist/collection/utils/native/utils.js +23 -3
- package/dist/collection/utils/native/video-capture.js +2 -2
- package/dist/cty-mui/cty-mui.esm.js +1 -1
- package/dist/cty-mui/index.esm.js +1 -1
- package/dist/cty-mui/{p-7fee7137.system.entry.js → p-105ae84e.system.entry.js} +1 -1
- package/dist/cty-mui/{p-14f3207d.entry.js → p-2b58b07c.entry.js} +1 -1
- package/dist/cty-mui/{p-64f873e3.entry.js → p-2d1e36b8.entry.js} +1 -1
- package/dist/cty-mui/{p-c5ed5fc1.system.entry.js → p-4931b548.system.entry.js} +1 -1
- package/dist/cty-mui/{p-9eba7513.entry.js → p-7ba3e569.entry.js} +1 -1
- package/dist/cty-mui/{p-53e5d520.system.entry.js → p-813e47e2.system.entry.js} +1 -1
- package/dist/cty-mui/p-85c59224.entry.js +1 -0
- package/dist/cty-mui/{p-DM51Z91U.js → p-B51y-KRW.js} +1 -1
- package/dist/cty-mui/p-BBzgriVK.system.js +1 -0
- package/dist/cty-mui/p-CFmPiYWN.js +1 -0
- package/dist/cty-mui/p-CV2yZgY5.system.js +1 -0
- package/dist/cty-mui/p-Cegbc1c7.system.js +1 -1
- package/dist/cty-mui/{p-CSK0Pbxf.system.js → p-DQkqBaKG.system.js} +1 -1
- package/dist/cty-mui/{p-CHeCaQQD.js → p-DYZkncP_.js} +1 -1
- package/dist/cty-mui/p-De8c01By.js +1 -0
- package/dist/cty-mui/p-Lq8lQBzu.js +1 -0
- package/dist/cty-mui/{p-D2G0Jsfd.system.js → p-Xz7Lwi-1.system.js} +1 -1
- package/dist/cty-mui/{p-e66554bd.entry.js → p-a977b604.entry.js} +1 -1
- package/dist/cty-mui/{p-d5653db5.entry.js → p-b8971f51.entry.js} +1 -1
- package/dist/cty-mui/{p-10d7700f.system.entry.js → p-be9ac19f.system.entry.js} +1 -1
- package/dist/cty-mui/{p-0f32ebdb.system.entry.js → p-cccac0a1.system.entry.js} +1 -1
- package/dist/cty-mui/{p-35bf1c7d.system.entry.js → p-db399993.system.entry.js} +1 -1
- package/dist/cty-mui/{p-637194fb.entry.js → p-e8d399a1.entry.js} +1 -1
- package/dist/cty-mui/{p-3280e4cc.system.entry.js → p-eb6e85c1.system.entry.js} +1 -1
- package/dist/cty-mui/{p-f2a68731.entry.js → p-ec0ccb62.entry.js} +1 -1
- package/dist/cty-mui/p-faaf23c7.system.entry.js +1 -0
- package/dist/cty-mui/p-hLl9slH7.system.js +1 -0
- package/dist/cty-mui/{p-I9Tp7zOu.system.js → p-llUZIYgs.system.js} +1 -1
- package/dist/docs.json +1 -1
- package/dist/esm/{audio-recorder-CMG1hXEJ.js → audio-recorder-CeRlWnIB.js} +1 -1
- package/dist/esm/cty-camera-photo.entry.js +2 -2
- package/dist/esm/cty-camera_2.entry.js +4 -4
- package/dist/esm/cty-canvas-video.entry.js +1 -1
- package/dist/esm/cty-keyboard.entry.js +1 -1
- package/dist/esm/cty-media-capture.entry.js +2 -2
- package/dist/esm/cty-record.entry.js +2 -2
- package/dist/esm/cty-share-sheet.entry.js +2 -2
- package/dist/esm/cty-video.entry.js +1 -1
- package/dist/esm/{device-info-DpfVimRl.js → device-info-CYRSTxYL.js} +23 -3
- package/dist/esm/{image-picker-D0rFViUA.js → image-picker-BT-qYupN.js} +12 -18
- package/dist/esm/index.js +6 -6
- package/dist/esm/{share-BW1ZT5H7.js → share-sZHCP53A.js} +1 -1
- package/dist/esm/{video-capture-Xsjc8H75.js → video-capture-C4DNchGQ.js} +3 -3
- package/dist/esm-es5/{audio-recorder-CMG1hXEJ.js → audio-recorder-CeRlWnIB.js} +1 -1
- package/dist/esm-es5/cty-camera-photo.entry.js +1 -1
- package/dist/esm-es5/cty-camera_2.entry.js +1 -1
- package/dist/esm-es5/cty-canvas-video.entry.js +1 -1
- package/dist/esm-es5/cty-keyboard.entry.js +1 -1
- package/dist/esm-es5/cty-media-capture.entry.js +1 -1
- package/dist/esm-es5/cty-record.entry.js +1 -1
- package/dist/esm-es5/cty-share-sheet.entry.js +1 -1
- package/dist/esm-es5/cty-video.entry.js +1 -1
- package/dist/esm-es5/device-info-CYRSTxYL.js +1 -0
- package/dist/esm-es5/image-picker-BT-qYupN.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{share-BW1ZT5H7.js → share-sZHCP53A.js} +1 -1
- package/dist/esm-es5/video-capture-C4DNchGQ.js +1 -0
- package/dist/types/utils/native/image-picker.d.ts +1 -1
- package/dist/types/utils/native/utils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cty-mui/p-4XgC2K1B.js +0 -1
- package/dist/cty-mui/p-79be951f.system.entry.js +0 -1
- package/dist/cty-mui/p-B-x0hJFy.js +0 -1
- package/dist/cty-mui/p-B5SDTFdR.system.js +0 -1
- package/dist/cty-mui/p-CXtPwfcM.js +0 -1
- package/dist/cty-mui/p-DIlGnmah.system.js +0 -1
- package/dist/cty-mui/p-DSgG8qVn.system.js +0 -1
- package/dist/cty-mui/p-afb499a8.entry.js +0 -1
- package/dist/esm-es5/device-info-DpfVimRl.js +0 -1
- package/dist/esm-es5/image-picker-D0rFViUA.js +0 -1
- package/dist/esm-es5/video-capture-Xsjc8H75.js +0 -1
package/components/camera.js
CHANGED
|
@@ -120,7 +120,7 @@ const Camera = /*@__PURE__*/ proxyCustomElement(class Camera extends HTMLElement
|
|
|
120
120
|
async takePhoto() {
|
|
121
121
|
const { quality, width, height, file } = this;
|
|
122
122
|
const data = await cameraPreview.takePicture({ width, height, quality });
|
|
123
|
-
const result = imagePicker.formatPictureResult(file, data);
|
|
123
|
+
const result = await imagePicker.formatPictureResult(file, data);
|
|
124
124
|
this.pictures = [...this.pictures, result];
|
|
125
125
|
this.ctyTakePhoto.emit(result);
|
|
126
126
|
return result;
|
|
@@ -153,7 +153,7 @@ const Camera = /*@__PURE__*/ proxyCustomElement(class Camera extends HTMLElement
|
|
|
153
153
|
}
|
|
154
154
|
render() {
|
|
155
155
|
const { title, closeIcon, flash, flipText, flashText, ratioText, ratios, ratioIndex, zoomIndex, zooms, confirmIcon, confirmText, pictures, showImageViewer, imageViewerIndex } = this;
|
|
156
|
-
return (h(Host, { key: '
|
|
156
|
+
return (h(Host, { key: '6c0e8aee4840edae99979e2f8fa4fe1f28b91f00', class: "cty-camera", onClick: (e) => e.stopPropagation() }, h("cty-nav-bar", { key: '16ed59dc05921a634765cae7e3c8ab817a509b66', title: title, type: "clear" }, h("slot", { key: 'dbeb5240503757e7fb35741bfaacfee520e935c5', name: "header-start", slot: "start" }, h("ion-button", { key: 'e0258b6b06a50aa10d9903e6a4789d155b1a926b', class: "cty-camera__close", onClick: () => this.close() }, h("cty-icon", { key: '48c9f1c506dd13155e2545f1e4d5b8970886bb12', class: "cty-camera__close-icon", name: closeIcon })))), h("div", { key: 'a367e170321b0966ab490b9b694eaffe18fb8f6c', class: "cty-camera-widgets", part: "widgets" }, h("button", { key: '9f54e594fec181935c988f320158ce8f5754cd5c', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.flipCamera() }, h("cty-icon", { key: 'db2e97bd1ec69d82e93c9506fd8976cff560ed24', class: "cty-camera-widget__icon", name: "cty-flip" }), !!flipText && h("span", { key: '947fee726ab0e6c514747a2b2eadbf989f5ff91c', class: "cty-camera-widget__text" }, flipText)), h("button", { key: '01a10aae9e6745d83033ef5e4441cc3d7e199612', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.toggleFlash() }, h("cty-icon", { key: 'd2bd45656aa68309b40f8977e80b15ae7ec29e17', class: "cty-camera-widget__icon", name: flash ? 'cty-flash-on' : 'cty-flash-off' }), !!flashText && h("span", { key: 'b4f9d0d5675c6a21483f4bc211b92ba4e7a8f688', class: "cty-camera-widget__text" }, flashText)), h("button", { key: 'c36f3a4a1d6d2705ea7c52acb0281f18f7570de9', class: "cty-button-native cty-camera-widget", part: "ratio", onClick: () => this.ratioChange() }, h("span", { key: 'ac8cb010492f470ea5e776efa59d2e3b622c031b', class: "cty-camera-widget__ratio flex-center" }, ratios[ratioIndex]), !!ratioText && h("span", { key: 'fc2792dd4c5e27b4946db17fc05ca8d1f79ab475', class: "cty-camera-widget__text" }, ratioText))), h("div", { key: '2b6cb7cb689119162cba517b5469efdcf173e481', class: "cty-camera-controls safe-area-bottom-padding" }, h("slot", { key: '93ba0e977b61d5c5fdd0bd6ab220711064af826d', name: "zooms" }, h("div", { key: '2ea4da678fda37ba175c66a72e34fccf1974a521', class: "cty-camera-controls__zooms flex-center" }, zooms.map((item, idx) => (h("div", { class: { 'cty-camera-controls__zoom-item flex-center': true, 'cty-camera-controls__zoom-item__active': zoomIndex === idx }, onClick: () => this.setZoom(idx) }, h("span", { class: "cty-camera-controls__zoom-text flex-center" }, item, "X")))))), h("div", { key: '8f308406f2ceac48cd7cbfd4306a7a65aebce21f', class: "cty-camera-controls__main flex-center" }, h("div", { key: 'd3fc1707c8f6ee3d9f968f916e8a50810e580a4b', class: "cty-camera-controls__main-left flex-center" }), h("div", { key: 'fa7a8905a22006276b941693c26ac15e6b002976', class: "cty-camera-controls__take-photo flex-center" }, h("button", { key: '61536741582da9bef8bcf0fe4fba09e3fefde58e', class: "cty-button-native cty-camera-controls__take-photo-button", part: "take-photo", onClick: () => this.takePhoto() })), h("div", { key: '74ef21c9e62c7ac604b11b53f9b6a1126fa0338b', class: "cty-camera-controls__main-confirm flex-center" }, pictures.length > 0 && h("button", { key: 'c019b93aab832fadcb3e6d5c77bc98dd8e126b16', class: "cty-button-native flex-column-center", onClick: () => this.confirm() }, h("cty-icon", { key: 'eb9ae426c45fa31202247c99ebb991bc7ceede55', class: "cty-camera-controls__main-confirm-icon", name: confirmIcon }), h("span", { key: '25afa75bcbda33b8f15c432879712bdec937678c', class: "cty-camera-controls__main-confirm-text" }, confirmText)))), h("slot", { key: '14def885116f251bd8390313d46c661dcc807282', name: "images" }, h("div", { key: '254067237e7506f87bdc762285dc3eaff6591ed6', class: "cty-camera-controls__images flex-align-center" }, pictures.map((item, idx) => (h("div", { class: "cty-camera-controls__image", onClick: () => this.toImageViewer(idx) }, h("img", { class: 'cty-camera-controls__image-img', src: item.url }), h("button", { class: "cty-button-native", onClick: (e) => this.deletePicture(e, idx) }, h("cty-icon", { class: "cty-camera-controls__image-delete", name: closeOutline })))))))), showImageViewer && h("cty-image-viewer", { key: 'e84bcb7a5ce6cbb504dbe55e6538622d3914d334', images: pictures.map(item => item.url), initialSlide: imageViewerIndex, overlayIndex: 100, backdropDismiss: false, closeable: true, onCtyDismiss: (e) => this.closeImageViewer(e) })));
|
|
157
157
|
}
|
|
158
158
|
get el() { return this; }
|
|
159
159
|
static get style() { return cameraCss; }
|
|
@@ -2,9 +2,29 @@ import '@stencil/core/internal/client';
|
|
|
2
2
|
import { i as isPlatform } from './platform.js';
|
|
3
3
|
import { n as network } from './network.js';
|
|
4
4
|
|
|
5
|
-
const formatLocalPreview = (
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const formatLocalPreview = (filePath) => {
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
let path = filePath;
|
|
8
|
+
if (path.startsWith('/') ||
|
|
9
|
+
(!path.startsWith('file://')
|
|
10
|
+
&& !path.startsWith('http://')
|
|
11
|
+
&& !path.startsWith('https://')
|
|
12
|
+
&& !path.startsWith('content://')
|
|
13
|
+
&& !path.startsWith('ionic://')
|
|
14
|
+
&& !path.startsWith('app://')
|
|
15
|
+
&& !path.startsWith('cdvfile://'))) {
|
|
16
|
+
path = 'file://' + path;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
window.resolveLocalFileSystemURL(path, (entry) => {
|
|
20
|
+
resolve(entry.toURL());
|
|
21
|
+
}, reject);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
resolve(filePath);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
// return (window as any)?.Ionic?.WebView?.convertFileSrc(path);
|
|
8
28
|
};
|
|
9
29
|
function testUserAgent(expression) {
|
|
10
30
|
const nav = window.navigator;
|
|
@@ -112,11 +112,11 @@ class CTYImagePicker {
|
|
|
112
112
|
get isWxSDKAvailable() {
|
|
113
113
|
return !!this._wxSDK;
|
|
114
114
|
}
|
|
115
|
-
formatPictureResult(file, data) {
|
|
115
|
+
async formatPictureResult(file, data) {
|
|
116
116
|
let safeUrl = data;
|
|
117
117
|
if (file) {
|
|
118
118
|
try {
|
|
119
|
-
safeUrl = formatLocalPreview(data);
|
|
119
|
+
safeUrl = await formatLocalPreview(data);
|
|
120
120
|
safeUrl = sanitizeDOMString(safeUrl);
|
|
121
121
|
}
|
|
122
122
|
catch (error) {
|
|
@@ -148,18 +148,10 @@ class CTYImagePicker {
|
|
|
148
148
|
sourceType: this._cameraPlugin.PictureSourceType[camera ? 'CAMERA' : 'PHOTOLIBRARY'],
|
|
149
149
|
correctOrientation: false
|
|
150
150
|
};
|
|
151
|
-
this._cameraPlugin.getPicture((data) => {
|
|
151
|
+
this._cameraPlugin.getPicture(async (data) => {
|
|
152
152
|
if (data) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const result = this.formatPictureResult(file, entry.nativeURL);
|
|
156
|
-
resolve([result]);
|
|
157
|
-
}, reject);
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
const result = this.formatPictureResult(file, data);
|
|
161
|
-
resolve([result]);
|
|
162
|
-
}
|
|
153
|
+
const result = await this.formatPictureResult(file, data);
|
|
154
|
+
resolve([result]);
|
|
163
155
|
}
|
|
164
156
|
else {
|
|
165
157
|
resolve([]);
|
|
@@ -176,14 +168,16 @@ class CTYImagePicker {
|
|
|
176
168
|
const option = {
|
|
177
169
|
quality: 85
|
|
178
170
|
};
|
|
179
|
-
this._imagePickerPlugin.getPictures((results) => {
|
|
171
|
+
this._imagePickerPlugin.getPictures(async (results) => {
|
|
180
172
|
if (results[0] == 'O' || results[0] == 'K') {
|
|
181
173
|
resolve([]);
|
|
182
174
|
return;
|
|
183
175
|
}
|
|
184
|
-
const imageList =
|
|
185
|
-
|
|
186
|
-
|
|
176
|
+
const imageList = [];
|
|
177
|
+
for (const data of results) {
|
|
178
|
+
const result = await this.formatPictureResult(file, data);
|
|
179
|
+
imageList.push(result);
|
|
180
|
+
}
|
|
187
181
|
resolve(imageList);
|
|
188
182
|
}, (error) => { reject(error); }, Object.assign(option, imagePickerOptions, {
|
|
189
183
|
outputType: file ? 0 : 1,
|
|
@@ -15,10 +15,10 @@ class CTYVideoCapture {
|
|
|
15
15
|
return reject('Video capture plugin is not available.');
|
|
16
16
|
}
|
|
17
17
|
try {
|
|
18
|
-
this._videoCapturePlugin.captureVideo((result) => {
|
|
18
|
+
this._videoCapturePlugin.captureVideo(async (result) => {
|
|
19
19
|
if (Array.isArray(result) && result.length > 0) {
|
|
20
20
|
const data = result[0].fullPath;
|
|
21
|
-
const url = formatLocalPreview(sanitizeDOMString(data));
|
|
21
|
+
const url = await formatLocalPreview(sanitizeDOMString(data));
|
|
22
22
|
resolve({ url, data });
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DCK462Hl.js');
|
|
4
|
-
var imagePicker = require('./image-picker-
|
|
5
|
-
var deviceInfo = require('./device-info-
|
|
4
|
+
var imagePicker = require('./image-picker-z0grMzCR.js');
|
|
5
|
+
var deviceInfo = require('./device-info-tw8uyU3o.js');
|
|
6
6
|
var overlays = require('./overlays-Cfk4eti-.js');
|
|
7
7
|
var lockController = require('./lock-controller-Dk7it1jt.js');
|
|
8
8
|
var helpers = require('./helpers-Bdo8wX6-.js');
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DCK462Hl.js');
|
|
4
4
|
var cameraPreview = require('./camera-preview-BHobAi2K.js');
|
|
5
|
-
var imagePicker = require('./image-picker-
|
|
5
|
+
var imagePicker = require('./image-picker-z0grMzCR.js');
|
|
6
6
|
var index$1 = require('./index-o2Vg_VSe.js');
|
|
7
7
|
var dom = require('./dom-B8PDM5o-.js');
|
|
8
8
|
var format = require('./format-BSDO5P-c.js');
|
|
9
|
-
require('./device-info-
|
|
9
|
+
require('./device-info-tw8uyU3o.js');
|
|
10
10
|
require('./platform-DJmEyHMN.js');
|
|
11
11
|
require('./network-D7xvJurk.js');
|
|
12
12
|
require('./index-6rsnyV5b.js');
|
|
@@ -115,7 +115,7 @@ const Camera = class {
|
|
|
115
115
|
async takePhoto() {
|
|
116
116
|
const { quality, width, height, file } = this;
|
|
117
117
|
const data = await cameraPreview.cameraPreview.takePicture({ width, height, quality });
|
|
118
|
-
const result = imagePicker.imagePicker.formatPictureResult(file, data);
|
|
118
|
+
const result = await imagePicker.imagePicker.formatPictureResult(file, data);
|
|
119
119
|
this.pictures = [...this.pictures, result];
|
|
120
120
|
this.ctyTakePhoto.emit(result);
|
|
121
121
|
return result;
|
|
@@ -148,7 +148,7 @@ const Camera = class {
|
|
|
148
148
|
}
|
|
149
149
|
render() {
|
|
150
150
|
const { title, closeIcon, flash, flipText, flashText, ratioText, ratios, ratioIndex, zoomIndex, zooms, confirmIcon, confirmText, pictures, showImageViewer, imageViewerIndex } = this;
|
|
151
|
-
return (index.h(index.Host, { key: '
|
|
151
|
+
return (index.h(index.Host, { key: '6c0e8aee4840edae99979e2f8fa4fe1f28b91f00', class: "cty-camera", onClick: (e) => e.stopPropagation() }, index.h("cty-nav-bar", { key: '16ed59dc05921a634765cae7e3c8ab817a509b66', title: title, type: "clear" }, index.h("slot", { key: 'dbeb5240503757e7fb35741bfaacfee520e935c5', name: "header-start", slot: "start" }, index.h("ion-button", { key: 'e0258b6b06a50aa10d9903e6a4789d155b1a926b', class: "cty-camera__close", onClick: () => this.close() }, index.h("cty-icon", { key: '48c9f1c506dd13155e2545f1e4d5b8970886bb12', class: "cty-camera__close-icon", name: closeIcon })))), index.h("div", { key: 'a367e170321b0966ab490b9b694eaffe18fb8f6c', class: "cty-camera-widgets", part: "widgets" }, index.h("button", { key: '9f54e594fec181935c988f320158ce8f5754cd5c', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.flipCamera() }, index.h("cty-icon", { key: 'db2e97bd1ec69d82e93c9506fd8976cff560ed24', class: "cty-camera-widget__icon", name: "cty-flip" }), !!flipText && index.h("span", { key: '947fee726ab0e6c514747a2b2eadbf989f5ff91c', class: "cty-camera-widget__text" }, flipText)), index.h("button", { key: '01a10aae9e6745d83033ef5e4441cc3d7e199612', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.toggleFlash() }, index.h("cty-icon", { key: 'd2bd45656aa68309b40f8977e80b15ae7ec29e17', class: "cty-camera-widget__icon", name: flash ? 'cty-flash-on' : 'cty-flash-off' }), !!flashText && index.h("span", { key: 'b4f9d0d5675c6a21483f4bc211b92ba4e7a8f688', class: "cty-camera-widget__text" }, flashText)), index.h("button", { key: 'c36f3a4a1d6d2705ea7c52acb0281f18f7570de9', class: "cty-button-native cty-camera-widget", part: "ratio", onClick: () => this.ratioChange() }, index.h("span", { key: 'ac8cb010492f470ea5e776efa59d2e3b622c031b', class: "cty-camera-widget__ratio flex-center" }, ratios[ratioIndex]), !!ratioText && index.h("span", { key: 'fc2792dd4c5e27b4946db17fc05ca8d1f79ab475', class: "cty-camera-widget__text" }, ratioText))), index.h("div", { key: '2b6cb7cb689119162cba517b5469efdcf173e481', class: "cty-camera-controls safe-area-bottom-padding" }, index.h("slot", { key: '93ba0e977b61d5c5fdd0bd6ab220711064af826d', name: "zooms" }, index.h("div", { key: '2ea4da678fda37ba175c66a72e34fccf1974a521', class: "cty-camera-controls__zooms flex-center" }, zooms.map((item, idx) => (index.h("div", { class: { 'cty-camera-controls__zoom-item flex-center': true, 'cty-camera-controls__zoom-item__active': zoomIndex === idx }, onClick: () => this.setZoom(idx) }, index.h("span", { class: "cty-camera-controls__zoom-text flex-center" }, item, "X")))))), index.h("div", { key: '8f308406f2ceac48cd7cbfd4306a7a65aebce21f', class: "cty-camera-controls__main flex-center" }, index.h("div", { key: 'd3fc1707c8f6ee3d9f968f916e8a50810e580a4b', class: "cty-camera-controls__main-left flex-center" }), index.h("div", { key: 'fa7a8905a22006276b941693c26ac15e6b002976', class: "cty-camera-controls__take-photo flex-center" }, index.h("button", { key: '61536741582da9bef8bcf0fe4fba09e3fefde58e', class: "cty-button-native cty-camera-controls__take-photo-button", part: "take-photo", onClick: () => this.takePhoto() })), index.h("div", { key: '74ef21c9e62c7ac604b11b53f9b6a1126fa0338b', class: "cty-camera-controls__main-confirm flex-center" }, pictures.length > 0 && index.h("button", { key: 'c019b93aab832fadcb3e6d5c77bc98dd8e126b16', class: "cty-button-native flex-column-center", onClick: () => this.confirm() }, index.h("cty-icon", { key: 'eb9ae426c45fa31202247c99ebb991bc7ceede55', class: "cty-camera-controls__main-confirm-icon", name: confirmIcon }), index.h("span", { key: '25afa75bcbda33b8f15c432879712bdec937678c', class: "cty-camera-controls__main-confirm-text" }, confirmText)))), index.h("slot", { key: '14def885116f251bd8390313d46c661dcc807282', name: "images" }, index.h("div", { key: '254067237e7506f87bdc762285dc3eaff6591ed6', class: "cty-camera-controls__images flex-align-center" }, pictures.map((item, idx) => (index.h("div", { class: "cty-camera-controls__image", onClick: () => this.toImageViewer(idx) }, index.h("img", { class: 'cty-camera-controls__image-img', src: item.url }), index.h("button", { class: "cty-button-native", onClick: (e) => this.deletePicture(e, idx) }, index.h("cty-icon", { class: "cty-camera-controls__image-delete", name: index$1.closeOutline })))))))), showImageViewer && index.h("cty-image-viewer", { key: 'e84bcb7a5ce6cbb504dbe55e6538622d3914d334', images: pictures.map(item => item.url), initialSlide: imageViewerIndex, overlayIndex: 100, backdropDismiss: false, closeable: true, onCtyDismiss: (e) => this.closeImageViewer(e) })));
|
|
152
152
|
}
|
|
153
153
|
get el() { return index.getElement(this); }
|
|
154
154
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DCK462Hl.js');
|
|
4
|
-
var deviceInfo = require('./device-info-
|
|
4
|
+
var deviceInfo = require('./device-info-tw8uyU3o.js');
|
|
5
5
|
var format = require('./format-BSDO5P-c.js');
|
|
6
6
|
require('./platform-DJmEyHMN.js');
|
|
7
7
|
require('./network-D7xvJurk.js');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DCK462Hl.js');
|
|
4
4
|
var keyboard = require('./keyboard-Cuk4m847.js');
|
|
5
|
-
var deviceInfo = require('./device-info-
|
|
5
|
+
var deviceInfo = require('./device-info-tw8uyU3o.js');
|
|
6
6
|
require('./network-D7xvJurk.js');
|
|
7
7
|
require('./platform-DJmEyHMN.js');
|
|
8
8
|
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DCK462Hl.js');
|
|
4
4
|
var statusBar = require('./status-bar-1jhnFEuR.js');
|
|
5
|
-
var videoCapture = require('./video-capture-
|
|
5
|
+
var videoCapture = require('./video-capture-y5hiX1MC.js');
|
|
6
6
|
var index$1 = require('./index-o2Vg_VSe.js');
|
|
7
7
|
require('./config-Bn2x7PFv.js');
|
|
8
8
|
require('./format-BSDO5P-c.js');
|
|
9
9
|
require('./index-6rsnyV5b.js');
|
|
10
|
-
require('./device-info-
|
|
10
|
+
require('./device-info-tw8uyU3o.js');
|
|
11
11
|
require('./platform-DJmEyHMN.js');
|
|
12
12
|
require('./network-D7xvJurk.js');
|
|
13
13
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DCK462Hl.js');
|
|
4
|
-
var deviceInfo = require('./device-info-
|
|
5
|
-
var audioRecorder = require('./audio-recorder-
|
|
4
|
+
var deviceInfo = require('./device-info-tw8uyU3o.js');
|
|
5
|
+
var audioRecorder = require('./audio-recorder-DD-m7fzZ.js');
|
|
6
6
|
var overlays = require('./overlays-Cfk4eti-.js');
|
|
7
7
|
var lockController = require('./lock-controller-Dk7it1jt.js');
|
|
8
8
|
var helpers = require('./helpers-Bdo8wX6-.js');
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DCK462Hl.js');
|
|
4
4
|
var config = require('./config-Bn2x7PFv.js');
|
|
5
|
-
var deviceInfo = require('./device-info-
|
|
6
|
-
var share = require('./share-
|
|
5
|
+
var deviceInfo = require('./device-info-tw8uyU3o.js');
|
|
6
|
+
var share = require('./share-CEJHAXCK.js');
|
|
7
7
|
var utils = require('./utils-C8Ez-9Oe.js');
|
|
8
8
|
var overlays = require('./overlays-Cfk4eti-.js');
|
|
9
9
|
var lockController = require('./lock-controller-Dk7it1jt.js');
|
|
@@ -5,7 +5,7 @@ var dom = require('./dom-B8PDM5o-.js');
|
|
|
5
5
|
var statusBar = require('./status-bar-1jhnFEuR.js');
|
|
6
6
|
var volumeControl = require('./volume-control-CPf0zISh.js');
|
|
7
7
|
var network = require('./network-D7xvJurk.js');
|
|
8
|
-
var deviceInfo = require('./device-info-
|
|
8
|
+
var deviceInfo = require('./device-info-tw8uyU3o.js');
|
|
9
9
|
var config = require('./config-Bn2x7PFv.js');
|
|
10
10
|
var index$1 = require('./index-o2Vg_VSe.js');
|
|
11
11
|
var platform = require('./platform-DJmEyHMN.js');
|
|
@@ -4,9 +4,29 @@ require('./index-DCK462Hl.js');
|
|
|
4
4
|
var platform = require('./platform-DJmEyHMN.js');
|
|
5
5
|
var network = require('./network-D7xvJurk.js');
|
|
6
6
|
|
|
7
|
-
const formatLocalPreview = (
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const formatLocalPreview = (filePath) => {
|
|
8
|
+
return new Promise((resolve, reject) => {
|
|
9
|
+
let path = filePath;
|
|
10
|
+
if (path.startsWith('/') ||
|
|
11
|
+
(!path.startsWith('file://')
|
|
12
|
+
&& !path.startsWith('http://')
|
|
13
|
+
&& !path.startsWith('https://')
|
|
14
|
+
&& !path.startsWith('content://')
|
|
15
|
+
&& !path.startsWith('ionic://')
|
|
16
|
+
&& !path.startsWith('app://')
|
|
17
|
+
&& !path.startsWith('cdvfile://'))) {
|
|
18
|
+
path = 'file://' + path;
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
window.resolveLocalFileSystemURL(path, (entry) => {
|
|
22
|
+
resolve(entry.toURL());
|
|
23
|
+
}, reject);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
resolve(filePath);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
// return (window as any)?.Ionic?.WebView?.convertFileSrc(path);
|
|
10
30
|
};
|
|
11
31
|
function testUserAgent(expression) {
|
|
12
32
|
const nav = window.navigator;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var deviceInfo = require('./device-info-
|
|
3
|
+
var deviceInfo = require('./device-info-tw8uyU3o.js');
|
|
4
4
|
var index = require('./index-6rsnyV5b.js');
|
|
5
5
|
|
|
6
6
|
exports.MediaSourceType = void 0;
|
|
@@ -48,11 +48,11 @@ class CTYImagePicker {
|
|
|
48
48
|
get isWxSDKAvailable() {
|
|
49
49
|
return !!this._wxSDK;
|
|
50
50
|
}
|
|
51
|
-
formatPictureResult(file, data) {
|
|
51
|
+
async formatPictureResult(file, data) {
|
|
52
52
|
let safeUrl = data;
|
|
53
53
|
if (file) {
|
|
54
54
|
try {
|
|
55
|
-
safeUrl = deviceInfo.formatLocalPreview(data);
|
|
55
|
+
safeUrl = await deviceInfo.formatLocalPreview(data);
|
|
56
56
|
safeUrl = index.sanitizeDOMString(safeUrl);
|
|
57
57
|
}
|
|
58
58
|
catch (error) {
|
|
@@ -84,18 +84,10 @@ class CTYImagePicker {
|
|
|
84
84
|
sourceType: this._cameraPlugin.PictureSourceType[camera ? 'CAMERA' : 'PHOTOLIBRARY'],
|
|
85
85
|
correctOrientation: false
|
|
86
86
|
};
|
|
87
|
-
this._cameraPlugin.getPicture((data) => {
|
|
87
|
+
this._cameraPlugin.getPicture(async (data) => {
|
|
88
88
|
if (data) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const result = this.formatPictureResult(file, entry.nativeURL);
|
|
92
|
-
resolve([result]);
|
|
93
|
-
}, reject);
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
const result = this.formatPictureResult(file, data);
|
|
97
|
-
resolve([result]);
|
|
98
|
-
}
|
|
89
|
+
const result = await this.formatPictureResult(file, data);
|
|
90
|
+
resolve([result]);
|
|
99
91
|
}
|
|
100
92
|
else {
|
|
101
93
|
resolve([]);
|
|
@@ -112,14 +104,16 @@ class CTYImagePicker {
|
|
|
112
104
|
const option = {
|
|
113
105
|
quality: 85
|
|
114
106
|
};
|
|
115
|
-
this._imagePickerPlugin.getPictures((results) => {
|
|
107
|
+
this._imagePickerPlugin.getPictures(async (results) => {
|
|
116
108
|
if (results[0] == 'O' || results[0] == 'K') {
|
|
117
109
|
resolve([]);
|
|
118
110
|
return;
|
|
119
111
|
}
|
|
120
|
-
const imageList =
|
|
121
|
-
|
|
122
|
-
|
|
112
|
+
const imageList = [];
|
|
113
|
+
for (const data of results) {
|
|
114
|
+
const result = await this.formatPictureResult(file, data);
|
|
115
|
+
imageList.push(result);
|
|
116
|
+
}
|
|
123
117
|
resolve(imageList);
|
|
124
118
|
}, (error) => { reject(error); }, Object.assign(option, imagePickerOptions, {
|
|
125
119
|
outputType: file ? 0 : 1,
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -9,15 +9,15 @@ var dom = require('./dom-B8PDM5o-.js');
|
|
|
9
9
|
var format = require('./format-BSDO5P-c.js');
|
|
10
10
|
var utils = require('./utils-C8Ez-9Oe.js');
|
|
11
11
|
var validate = require('./validate-Bad0X9vv.js');
|
|
12
|
-
var audioRecorder = require('./audio-recorder-
|
|
12
|
+
var audioRecorder = require('./audio-recorder-DD-m7fzZ.js');
|
|
13
13
|
var cameraPreview = require('./camera-preview-BHobAi2K.js');
|
|
14
|
-
var deviceInfo = require('./device-info-
|
|
15
|
-
var imagePicker = require('./image-picker-
|
|
14
|
+
var deviceInfo = require('./device-info-tw8uyU3o.js');
|
|
15
|
+
var imagePicker = require('./image-picker-z0grMzCR.js');
|
|
16
16
|
var keyboard = require('./keyboard-Cuk4m847.js');
|
|
17
17
|
var network = require('./network-D7xvJurk.js');
|
|
18
18
|
var volumeControl = require('./volume-control-CPf0zISh.js');
|
|
19
|
-
var share = require('./share-
|
|
20
|
-
var videoCapture = require('./video-capture-
|
|
19
|
+
var share = require('./share-CEJHAXCK.js');
|
|
20
|
+
var videoCapture = require('./video-capture-y5hiX1MC.js');
|
|
21
21
|
var ctyMuiGlobal = require('./cty-mui-global-CQI_F108.js');
|
|
22
22
|
var overlays = require('./overlays-Cfk4eti-.js');
|
|
23
23
|
require('./index-D3mJ1Cix.js');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-6rsnyV5b.js');
|
|
4
|
-
var deviceInfo = require('./device-info-
|
|
4
|
+
var deviceInfo = require('./device-info-tw8uyU3o.js');
|
|
5
5
|
|
|
6
6
|
class CTYVideoCapture {
|
|
7
7
|
get _videoCapturePlugin() {
|
|
@@ -17,10 +17,10 @@ class CTYVideoCapture {
|
|
|
17
17
|
return reject('Video capture plugin is not available.');
|
|
18
18
|
}
|
|
19
19
|
try {
|
|
20
|
-
this._videoCapturePlugin.captureVideo((result) => {
|
|
20
|
+
this._videoCapturePlugin.captureVideo(async (result) => {
|
|
21
21
|
if (Array.isArray(result) && result.length > 0) {
|
|
22
22
|
const data = result[0].fullPath;
|
|
23
|
-
const url = deviceInfo.formatLocalPreview(index.sanitizeDOMString(data));
|
|
23
|
+
const url = await deviceInfo.formatLocalPreview(index.sanitizeDOMString(data));
|
|
24
24
|
resolve({ url, data });
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
@@ -102,7 +102,7 @@ export class Camera {
|
|
|
102
102
|
async takePhoto() {
|
|
103
103
|
const { quality, width, height, file } = this;
|
|
104
104
|
const data = await cameraPreview.takePicture({ width, height, quality });
|
|
105
|
-
const result = imagePicker.formatPictureResult(file, data);
|
|
105
|
+
const result = await imagePicker.formatPictureResult(file, data);
|
|
106
106
|
this.pictures = [...this.pictures, result];
|
|
107
107
|
this.ctyTakePhoto.emit(result);
|
|
108
108
|
return result;
|
|
@@ -135,7 +135,7 @@ export class Camera {
|
|
|
135
135
|
}
|
|
136
136
|
render() {
|
|
137
137
|
const { title, closeIcon, flash, flipText, flashText, ratioText, ratios, ratioIndex, zoomIndex, zooms, confirmIcon, confirmText, pictures, showImageViewer, imageViewerIndex } = this;
|
|
138
|
-
return (h(Host, { key: '
|
|
138
|
+
return (h(Host, { key: '6c0e8aee4840edae99979e2f8fa4fe1f28b91f00', class: "cty-camera", onClick: (e) => e.stopPropagation() }, h("cty-nav-bar", { key: '16ed59dc05921a634765cae7e3c8ab817a509b66', title: title, type: "clear" }, h("slot", { key: 'dbeb5240503757e7fb35741bfaacfee520e935c5', name: "header-start", slot: "start" }, h("ion-button", { key: 'e0258b6b06a50aa10d9903e6a4789d155b1a926b', class: "cty-camera__close", onClick: () => this.close() }, h("cty-icon", { key: '48c9f1c506dd13155e2545f1e4d5b8970886bb12', class: "cty-camera__close-icon", name: closeIcon })))), h("div", { key: 'a367e170321b0966ab490b9b694eaffe18fb8f6c', class: "cty-camera-widgets", part: "widgets" }, h("button", { key: '9f54e594fec181935c988f320158ce8f5754cd5c', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.flipCamera() }, h("cty-icon", { key: 'db2e97bd1ec69d82e93c9506fd8976cff560ed24', class: "cty-camera-widget__icon", name: "cty-flip" }), !!flipText && h("span", { key: '947fee726ab0e6c514747a2b2eadbf989f5ff91c', class: "cty-camera-widget__text" }, flipText)), h("button", { key: '01a10aae9e6745d83033ef5e4441cc3d7e199612', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.toggleFlash() }, h("cty-icon", { key: 'd2bd45656aa68309b40f8977e80b15ae7ec29e17', class: "cty-camera-widget__icon", name: flash ? 'cty-flash-on' : 'cty-flash-off' }), !!flashText && h("span", { key: 'b4f9d0d5675c6a21483f4bc211b92ba4e7a8f688', class: "cty-camera-widget__text" }, flashText)), h("button", { key: 'c36f3a4a1d6d2705ea7c52acb0281f18f7570de9', class: "cty-button-native cty-camera-widget", part: "ratio", onClick: () => this.ratioChange() }, h("span", { key: 'ac8cb010492f470ea5e776efa59d2e3b622c031b', class: "cty-camera-widget__ratio flex-center" }, ratios[ratioIndex]), !!ratioText && h("span", { key: 'fc2792dd4c5e27b4946db17fc05ca8d1f79ab475', class: "cty-camera-widget__text" }, ratioText))), h("div", { key: '2b6cb7cb689119162cba517b5469efdcf173e481', class: "cty-camera-controls safe-area-bottom-padding" }, h("slot", { key: '93ba0e977b61d5c5fdd0bd6ab220711064af826d', name: "zooms" }, h("div", { key: '2ea4da678fda37ba175c66a72e34fccf1974a521', class: "cty-camera-controls__zooms flex-center" }, zooms.map((item, idx) => (h("div", { class: { 'cty-camera-controls__zoom-item flex-center': true, 'cty-camera-controls__zoom-item__active': zoomIndex === idx }, onClick: () => this.setZoom(idx) }, h("span", { class: "cty-camera-controls__zoom-text flex-center" }, item, "X")))))), h("div", { key: '8f308406f2ceac48cd7cbfd4306a7a65aebce21f', class: "cty-camera-controls__main flex-center" }, h("div", { key: 'd3fc1707c8f6ee3d9f968f916e8a50810e580a4b', class: "cty-camera-controls__main-left flex-center" }), h("div", { key: 'fa7a8905a22006276b941693c26ac15e6b002976', class: "cty-camera-controls__take-photo flex-center" }, h("button", { key: '61536741582da9bef8bcf0fe4fba09e3fefde58e', class: "cty-button-native cty-camera-controls__take-photo-button", part: "take-photo", onClick: () => this.takePhoto() })), h("div", { key: '74ef21c9e62c7ac604b11b53f9b6a1126fa0338b', class: "cty-camera-controls__main-confirm flex-center" }, pictures.length > 0 && h("button", { key: 'c019b93aab832fadcb3e6d5c77bc98dd8e126b16', class: "cty-button-native flex-column-center", onClick: () => this.confirm() }, h("cty-icon", { key: 'eb9ae426c45fa31202247c99ebb991bc7ceede55', class: "cty-camera-controls__main-confirm-icon", name: confirmIcon }), h("span", { key: '25afa75bcbda33b8f15c432879712bdec937678c', class: "cty-camera-controls__main-confirm-text" }, confirmText)))), h("slot", { key: '14def885116f251bd8390313d46c661dcc807282', name: "images" }, h("div", { key: '254067237e7506f87bdc762285dc3eaff6591ed6', class: "cty-camera-controls__images flex-align-center" }, pictures.map((item, idx) => (h("div", { class: "cty-camera-controls__image", onClick: () => this.toImageViewer(idx) }, h("img", { class: 'cty-camera-controls__image-img', src: item.url }), h("button", { class: "cty-button-native", onClick: (e) => this.deletePicture(e, idx) }, h("cty-icon", { class: "cty-camera-controls__image-delete", name: closeOutline })))))))), showImageViewer && h("cty-image-viewer", { key: 'e84bcb7a5ce6cbb504dbe55e6538622d3914d334', images: pictures.map(item => item.url), initialSlide: imageViewerIndex, overlayIndex: 100, backdropDismiss: false, closeable: true, onCtyDismiss: (e) => this.closeImageViewer(e) })));
|
|
139
139
|
}
|
|
140
140
|
static get is() { return "cty-camera"; }
|
|
141
141
|
static get encapsulation() { return "shadow"; }
|
|
@@ -46,11 +46,11 @@ export class CTYImagePicker {
|
|
|
46
46
|
get isWxSDKAvailable() {
|
|
47
47
|
return !!this._wxSDK;
|
|
48
48
|
}
|
|
49
|
-
formatPictureResult(file, data) {
|
|
49
|
+
async formatPictureResult(file, data) {
|
|
50
50
|
let safeUrl = data;
|
|
51
51
|
if (file) {
|
|
52
52
|
try {
|
|
53
|
-
safeUrl = formatLocalPreview(data);
|
|
53
|
+
safeUrl = await formatLocalPreview(data);
|
|
54
54
|
safeUrl = sanitizeDOMString(safeUrl);
|
|
55
55
|
}
|
|
56
56
|
catch (error) {
|
|
@@ -82,18 +82,10 @@ export class CTYImagePicker {
|
|
|
82
82
|
sourceType: this._cameraPlugin.PictureSourceType[camera ? 'CAMERA' : 'PHOTOLIBRARY'],
|
|
83
83
|
correctOrientation: false
|
|
84
84
|
};
|
|
85
|
-
this._cameraPlugin.getPicture((data) => {
|
|
85
|
+
this._cameraPlugin.getPicture(async (data) => {
|
|
86
86
|
if (data) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const result = this.formatPictureResult(file, entry.nativeURL);
|
|
90
|
-
resolve([result]);
|
|
91
|
-
}, reject);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
const result = this.formatPictureResult(file, data);
|
|
95
|
-
resolve([result]);
|
|
96
|
-
}
|
|
87
|
+
const result = await this.formatPictureResult(file, data);
|
|
88
|
+
resolve([result]);
|
|
97
89
|
}
|
|
98
90
|
else {
|
|
99
91
|
resolve([]);
|
|
@@ -110,14 +102,16 @@ export class CTYImagePicker {
|
|
|
110
102
|
const option = {
|
|
111
103
|
quality: 85
|
|
112
104
|
};
|
|
113
|
-
this._imagePickerPlugin.getPictures((results) => {
|
|
105
|
+
this._imagePickerPlugin.getPictures(async (results) => {
|
|
114
106
|
if (results[0] == 'O' || results[0] == 'K') {
|
|
115
107
|
resolve([]);
|
|
116
108
|
return;
|
|
117
109
|
}
|
|
118
|
-
const imageList =
|
|
119
|
-
|
|
120
|
-
|
|
110
|
+
const imageList = [];
|
|
111
|
+
for (const data of results) {
|
|
112
|
+
const result = await this.formatPictureResult(file, data);
|
|
113
|
+
imageList.push(result);
|
|
114
|
+
}
|
|
121
115
|
resolve(imageList);
|
|
122
116
|
}, (error) => { reject(error); }, Object.assign(option, imagePickerOptions, {
|
|
123
117
|
outputType: file ? 0 : 1,
|
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
import { deviceInfo } from "./device-info";
|
|
2
|
-
export const formatLocalPreview = (
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export const formatLocalPreview = (filePath) => {
|
|
3
|
+
return new Promise((resolve, reject) => {
|
|
4
|
+
let path = filePath;
|
|
5
|
+
if (path.startsWith('/') ||
|
|
6
|
+
(!path.startsWith('file://')
|
|
7
|
+
&& !path.startsWith('http://')
|
|
8
|
+
&& !path.startsWith('https://')
|
|
9
|
+
&& !path.startsWith('content://')
|
|
10
|
+
&& !path.startsWith('ionic://')
|
|
11
|
+
&& !path.startsWith('app://')
|
|
12
|
+
&& !path.startsWith('cdvfile://'))) {
|
|
13
|
+
path = 'file://' + path;
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
window.resolveLocalFileSystemURL(path, (entry) => {
|
|
17
|
+
resolve(entry.toURL());
|
|
18
|
+
}, reject);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
resolve(filePath);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
// return (window as any)?.Ionic?.WebView?.convertFileSrc(path);
|
|
5
25
|
};
|
|
6
26
|
export function testUserAgent(expression) {
|
|
7
27
|
const nav = window.navigator;
|
|
@@ -14,10 +14,10 @@ export class CTYVideoCapture {
|
|
|
14
14
|
return reject('Video capture plugin is not available.');
|
|
15
15
|
}
|
|
16
16
|
try {
|
|
17
|
-
this._videoCapturePlugin.captureVideo((result) => {
|
|
17
|
+
this._videoCapturePlugin.captureVideo(async (result) => {
|
|
18
18
|
if (Array.isArray(result) && result.length > 0) {
|
|
19
19
|
const data = result[0].fullPath;
|
|
20
|
-
const url = formatLocalPreview(sanitizeDOMString(data));
|
|
20
|
+
const url = await formatLocalPreview(sanitizeDOMString(data));
|
|
21
21
|
resolve({ url, data });
|
|
22
22
|
}
|
|
23
23
|
else {
|