@hanwha-ss1/plugin 0.5.7 → 0.5.8

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.
@@ -17,27 +17,28 @@ public class DownloadPlugin: CAPPlugin {
17
17
  if aData2.count > 1 {
18
18
  let sData = aData2[1]
19
19
 
20
- if let data = Data(base64Encoded: sData, options: .ignoreUnknownCharacters) {
20
+ if Data(base64Encoded: sData, options: .ignoreUnknownCharacters) != nil {
21
21
  let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
22
22
  let documentsDirectory = paths[0]
23
23
  let filePath = documentsDirectory.appendingPathComponent(fileName)
24
24
 
25
- DispatchQueue.global(qos: .userInitiated).async {
26
- do {
27
- try data.write(to: filePath)
28
- DispatchQueue.main.async {
29
- call.resolve([
30
- "result": true,
31
- ])
32
- }
33
- } catch {
34
- DispatchQueue.main.async {
25
+ let activityViewController = UIActivityViewController(activityItems: [filePath], applicationActivities: nil)
26
+
27
+ DispatchQueue.main.async {
28
+ if let topController = UIViewController.topViewController(controller: _bridge.viewController) {
29
+ topController.present(activityViewController, animated: true, completion: {
35
30
  call.resolve([
36
- "result": false,
31
+ "result": true
37
32
  ])
38
- }
33
+ })
34
+ } else {
35
+ call.resolve([
36
+ "result": false,
37
+ ])
39
38
  }
40
39
  }
40
+
41
+
41
42
  } else {
42
43
  DispatchQueue.main.async {
43
44
  call.resolve([
@@ -48,5 +49,6 @@ public class DownloadPlugin: CAPPlugin {
48
49
  }
49
50
  }
50
51
  }
52
+
51
53
  }
52
54
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanwha-ss1/plugin",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
4
4
  "description": "Plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",