surveysparrow-ionic-plugin 0.0.9 → 1.0.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # surveysparrow-ionic-plugin
2
2
 
3
- 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.
3
+ 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.
4
4
 
5
5
  ## Install
6
6
 
@@ -9,19 +9,40 @@ npm install surveysparrow-ionic-plugin
9
9
  npx cap sync
10
10
  ```
11
11
 
12
- ## API
12
+ ## Permissions Required
13
+
14
+ To use this plugin, ensure the following permissions are added to your app:
13
15
 
14
- <docgen-index>
16
+ ### Android
15
17
 
16
- * [`loadFullScreenSurvey(...)`](#loadfullscreensurvey)
17
- * [`loadFullScreenSurveyWithValidation(...)`](#loadfullscreensurveywithvalidation)
18
- * [Interfaces](#interfaces)
19
- * [Type Aliases](#type-aliases)
18
+ Add these permissions to your `AndroidManifest.xml`:
19
+
20
+ ```xml
21
+ <uses-permission android:name="android.permission.INTERNET" />
22
+ <uses-permission android:name="android.permission.CAMERA" />
23
+ <uses-permission android:name="android.permission.RECORD_AUDIO" />
24
+ ```
20
25
 
21
- </docgen-index>
26
+ ### iOS
27
+
28
+ Add the necessary permissions to your `Info.plist`:
29
+
30
+ ```xml
31
+ <key>NSCameraUsageDescription</key>
32
+ <string>We need camera access to capture photos and videos.</string>
33
+ <key>NSMicrophoneUsageDescription</key>
34
+ <string>We need microphone access to record audio.</string>
35
+ ```
22
36
 
23
- <docgen-api>
24
- <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
37
+ ### General Note
38
+
39
+ Based on the survey type being used, ensure the necessary permissions (e.g., for photos, videos, audio, or storage) are added to your app's configuration.
40
+
41
+ ## API
42
+
43
+ [loadFullScreenSurvey(...)](#loadfullscreensurvey)
44
+
45
+ [loadFullScreenSurveyWithValidation(...)](#loadfullscreensurveywithvalidation)
25
46
 
26
47
  ### loadFullScreenSurvey(...)
27
48
 
@@ -35,7 +56,6 @@ loadFullScreenSurvey(options: { domain: String; token: String; params: Object; p
35
56
 
36
57
  --------------------
37
58
 
38
-
39
59
  ### loadFullScreenSurveyWithValidation(...)
40
60
 
41
61
  ```typescript
@@ -47,3 +67,6 @@ loadFullScreenSurveyWithValidation(options: { domain: String; token: String; par
47
67
  | **`options`** | <code>{ domain: <a href="#string">String</a>; token: <a href="#string">String</a>; params: <a href="#object">Object</a>; properties: <a href="#object">Object</a>; }</code> |
48
68
 
49
69
  --------------------
70
+
71
+ ## Support
72
+ For questions or issues, contact us at [support@surveysparrow.com](mailto:support@surveysparrow.com).
@@ -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.1"
59
+ implementation("com.github.surveysparrow:surveysparrow-android-sdk:0.6.4-beta.1")
60
60
 
61
61
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
62
62
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
@@ -209,6 +209,7 @@ import WebKit
209
209
  let ssSurveyViewController = SsSurveyViewController()
210
210
  ssSurveyViewController.domain = domain
211
211
  ssSurveyViewController.token = token
212
+ ssSurveyViewController.modalPresentationStyle = .fullScreen
212
213
  ssSurveyViewController.properties = self.properties ?? [:]
213
214
  if(params != nil){
214
215
  ssSurveyViewController.params = params ?? [:]
@@ -10,6 +10,7 @@ import SwiftUI
10
10
  ssSurveyViewController.domain = domain
11
11
  ssSurveyViewController.token = token
12
12
  ssSurveyViewController.params = params
13
+ ssSurveyViewController.modalPresentationStyle = .fullScreen
13
14
  ssSurveyViewController.properties = properties
14
15
  ssSurveyViewController.getSurveyLoadedResponse = true
15
16
  ssSurveyViewController.surveyDelegate = SsDelegate()
@@ -14,37 +14,37 @@ public class SurveySparrowIonicPluginPlugin: CAPPlugin, CAPBridgedPlugin {
14
14
  private let implementation = SurveySparrowIonicPlugin()
15
15
 
16
16
  @objc public func loadFullScreenSurvey(_ call: CAPPluginCall) {
17
-
18
- let domain = call.getString("domain")
19
- let token = call.getString("token")
20
- let params = call.getObject("params") as? [String : String]
21
- let properties = call.getObject("properties")
22
-
23
- guard let domain = domain, let token = token, let params = params, let properties = properties else {
24
- call.reject("Invalid or missing parameters")
25
- return
26
- }
27
-
28
- DispatchQueue.main.async {
29
- self.implementation.loadFullScreenSurvey(domain: domain, token: token, params: params, properties: properties)
30
- }
31
-
17
+ handleFullScreenSurvey(call, withValidation: false)
32
18
  }
33
19
 
34
20
  @objc public func loadFullScreenSurveyWithValidation(_ call: CAPPluginCall) {
35
-
36
- let domain = call.getString("domain")
37
- let token = call.getString("token")
38
- let params = call.getObject("params") as? [String : String]
39
- let properties = call.getObject("properties")
40
-
41
- guard let domain = domain, let token = token, let params = params, let properties = properties else {
21
+ handleFullScreenSurvey(call, withValidation: true)
22
+ }
23
+
24
+ private func handleFullScreenSurvey(_ call: CAPPluginCall, withValidation: Bool) {
25
+ guard
26
+ let domain = call.getString("domain"),
27
+ let token = call.getString("token"),
28
+ let params = call.getObject("params") as? [String: String],
29
+ var properties = call.getObject("properties")
30
+ else {
42
31
  call.reject("Invalid or missing parameters")
43
32
  return
44
33
  }
45
-
34
+
35
+ if let langCode = properties["langCode"] {
36
+ properties["sparrowLang"] = langCode
37
+ properties.removeValue(forKey: "langCode")
38
+ } else {
39
+ properties["sparrowLang"] = "en"
40
+ }
41
+
46
42
  DispatchQueue.main.async {
47
- self.implementation.loadFullScreenSurveyWithValidation(domain: domain, token: token, params: params, properties: properties)
43
+ if withValidation {
44
+ self.implementation.loadFullScreenSurveyWithValidation(domain: domain, token: token, params: params, properties: properties)
45
+ } else {
46
+ self.implementation.loadFullScreenSurvey(domain: domain, token: token, params: params, properties: properties)
47
+ }
48
48
  }
49
49
  }
50
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "surveysparrow-ionic-plugin",
3
- "version": "0.0.9",
3
+ "version": "1.0.0",
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",