surveysparrow-ionic-plugin 1.0.4 → 1.0.5-beta.2
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/build.gradle
CHANGED
|
@@ -56,7 +56,7 @@ dependencies {
|
|
|
56
56
|
testImplementation "junit:junit:$junitVersion"
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
implementation("com.github.surveysparrow:surveysparrow-android-sdk:0.6.4-beta.
|
|
59
|
+
implementation("com.github.surveysparrow:surveysparrow-android-sdk:0.6.4-beta.2")
|
|
60
60
|
|
|
61
61
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
62
62
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
@@ -57,13 +57,20 @@ import WebKit
|
|
|
57
57
|
let config = WKWebViewConfiguration()
|
|
58
58
|
config.preferences.javaScriptEnabled = true
|
|
59
59
|
config.userContentController = surveyResponseHandler
|
|
60
|
-
ssWebView = WKWebView(frame:
|
|
60
|
+
ssWebView = WKWebView(frame: .zero, configuration: config)
|
|
61
61
|
surveyResponseHandler.add(self, name: "surveyResponse")
|
|
62
62
|
ssWebView.navigationDelegate = self
|
|
63
63
|
ssWebView.backgroundColor = .gray
|
|
64
64
|
ssWebView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
65
|
+
ssWebView.translatesAutoresizingMaskIntoConstraints = false
|
|
65
66
|
addSubview(ssWebView)
|
|
66
67
|
|
|
68
|
+
NSLayoutConstraint.activate([
|
|
69
|
+
ssWebView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor),
|
|
70
|
+
ssWebView.leadingAnchor.constraint(equalTo: safeAreaLayoutGuide.leadingAnchor),
|
|
71
|
+
ssWebView.trailingAnchor.constraint(equalTo: safeAreaLayoutGuide.trailingAnchor),
|
|
72
|
+
ssWebView.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor)
|
|
73
|
+
])
|
|
67
74
|
let isCloseButtonEnabled = properties?["isCloseButtonEnabled"] as? Bool
|
|
68
75
|
|
|
69
76
|
if isCloseButtonEnabled ?? true == true {
|
|
@@ -97,8 +104,10 @@ import WebKit
|
|
|
97
104
|
ssWebView.addSubview(loader)
|
|
98
105
|
ssWebView.navigationDelegate = self
|
|
99
106
|
loader.translatesAutoresizingMaskIntoConstraints = false
|
|
100
|
-
|
|
101
|
-
|
|
107
|
+
NSLayoutConstraint.activate([
|
|
108
|
+
loader.centerXAnchor.constraint(equalTo: ssWebView.centerXAnchor),
|
|
109
|
+
loader.centerYAnchor.constraint(equalTo: ssWebView.centerYAnchor)
|
|
110
|
+
])
|
|
102
111
|
loader.hidesWhenStopped = true
|
|
103
112
|
}
|
|
104
113
|
|
|
@@ -189,18 +198,14 @@ import WebKit
|
|
|
189
198
|
}
|
|
190
199
|
|
|
191
200
|
public func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
|
|
192
|
-
if surveyDelegate
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
if(responseType == surveyCompleted){
|
|
201
|
-
if surveyDelegate != nil {
|
|
202
|
-
surveyDelegate.handleSurveyResponse(response: response)
|
|
203
|
-
}
|
|
201
|
+
if let surveyDelegate = surveyDelegate,
|
|
202
|
+
let response = message.body as? [String: AnyObject],
|
|
203
|
+
let responseType = response["type"] as? String {
|
|
204
|
+
|
|
205
|
+
if responseType == surveyLoaded {
|
|
206
|
+
surveyDelegate.handleSurveyLoaded(response: response)
|
|
207
|
+
} else if responseType == surveyCompleted {
|
|
208
|
+
surveyDelegate.handleSurveyResponse(response: response)
|
|
204
209
|
}
|
|
205
210
|
}
|
|
206
211
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "surveysparrow-ionic-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5-beta.2",
|
|
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",
|