@zenkit-dev/cordova-plugin-simple-chooser 2.0.1 → 2.0.2-dev.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/LICENSE +1 -0
- package/README.md +4 -4
- package/package.json +1 -1
- package/plugin.xml +1 -2
- package/src/android/Chooser.java +0 -4
- package/src/ios/Chooser.swift +9 -2
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -4,20 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
A simple file chooser plugin for Cordova.
|
|
6
6
|
|
|
7
|
-
Based on [`cordova-plugin-
|
|
7
|
+
Based on [`cordova-plugin-chooser`](https://github.com/cyph/cordova-plugin-chooser),
|
|
8
8
|
but without using `Promise` and without loading the file `data` (can be done with `cordova-plugin-file`).
|
|
9
9
|
|
|
10
10
|
Install with Cordova CLI:
|
|
11
11
|
|
|
12
12
|
```sh
|
|
13
|
-
cordova plugin add
|
|
13
|
+
cordova plugin add @zenkit-dev/cordova-plugin-simple-chooser
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
Supported Platforms:
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
* Android
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
* iOS
|
|
21
21
|
|
|
22
22
|
## API
|
|
23
23
|
|
package/package.json
CHANGED
package/plugin.xml
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
xmlns="http://www.phonegap.com/ns/plugins/1.0"
|
|
4
4
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
5
5
|
id="cordova-plugin-simple-chooser"
|
|
6
|
-
version="2.0.
|
|
6
|
+
version="2.0.2-dev.0"
|
|
7
7
|
>
|
|
8
8
|
<name>Chooser</name>
|
|
9
9
|
<author>Zenkit</author>
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
<platform name="ios">
|
|
26
26
|
<source-file src="src/ios/Chooser.swift" />
|
|
27
|
-
<dependency id="cordova-plugin-add-swift-support" version="*" />
|
|
28
27
|
|
|
29
28
|
<config-file target="config.xml" parent="/*">
|
|
30
29
|
<feature name="Chooser">
|
package/src/android/Chooser.java
CHANGED
|
@@ -6,11 +6,7 @@ import android.content.Intent;
|
|
|
6
6
|
import android.database.Cursor;
|
|
7
7
|
import android.net.Uri;
|
|
8
8
|
import android.provider.MediaStore;
|
|
9
|
-
import android.util.Base64;
|
|
10
9
|
|
|
11
|
-
import java.io.ByteArrayOutputStream;
|
|
12
|
-
import java.io.InputStream;
|
|
13
|
-
import java.io.IOException;
|
|
14
10
|
import java.lang.Exception;
|
|
15
11
|
|
|
16
12
|
import org.apache.cordova.CallbackContext;
|
package/src/ios/Chooser.swift
CHANGED
|
@@ -10,6 +10,7 @@ class Chooser : CDVPlugin {
|
|
|
10
10
|
func callPicker (utis: [String]) {
|
|
11
11
|
let picker = UIDocumentPickerViewController(documentTypes: utis, in: .import)
|
|
12
12
|
picker.delegate = self
|
|
13
|
+
picker.presentationController?.delegate = self
|
|
13
14
|
self.viewController.present(picker, animated: true, completion: nil)
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -115,7 +116,7 @@ class Chooser : CDVPlugin {
|
|
|
115
116
|
self.callPicker(utis: utis)
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
func send (_ message: String, _ status: CDVCommandStatus =
|
|
119
|
+
func send (_ message: String, _ status: CDVCommandStatus = .ok) {
|
|
119
120
|
if let callbackId = self.commandCallback {
|
|
120
121
|
self.commandCallback = nil
|
|
121
122
|
|
|
@@ -132,7 +133,7 @@ class Chooser : CDVPlugin {
|
|
|
132
133
|
}
|
|
133
134
|
|
|
134
135
|
func sendError (_ message: String) {
|
|
135
|
-
self.send(message,
|
|
136
|
+
self.send(message, .error)
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
|
|
@@ -158,3 +159,9 @@ extension Chooser : UIDocumentPickerDelegate {
|
|
|
158
159
|
self.sendError("No File Selected")
|
|
159
160
|
}
|
|
160
161
|
}
|
|
162
|
+
|
|
163
|
+
extension Chooser : UIAdaptivePresentationControllerDelegate {
|
|
164
|
+
func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
|
|
165
|
+
self.sendError("No File Selected")
|
|
166
|
+
}
|
|
167
|
+
}
|