@capgo/capacitor-downloader 7.0.21 → 7.1.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 +14 -0
- package/android/src/main/java/ee/forgr/capacitor/plugin/downloader/CapacitorDownloaderPlugin.java +13 -0
- package/dist/docs.json +19 -0
- package/dist/esm/definitions.d.ts +9 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +3 -0
- package/dist/esm/web.js +3 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +3 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +3 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapacitorDownloaderPlugin/CapacitorDownloaderPlugin.swift +8 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ npx cap sync
|
|
|
32
32
|
* [`addListener('downloadCompleted', ...)`](#addlistenerdownloadcompleted-)
|
|
33
33
|
* [`addListener('downloadFailed', ...)`](#addlistenerdownloadfailed-)
|
|
34
34
|
* [`removeAllListeners()`](#removealllisteners)
|
|
35
|
+
* [`getPluginVersion()`](#getpluginversion)
|
|
35
36
|
* [Interfaces](#interfaces)
|
|
36
37
|
|
|
37
38
|
</docgen-index>
|
|
@@ -180,6 +181,19 @@ removeAllListeners() => Promise<void>
|
|
|
180
181
|
--------------------
|
|
181
182
|
|
|
182
183
|
|
|
184
|
+
### getPluginVersion()
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
getPluginVersion() => Promise<{ version: string; }>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Get the native Capacitor plugin version
|
|
191
|
+
|
|
192
|
+
**Returns:** <code>Promise<{ version: string; }></code>
|
|
193
|
+
|
|
194
|
+
--------------------
|
|
195
|
+
|
|
196
|
+
|
|
183
197
|
### Interfaces
|
|
184
198
|
|
|
185
199
|
|
package/android/src/main/java/ee/forgr/capacitor/plugin/downloader/CapacitorDownloaderPlugin.java
CHANGED
|
@@ -22,6 +22,8 @@ import java.util.Map;
|
|
|
22
22
|
@CapacitorPlugin(name = "CapacitorDownloader")
|
|
23
23
|
public class CapacitorDownloaderPlugin extends Plugin {
|
|
24
24
|
|
|
25
|
+
private final String PLUGIN_VERSION = "7.1.1";
|
|
26
|
+
|
|
25
27
|
private DownloadManager downloadManager;
|
|
26
28
|
private final Map<String, Long> downloads = new HashMap<>();
|
|
27
29
|
private final Handler handler = new Handler(Looper.getMainLooper());
|
|
@@ -259,4 +261,15 @@ public class CapacitorDownloaderPlugin extends Plugin {
|
|
|
259
261
|
getContext().unregisterReceiver(downloadReceiver);
|
|
260
262
|
}
|
|
261
263
|
}
|
|
264
|
+
|
|
265
|
+
@PluginMethod
|
|
266
|
+
public void getPluginVersion(final PluginCall call) {
|
|
267
|
+
try {
|
|
268
|
+
final JSObject ret = new JSObject();
|
|
269
|
+
ret.put("version", this.PLUGIN_VERSION);
|
|
270
|
+
call.resolve(ret);
|
|
271
|
+
} catch (final Exception e) {
|
|
272
|
+
call.reject("Could not get plugin version", e);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
262
275
|
}
|
package/dist/docs.json
CHANGED
|
@@ -184,6 +184,25 @@
|
|
|
184
184
|
"docs": "",
|
|
185
185
|
"complexTypes": [],
|
|
186
186
|
"slug": "removealllisteners"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"name": "getPluginVersion",
|
|
190
|
+
"signature": "() => Promise<{ version: string; }>",
|
|
191
|
+
"parameters": [],
|
|
192
|
+
"returns": "Promise<{ version: string; }>",
|
|
193
|
+
"tags": [
|
|
194
|
+
{
|
|
195
|
+
"name": "returns",
|
|
196
|
+
"text": "an Promise with version for this device"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"name": "throws",
|
|
200
|
+
"text": "An error if the something went wrong"
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
"docs": "Get the native Capacitor plugin version",
|
|
204
|
+
"complexTypes": [],
|
|
205
|
+
"slug": "getpluginversion"
|
|
187
206
|
}
|
|
188
207
|
],
|
|
189
208
|
"properties": []
|
|
@@ -36,4 +36,13 @@ export interface CapacitorDownloaderPlugin {
|
|
|
36
36
|
error: string;
|
|
37
37
|
}) => void): Promise<PluginListenerHandle>;
|
|
38
38
|
removeAllListeners(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Get the native Capacitor plugin version
|
|
41
|
+
*
|
|
42
|
+
* @returns {Promise<{ id: string }>} an Promise with version for this device
|
|
43
|
+
* @throws An error if the something went wrong
|
|
44
|
+
*/
|
|
45
|
+
getPluginVersion(): Promise<{
|
|
46
|
+
version: string;
|
|
47
|
+
}>;
|
|
39
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface DownloadTask {\n id: string;\n progress: number;\n state: 'PENDING' | 'RUNNING' | 'PAUSED' | 'DONE' | 'ERROR';\n}\n\nexport interface DownloadOptions {\n id: string;\n url: string;\n destination: string;\n headers?: { [key: string]: string };\n network?: 'cellular' | 'wifi-only';\n priority?: 'high' | 'normal' | 'low';\n}\n\nexport interface CapacitorDownloaderPlugin {\n download(options: DownloadOptions): Promise<DownloadTask>;\n pause(id: string): Promise<void>;\n resume(id: string): Promise<void>;\n stop(id: string): Promise<void>;\n checkStatus(id: string): Promise<DownloadTask>;\n getFileInfo(path: string): Promise<{ size: number; type: string }>;\n\n addListener(\n eventName: 'downloadProgress',\n listenerFunc: (progress: { id: string; progress: number }) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n eventName: 'downloadCompleted',\n listenerFunc: (result: { id: string }) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n eventName: 'downloadFailed',\n listenerFunc: (error: { id: string; error: string }) => void,\n ): Promise<PluginListenerHandle>;\n removeAllListeners(): Promise<void>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface DownloadTask {\n id: string;\n progress: number;\n state: 'PENDING' | 'RUNNING' | 'PAUSED' | 'DONE' | 'ERROR';\n}\n\nexport interface DownloadOptions {\n id: string;\n url: string;\n destination: string;\n headers?: { [key: string]: string };\n network?: 'cellular' | 'wifi-only';\n priority?: 'high' | 'normal' | 'low';\n}\n\nexport interface CapacitorDownloaderPlugin {\n download(options: DownloadOptions): Promise<DownloadTask>;\n pause(id: string): Promise<void>;\n resume(id: string): Promise<void>;\n stop(id: string): Promise<void>;\n checkStatus(id: string): Promise<DownloadTask>;\n getFileInfo(path: string): Promise<{ size: number; type: string }>;\n\n addListener(\n eventName: 'downloadProgress',\n listenerFunc: (progress: { id: string; progress: number }) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n eventName: 'downloadCompleted',\n listenerFunc: (result: { id: string }) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n eventName: 'downloadFailed',\n listenerFunc: (error: { id: string; error: string }) => void,\n ): Promise<PluginListenerHandle>;\n removeAllListeners(): Promise<void>;\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
package/dist/esm/web.js
CHANGED
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IACnD,KAAK,CAAC,QAAQ,CAAC,OAAwB;QACrC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,KAAK,CAAC,KAAK,CAAC,EAAU;QACpB,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAU;QACnB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,EAAU;QAC1B,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,IAAY;QAC5B,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { CapacitorDownloaderPlugin, DownloadTask, DownloadOptions } from './definitions';\n\nexport class CapacitorDownloaderWeb extends WebPlugin implements CapacitorDownloaderPlugin {\n async download(options: DownloadOptions): Promise<DownloadTask> {\n console.log('DOWNLOAD', options);\n throw new Error('Method not implemented.');\n }\n async pause(id: string): Promise<void> {\n console.log('PAUSE', id);\n throw new Error('Method not implemented.');\n }\n async resume(id: string): Promise<void> {\n console.log('RESUME', id);\n throw new Error('Method not implemented.');\n }\n async stop(id: string): Promise<void> {\n console.log('STOP', id);\n throw new Error('Method not implemented.');\n }\n async checkStatus(id: string): Promise<DownloadTask> {\n console.log('CHECK STATUS', id);\n throw new Error('Method not implemented.');\n }\n async getFileInfo(path: string): Promise<{ size: number; type: string }> {\n console.log('GET FILE INFO', path);\n throw new Error('Method not implemented.');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IACnD,KAAK,CAAC,QAAQ,CAAC,OAAwB;QACrC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,KAAK,CAAC,KAAK,CAAC,EAAU;QACpB,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAU;QACnB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,EAAU;QAC1B,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,IAAY;QAC5B,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { CapacitorDownloaderPlugin, DownloadTask, DownloadOptions } from './definitions';\n\nexport class CapacitorDownloaderWeb extends WebPlugin implements CapacitorDownloaderPlugin {\n async download(options: DownloadOptions): Promise<DownloadTask> {\n console.log('DOWNLOAD', options);\n throw new Error('Method not implemented.');\n }\n async pause(id: string): Promise<void> {\n console.log('PAUSE', id);\n throw new Error('Method not implemented.');\n }\n async resume(id: string): Promise<void> {\n console.log('RESUME', id);\n throw new Error('Method not implemented.');\n }\n async stop(id: string): Promise<void> {\n console.log('STOP', id);\n throw new Error('Method not implemented.');\n }\n async checkStatus(id: string): Promise<DownloadTask> {\n console.log('CHECK STATUS', id);\n throw new Error('Method not implemented.');\n }\n async getFileInfo(path: string): Promise<{ size: number; type: string }> {\n console.log('GET FILE INFO', path);\n throw new Error('Method not implemented.');\n }\n\n async getPluginVersion(): Promise<{ version: string }> {\n return { version: 'web' };\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -31,6 +31,9 @@ class CapacitorDownloaderWeb extends core.WebPlugin {
|
|
|
31
31
|
console.log('GET FILE INFO', path);
|
|
32
32
|
throw new Error('Method not implemented.');
|
|
33
33
|
}
|
|
34
|
+
async getPluginVersion() {
|
|
35
|
+
return { version: 'web' };
|
|
36
|
+
}
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
var web = /*#__PURE__*/Object.freeze({
|
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 CapacitorDownloader = registerPlugin('CapacitorDownloader', {\n web: () => import('./web').then((m) => new m.CapacitorDownloaderWeb()),\n});\nexport * from './definitions';\nexport { CapacitorDownloader };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorDownloaderWeb extends WebPlugin {\n async download(options) {\n console.log('DOWNLOAD', options);\n throw new Error('Method not implemented.');\n }\n async pause(id) {\n console.log('PAUSE', id);\n throw new Error('Method not implemented.');\n }\n async resume(id) {\n console.log('RESUME', id);\n throw new Error('Method not implemented.');\n }\n async stop(id) {\n console.log('STOP', id);\n throw new Error('Method not implemented.');\n }\n async checkStatus(id) {\n console.log('CHECK STATUS', id);\n throw new Error('Method not implemented.');\n }\n async getFileInfo(path) {\n console.log('GET FILE INFO', path);\n throw new Error('Method not implemented.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,mBAAmB,GAAGA,mBAAc,CAAC,qBAAqB,EAAE;AAClE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,sBAAsB,EAAE,CAAC;AAC1E,CAAC;;ACFM,MAAM,sBAAsB,SAASC,cAAS,CAAC;AACtD,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;AAC5B,QAAQ,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC;AACxC,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;AAClD,IAAI;AACJ,IAAI,MAAM,KAAK,CAAC,EAAE,EAAE;AACpB,QAAQ,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC;AAChC,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;AAClD,IAAI;AACJ,IAAI,MAAM,MAAM,CAAC,EAAE,EAAE;AACrB,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC;AACjC,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;AAClD,IAAI;AACJ,IAAI,MAAM,IAAI,CAAC,EAAE,EAAE;AACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC;AAC/B,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;AAClD,IAAI;AACJ,IAAI,MAAM,WAAW,CAAC,EAAE,EAAE;AAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,CAAC;AACvC,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;AAClD,IAAI;AACJ,IAAI,MAAM,WAAW,CAAC,IAAI,EAAE;AAC5B,QAAQ,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC;AAC1C,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;AAClD,IAAI;AACJ;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorDownloader = registerPlugin('CapacitorDownloader', {\n web: () => import('./web').then((m) => new m.CapacitorDownloaderWeb()),\n});\nexport * from './definitions';\nexport { CapacitorDownloader };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorDownloaderWeb extends WebPlugin {\n async download(options) {\n console.log('DOWNLOAD', options);\n throw new Error('Method not implemented.');\n }\n async pause(id) {\n console.log('PAUSE', id);\n throw new Error('Method not implemented.');\n }\n async resume(id) {\n console.log('RESUME', id);\n throw new Error('Method not implemented.');\n }\n async stop(id) {\n console.log('STOP', id);\n throw new Error('Method not implemented.');\n }\n async checkStatus(id) {\n console.log('CHECK STATUS', id);\n throw new Error('Method not implemented.');\n }\n async getFileInfo(path) {\n console.log('GET FILE INFO', path);\n throw new Error('Method not implemented.');\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map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K,CAAC,yBAAyB,CAAC;AAClD,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -30,6 +30,9 @@ var capacitorCapacitorDownloader = (function (exports, core) {
|
|
|
30
30
|
console.log('GET FILE INFO', path);
|
|
31
31
|
throw new Error('Method not implemented.');
|
|
32
32
|
}
|
|
33
|
+
async getPluginVersion() {
|
|
34
|
+
return { version: 'web' };
|
|
35
|
+
}
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
var web = /*#__PURE__*/Object.freeze({
|
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 CapacitorDownloader = registerPlugin('CapacitorDownloader', {\n web: () => import('./web').then((m) => new m.CapacitorDownloaderWeb()),\n});\nexport * from './definitions';\nexport { CapacitorDownloader };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorDownloaderWeb extends WebPlugin {\n async download(options) {\n console.log('DOWNLOAD', options);\n throw new Error('Method not implemented.');\n }\n async pause(id) {\n console.log('PAUSE', id);\n throw new Error('Method not implemented.');\n }\n async resume(id) {\n console.log('RESUME', id);\n throw new Error('Method not implemented.');\n }\n async stop(id) {\n console.log('STOP', id);\n throw new Error('Method not implemented.');\n }\n async checkStatus(id) {\n console.log('CHECK STATUS', id);\n throw new Error('Method not implemented.');\n }\n async getFileInfo(path) {\n console.log('GET FILE INFO', path);\n throw new Error('Method not implemented.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,mBAAmB,GAAGA,mBAAc,CAAC,qBAAqB,EAAE;IAClE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IA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} from '@capacitor/core';\nconst CapacitorDownloader = registerPlugin('CapacitorDownloader', {\n web: () => import('./web').then((m) => new m.CapacitorDownloaderWeb()),\n});\nexport * from './definitions';\nexport { CapacitorDownloader };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorDownloaderWeb extends WebPlugin {\n async download(options) {\n console.log('DOWNLOAD', options);\n throw new Error('Method not implemented.');\n }\n async pause(id) {\n console.log('PAUSE', id);\n throw new Error('Method not implemented.');\n }\n async resume(id) {\n console.log('RESUME', id);\n throw new Error('Method not implemented.');\n }\n async stop(id) {\n console.log('STOP', id);\n throw new Error('Method not implemented.');\n }\n async checkStatus(id) {\n console.log('CHECK STATUS', id);\n throw new Error('Method not implemented.');\n }\n async getFileInfo(path) {\n console.log('GET FILE INFO', path);\n throw new Error('Method not implemented.');\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,mBAAmB,GAAGA,mBAAc,CAAC,qBAAqB,EAAE;IAClE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,sBAAsB,EAAE,CAAC;IAC1E,CAAC;;ICFM,MAAM,sBAAsB,SAASC,cAAS,CAAC;IACtD,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;IAC5B,QAAQ,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC;IACxC,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;IAClD,IAAI;IACJ,IAAI,MAAM,KAAK,CAAC,EAAE,EAAE;IACpB,QAAQ,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC;IAChC,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;IAClD,IAAI;IACJ,IAAI,MAAM,MAAM,CAAC,EAAE,EAAE;IACrB,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC;IACjC,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;IAClD,IAAI;IACJ,IAAI,MAAM,IAAI,CAAC,EAAE,EAAE;IACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC;IAC/B,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;IAClD,IAAI;IACJ,IAAI,MAAM,WAAW,CAAC,EAAE,EAAE;IAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,CAAC;IACvC,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;IAClD,IAAI;IACJ,IAAI,MAAM,WAAW,CAAC,IAAI,EAAE;IAC5B,QAAQ,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC;IAC1C,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;IAClD,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -8,6 +8,7 @@ import Capacitor
|
|
|
8
8
|
|
|
9
9
|
@objc(CapacitorDownloaderPlugin)
|
|
10
10
|
public class CapacitorDownloaderPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
11
|
+
private let PLUGIN_VERSION: String = "7.1.1"
|
|
11
12
|
public let identifier = "CapacitorDownloaderPlugin"
|
|
12
13
|
public let jsName = "CapacitorDownloader"
|
|
13
14
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
@@ -16,7 +17,8 @@ public class CapacitorDownloaderPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
16
17
|
CAPPluginMethod(name: "resume", returnType: CAPPluginReturnPromise),
|
|
17
18
|
CAPPluginMethod(name: "stop", returnType: CAPPluginReturnPromise),
|
|
18
19
|
CAPPluginMethod(name: "checkStatus", returnType: CAPPluginReturnPromise),
|
|
19
|
-
CAPPluginMethod(name: "getFileInfo", returnType: CAPPluginReturnPromise)
|
|
20
|
+
CAPPluginMethod(name: "getFileInfo", returnType: CAPPluginReturnPromise),
|
|
21
|
+
CAPPluginMethod(name: "getPluginVersion", returnType: CAPPluginReturnPromise)
|
|
20
22
|
]
|
|
21
23
|
|
|
22
24
|
private var tasks: [String: URLSessionDownloadTask] = [:]
|
|
@@ -173,4 +175,9 @@ extension CapacitorDownloaderPlugin: URLSessionDownloadDelegate {
|
|
|
173
175
|
let progress = Float(totalBytesWritten) / Float(totalBytesExpectedToWrite)
|
|
174
176
|
notifyListeners("downloadProgress", data: ["id": id, "progress": progress])
|
|
175
177
|
}
|
|
178
|
+
|
|
179
|
+
@objc func getPluginVersion(_ call: CAPPluginCall) {
|
|
180
|
+
call.resolve(["version": self.PLUGIN_VERSION])
|
|
181
|
+
}
|
|
182
|
+
|
|
176
183
|
}
|