aio-capacitor 2.2.4 → 2.3.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/index.d.ts +2 -14
- package/index.js +7 -46
- package/package.json +1 -2
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LocationData } from 'aio-capacitor-bglocation';
|
|
1
|
+
import { type LocationData } from 'aio-capacitor-bglocation';
|
|
2
2
|
export type I_speak = {
|
|
3
3
|
text: string;
|
|
4
4
|
lang?: 'fa-IR' | 'en-US';
|
|
@@ -54,18 +54,6 @@ export declare class AIOCapacitor {
|
|
|
54
54
|
uriToSrc: (uri: string) => Promise<any>;
|
|
55
55
|
pathToUri: (path: string, directory: Directory) => Promise<any>;
|
|
56
56
|
pathToSrc: (path: string, directory: Directory) => Promise<any>;
|
|
57
|
-
pickFolder: (extensions?: string[]) => Promise<{
|
|
58
|
-
files: {
|
|
59
|
-
filePath: string;
|
|
60
|
-
fileName: string;
|
|
61
|
-
}[];
|
|
62
|
-
folderPath: string;
|
|
63
|
-
}>;
|
|
64
|
-
getFolderFiles: (folderPath: string, extensions: string[]) => Promise<false | ({
|
|
65
|
-
filePath: string;
|
|
66
|
-
fileName: string;
|
|
67
|
-
}[])>;
|
|
68
|
-
openFile: (filePath: string) => Promise<void>;
|
|
69
57
|
isFileExist: (path: string, location?: 'Data' | 'Documents' | 'Cache') => Promise<boolean>;
|
|
70
58
|
readFile: (path: string, def: any, options?: {
|
|
71
59
|
location?: 'Data' | 'Documents' | 'Cache';
|
|
@@ -90,7 +78,6 @@ export declare class AIOCapacitor {
|
|
|
90
78
|
success: boolean;
|
|
91
79
|
error: any;
|
|
92
80
|
}>;
|
|
93
|
-
getExtensions: (type: 'image' | 'audio' | 'video') => string[];
|
|
94
81
|
shareFile: (file: Blob | File, fileName?: string) => Promise<any>;
|
|
95
82
|
getLocation: () => Promise<{
|
|
96
83
|
success: boolean;
|
|
@@ -195,6 +182,7 @@ export declare class Tracker {
|
|
|
195
182
|
pos?: [number, number];
|
|
196
183
|
}) => void;
|
|
197
184
|
interval: any;
|
|
185
|
+
isNative: boolean;
|
|
198
186
|
constructor(p: {
|
|
199
187
|
token: string;
|
|
200
188
|
url: string;
|
package/index.js
CHANGED
|
@@ -19,7 +19,6 @@ import { Haptics, ImpactStyle } from '@capacitor/haptics';
|
|
|
19
19
|
import { Share } from '@capacitor/share';
|
|
20
20
|
import { LocalNotifications } from '@capacitor/local-notifications';
|
|
21
21
|
import { KeepAwake } from '@capacitor-community/keep-awake';
|
|
22
|
-
import { FolderPicker } from 'aio-capacitor-folder-picker';
|
|
23
22
|
import { FileClass, GenerateId, GetRandomNumber } from 'aio-class';
|
|
24
23
|
import { Example } from 'aio-capacitor-bglocation';
|
|
25
24
|
export class AIOCapacitor {
|
|
@@ -27,7 +26,7 @@ export class AIOCapacitor {
|
|
|
27
26
|
this.logs = new Logs({
|
|
28
27
|
load: () => __awaiter(this, void 0, void 0, function* () {
|
|
29
28
|
try {
|
|
30
|
-
const storageRes = yield this.readFile('logs.json', { location: "Data", utf8: true });
|
|
29
|
+
const storageRes = yield this.readFile('logs.json', [], { location: "Data", utf8: true, writeDef: true });
|
|
31
30
|
const res = JSON.parse(storageRes);
|
|
32
31
|
return res;
|
|
33
32
|
}
|
|
@@ -72,7 +71,7 @@ export class AIOCapacitor {
|
|
|
72
71
|
console.error('Haptics pattern error:', err);
|
|
73
72
|
}
|
|
74
73
|
});
|
|
75
|
-
this.vibrateImpact = (
|
|
74
|
+
this.vibrateImpact = (style = 'medium') => __awaiter(this, void 0, void 0, function* () {
|
|
76
75
|
try {
|
|
77
76
|
const map = {
|
|
78
77
|
light: ImpactStyle.Light,
|
|
@@ -177,28 +176,6 @@ export class AIOCapacitor {
|
|
|
177
176
|
this.uriToSrc = (uri) => __awaiter(this, void 0, void 0, function* () { return Capacitor.convertFileSrc(uri); });
|
|
178
177
|
this.pathToUri = (path, directory) => __awaiter(this, void 0, void 0, function* () { return (yield Filesystem.getUri({ path, directory })).uri; });
|
|
179
178
|
this.pathToSrc = (path, directory) => __awaiter(this, void 0, void 0, function* () { return yield this.uriToSrc(yield this.pathToUri(path, directory)); });
|
|
180
|
-
this.pickFolder = (extensions) => __awaiter(this, void 0, void 0, function* () {
|
|
181
|
-
const { folderPath, files } = yield FolderPicker.pickFolder(extensions ? { extensions } : undefined);
|
|
182
|
-
return { folderPath, files };
|
|
183
|
-
});
|
|
184
|
-
this.getFolderFiles = (folderPath, extensions) => __awaiter(this, void 0, void 0, function* () {
|
|
185
|
-
try {
|
|
186
|
-
const res = yield FolderPicker.getFolderFiles({ folderPath, extensions });
|
|
187
|
-
return res.files;
|
|
188
|
-
}
|
|
189
|
-
catch (error) {
|
|
190
|
-
alert("updateFolder error:" + String(error));
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
this.openFile = (filePath) => __awaiter(this, void 0, void 0, function* () {
|
|
195
|
-
try {
|
|
196
|
-
yield FolderPicker.openFile({ filePath });
|
|
197
|
-
}
|
|
198
|
-
catch (error) {
|
|
199
|
-
alert(`Open file error:\n${String(error)}`);
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
179
|
this.isFileExist = (path, location) => __awaiter(this, void 0, void 0, function* () {
|
|
203
180
|
try {
|
|
204
181
|
yield Filesystem.stat({ path, directory: this.getDirectory(location) });
|
|
@@ -271,27 +248,7 @@ export class AIOCapacitor {
|
|
|
271
248
|
return { success: false, error: (err === null || err === void 0 ? void 0 : err.message) || err };
|
|
272
249
|
}
|
|
273
250
|
});
|
|
274
|
-
this.
|
|
275
|
-
const extensions = {
|
|
276
|
-
image: [
|
|
277
|
-
'jpg', 'jpeg', 'png', 'gif', 'webp',
|
|
278
|
-
'bmp', 'svg', 'ico', 'tiff', 'tif', 'avif'
|
|
279
|
-
],
|
|
280
|
-
audio: [
|
|
281
|
-
'mp3', 'wav', 'flac', 'aac', 'm4a',
|
|
282
|
-
'ogg', 'oga', 'opus', 'wma', 'aiff', 'aif',
|
|
283
|
-
'alac', 'amr', 'mid', 'midi'
|
|
284
|
-
],
|
|
285
|
-
video: [
|
|
286
|
-
'mp4', 'webm', 'mkv', 'avi', 'mov',
|
|
287
|
-
'wmv', 'flv', 'm4v', '3gp', '3g2',
|
|
288
|
-
'mpeg', 'mpg', 'mts', 'm2ts', 'ts',
|
|
289
|
-
'ogv', 'vob'
|
|
290
|
-
]
|
|
291
|
-
};
|
|
292
|
-
return extensions[type];
|
|
293
|
-
};
|
|
294
|
-
this.shareFile = (file_1, ...args_2) => __awaiter(this, [file_1, ...args_2], void 0, function* (file, fileName = `file_${Date.now()}`) {
|
|
251
|
+
this.shareFile = (file, fileName = `file_${Date.now()}`) => __awaiter(this, void 0, void 0, function* () {
|
|
295
252
|
try {
|
|
296
253
|
const res = yield new FileClass().toDataUrl(file);
|
|
297
254
|
if (!res.success) {
|
|
@@ -679,6 +636,9 @@ export class Tracker {
|
|
|
679
636
|
this.listener = null;
|
|
680
637
|
this.cap = new AIOCapacitor();
|
|
681
638
|
this.init = () => __awaiter(this, void 0, void 0, function* () {
|
|
639
|
+
if (!this.isNative) {
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
682
642
|
const hasPermission = yield this.getPermissions();
|
|
683
643
|
this.changeStatus({ hasPermission });
|
|
684
644
|
this.interval = window.setInterval(() => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -760,6 +720,7 @@ export class Tracker {
|
|
|
760
720
|
this.onAdd = p.onAdd;
|
|
761
721
|
this.changeStatus = p.changeStatus;
|
|
762
722
|
this.init();
|
|
723
|
+
this.isNative = this.cap.isNative();
|
|
763
724
|
}
|
|
764
725
|
getMock() {
|
|
765
726
|
const testLogs = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aio-capacitor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"@capacitor/preferences": "latest",
|
|
21
21
|
"@capacitor/push-notifications": "latest",
|
|
22
22
|
"@capacitor/share": "latest",
|
|
23
|
-
"aio-capacitor-folder-picker":"latest",
|
|
24
23
|
"aio-class":"latest"
|
|
25
24
|
},
|
|
26
25
|
"repository": {
|