surveysparrow-ionic-plugin 0.0.4 → 0.0.5
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/android/src/main/java/com/surveysparrow/plugins/ionic/SurveySparrowIonicPluginPlugin.java
CHANGED
|
@@ -9,8 +9,11 @@ import com.getcapacitor.annotation.CapacitorPlugin;
|
|
|
9
9
|
|
|
10
10
|
import com.surveysparrow.ss_android_sdk.SsSurvey.CustomParam;
|
|
11
11
|
import org.json.JSONException;
|
|
12
|
+
import java.util.List;
|
|
13
|
+
import java.util.ArrayList;
|
|
12
14
|
import java.util.HashMap;
|
|
13
15
|
import java.util.Iterator;
|
|
16
|
+
import java.util.List;cd
|
|
14
17
|
|
|
15
18
|
@CapacitorPlugin(name = "SurveySparrowIonicPlugin")
|
|
16
19
|
public class SurveySparrowIonicPluginPlugin extends Plugin {
|
|
@@ -40,24 +43,20 @@ public class SurveySparrowIonicPluginPlugin extends Plugin {
|
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
private CustomParam[] parseParams(JSObject jsParams) {
|
|
43
|
-
if (jsParams == null
|
|
46
|
+
if (jsParams == null) {
|
|
44
47
|
return new CustomParam[0];
|
|
45
48
|
}
|
|
46
49
|
|
|
47
|
-
String
|
|
48
|
-
CustomParam
|
|
50
|
+
Iterator<String> keysIterator = jsParams.keys();
|
|
51
|
+
List<CustomParam> paramsList = new ArrayList<>();
|
|
49
52
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
params[i] = new CustomParam(key, value);
|
|
55
|
-
} catch (JSONException e) {
|
|
56
|
-
throw new RuntimeException("Invalid parameter for key: " + keys[i], e);
|
|
57
|
-
}
|
|
53
|
+
while (keysIterator.hasNext()) {
|
|
54
|
+
String key = keysIterator.next();
|
|
55
|
+
String value = jsParams.getString(key);
|
|
56
|
+
paramsList.add(new CustomParam(key, value));
|
|
58
57
|
}
|
|
59
58
|
|
|
60
|
-
return
|
|
59
|
+
return paramsList.toArray(new CustomParam[0]);
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
private HashMap<String, String> parseProperties(JSObject jsProperties) {
|
|
@@ -15,10 +15,10 @@ public class SurveySparrowIonicPluginPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
15
15
|
|
|
16
16
|
@objc public func loadFullScreenSurvey(_ call: CAPPluginCall) {
|
|
17
17
|
|
|
18
|
-
let domain = call.getString("domain")
|
|
19
|
-
let token = call.getString("token")
|
|
18
|
+
let domain = call.getString("domain")
|
|
19
|
+
let token = call.getString("token")
|
|
20
20
|
let params = call.getObject("params") as? [String : String]
|
|
21
|
-
let properties = call.getObject("properties")
|
|
21
|
+
let properties = call.getObject("properties")
|
|
22
22
|
|
|
23
23
|
guard let domain = domain, let token = token, let params = params, let properties = properties else {
|
|
24
24
|
call.reject("Invalid or missing parameters")
|
|
@@ -33,10 +33,10 @@ public class SurveySparrowIonicPluginPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
33
33
|
|
|
34
34
|
@objc public func loadFullScreenSurveyWithValidation(_ call: CAPPluginCall) {
|
|
35
35
|
|
|
36
|
-
let domain = call.getString("domain")
|
|
37
|
-
let token = call.getString("token")
|
|
36
|
+
let domain = call.getString("domain")
|
|
37
|
+
let token = call.getString("token")
|
|
38
38
|
let params = call.getObject("params") as? [String : String]
|
|
39
|
-
let properties = call.getObject("properties")
|
|
39
|
+
let properties = call.getObject("properties")
|
|
40
40
|
|
|
41
41
|
guard let domain = domain, let token = token, let params = params, let properties = properties else {
|
|
42
42
|
call.reject("Invalid or missing parameters")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "surveysparrow-ionic-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "SurveySparrow SDK enables you to collect feedback from your mobile app. Embed the Classic, Chat & NPS surveys in your ionic application seamlessly with few lines of code.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|