@capgo/capacitor-uploader 0.0.5 → 0.0.7

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.
@@ -27,7 +27,9 @@ import MobileCoreServices
27
27
  request.setValue(value, forHTTPHeaderField: key)
28
28
  }
29
29
 
30
- let fileUrl = URL(fileURLWithPath: filePath)
30
+ guard let fileUrl = URL(string: filePath) else {
31
+ throw NSError(domain: "UploaderPlugin", code: 1, userInfo: [NSLocalizedDescriptionKey: "Invalid file URL"])
32
+ }
31
33
  let mimeType = options["mimeType"] as? String ?? guessMIMEType(from: filePath)
32
34
 
33
35
  let task: URLSessionTask
@@ -4,6 +4,10 @@ import Capacitor
4
4
  @objc(UploaderPlugin)
5
5
  public class UploaderPlugin: CAPPlugin {
6
6
  private let implementation = Uploader()
7
+ public let pluginMethods: [CAPPluginMethod] = [
8
+ CAPPluginMethod(name: "startUpload", returnType: CAPPluginReturnPromise),
9
+ CAPPluginMethod(name: "removeUpload", returnType: CAPPluginReturnPromise),
10
+ ]
7
11
 
8
12
  override public func load() {
9
13
  implementation.eventHandler = { [weak self] event in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-uploader",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Upload file natively",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",