react-native-acoustic-connect-beta 18.0.18 → 18.0.20

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.
Files changed (50) hide show
  1. package/Examples/SampleUI/ios/Podfile +13 -0
  2. package/Examples/SampleUI/ios/Podfile.lock +2276 -0
  3. package/Examples/SampleUI/package.json +1 -1
  4. package/README.md +1 -1
  5. package/android/build.gradle +6 -11
  6. package/android/config.gradle +89 -5
  7. package/android/src/main/assets/ConnectAdvancedConfig.json +1 -1
  8. package/android/src/main/assets/ConnectBasicConfig.properties +35 -0
  9. package/android/src/main/assets/TealeafAdvancedConfig.json +1 -1
  10. package/android/src/main/cpp/cpp-adapter.cpp +4 -1
  11. package/android/src/main/java/com/acousticconnectrn/HybridAcousticConnectRN.kt +17 -16
  12. package/ios/HybridAcousticConnectRN.swift +104 -47
  13. package/nitrogen/generated/.gitattributes +1 -1
  14. package/nitrogen/generated/android/AcousticConnectRN+autolinking.cmake +10 -5
  15. package/nitrogen/generated/android/AcousticConnectRN+autolinking.gradle +1 -1
  16. package/nitrogen/generated/android/AcousticConnectRNOnLoad.cpp +27 -19
  17. package/nitrogen/generated/android/AcousticConnectRNOnLoad.hpp +14 -5
  18. package/nitrogen/generated/android/c++/JHybridAcousticConnectRNSpec.cpp +70 -55
  19. package/nitrogen/generated/android/c++/JHybridAcousticConnectRNSpec.hpp +28 -27
  20. package/nitrogen/generated/android/c++/JVariant_Boolean_String_Double.cpp +30 -0
  21. package/nitrogen/generated/android/c++/JVariant_Boolean_String_Double.hpp +83 -0
  22. package/nitrogen/generated/android/c++/JVariant_NullType_String.cpp +26 -0
  23. package/nitrogen/generated/android/c++/JVariant_NullType_String.hpp +70 -0
  24. package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/AcousticConnectRNOnLoad.kt +1 -1
  25. package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/HybridAcousticConnectRNSpec.kt +27 -24
  26. package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/Variant_Boolean_String_Double.kt +75 -0
  27. package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/Variant_NullType_String.kt +62 -0
  28. package/nitrogen/generated/ios/AcousticConnectRN+autolinking.rb +4 -2
  29. package/nitrogen/generated/ios/AcousticConnectRN-Swift-Cxx-Bridge.cpp +7 -6
  30. package/nitrogen/generated/ios/AcousticConnectRN-Swift-Cxx-Bridge.hpp +86 -47
  31. package/nitrogen/generated/ios/AcousticConnectRN-Swift-Cxx-Umbrella.hpp +4 -2
  32. package/nitrogen/generated/ios/AcousticConnectRNAutolinking.mm +2 -2
  33. package/nitrogen/generated/ios/AcousticConnectRNAutolinking.swift +11 -10
  34. package/nitrogen/generated/ios/c++/HybridAcousticConnectRNSpecSwift.cpp +1 -1
  35. package/nitrogen/generated/ios/c++/HybridAcousticConnectRNSpecSwift.hpp +22 -10
  36. package/nitrogen/generated/ios/swift/HybridAcousticConnectRNSpec.swift +20 -13
  37. package/nitrogen/generated/ios/swift/HybridAcousticConnectRNSpec_cxx.swift +159 -63
  38. package/nitrogen/generated/ios/swift/Variant_Bool_String_Double.swift +32 -0
  39. package/nitrogen/generated/ios/swift/Variant_NullType_String.swift +30 -0
  40. package/nitrogen/generated/shared/c++/HybridAcousticConnectRNSpec.cpp +1 -1
  41. package/nitrogen/generated/shared/c++/HybridAcousticConnectRNSpec.hpp +10 -9
  42. package/package.json +5 -5
  43. package/scripts/ConnectConfig.json +1 -1
  44. package/scripts/gradleParser.js +5 -6
  45. package/scripts/postInstallScripts.sh +0 -1
  46. package/scripts/xmlparser.js +4 -5
  47. package/nitrogen/generated/android/c++/JVariant_String_Double_Boolean.hpp +0 -98
  48. package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/Variant_String_Double_Boolean.kt +0 -49
  49. package/nitrogen/generated/ios/swift/Variant_String_Double_Bool.swift +0 -17
  50. package/scripts/javaParser.js +0 -183
@@ -29,7 +29,7 @@
29
29
  "react-native-acoustic-connect-beta": "file:.yalc/react-native-acoustic-connect-beta",
30
30
  "react-native-gesture-handler": "~2.20.2",
31
31
  "react-native-get-random-values": "^1.11.0",
32
- "react-native-nitro-modules": "^0.25.2",
32
+ "react-native-nitro-modules": "^0.35.4",
33
33
  "react-native-paper": "^5.13.5",
34
34
  "react-native-reanimated": "~3.16.1",
35
35
  "react-native-safe-area-context": "4.12.0",
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Requirements
4
4
 
5
- - React Native v0.76.9 or higher using new architecture
5
+ - React Native v0.78.0 or higher using new architecture
6
6
  - Node 20.0.0 or higher
7
7
  - Does not support expo
8
8
 
@@ -153,20 +153,15 @@ allprojects {
153
153
  }
154
154
 
155
155
  dependencies {
156
- // For < 0.71, this will be from the local maven repo
157
- // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
156
+ // Provided by the host app at runtime compileOnly avoids version conflicts
158
157
  //noinspection GradleDynamicVersion
159
- implementation "com.facebook.react:react-native:+"
158
+ compileOnly "com.facebook.react:react-native:+"
160
159
 
161
- // Add a dependency on NitroModules
162
- implementation project(":react-native-nitro-modules")
160
+ // Provided by the host app via react-native-nitro-modules peer dependency
161
+ compileOnly project(":react-native-nitro-modules")
163
162
 
164
- // Connect SDK libraries
165
- implementation 'io.github.go-acoustic:connect:10.4.48'
166
- // implementation 'io.github.go-acoustic:connect:+'
167
- // Connect SDK libraries
168
- // api 'io.github.go-acoustic:connect:+'
169
- // api 'io.github.go-acoustic:connect:10.4.29'
163
+ // Connect SDK — version overridden by config.gradle based on ConnectConfig.json
164
+ implementation 'io.github.go-acoustic:connect:10.4.29'
170
165
  }
171
166
 
172
167
  if (isNewArchitectureEnabled()) {
@@ -85,6 +85,71 @@ def updateTealeafBasicConfig(mp, json) {
85
85
  println("Updating:$propertiesFile")
86
86
  }
87
87
 
88
+ def updateConnectBasicConfig(mp, json) {
89
+ def propertiesFile = "$mp/src/main/assets/ConnectBasicConfig.properties"
90
+ FileInputStream _file = new FileInputStream(propertiesFile);
91
+ Properties properties = new Properties();
92
+ properties.load(_file);
93
+ _file.close();
94
+
95
+ FileOutputStream out = new FileOutputStream(propertiesFile);
96
+
97
+ json.each { key, value ->
98
+ if(key != "Connect"){ return }
99
+
100
+ println("Update/Add the following key/values:")
101
+ value.each { config_key, config_value ->
102
+ if(config_value.getClass() != java.lang.String
103
+ && config_value.getClass() != java.lang.Boolean
104
+ && config_value.getClass() != java.lang.Integer){
105
+ return
106
+ }
107
+ // Just update the following items
108
+ if (config_key == "AppKey" ||
109
+ config_key == "PostMessageUrl" ||
110
+ config_key == "KillSwitchUrl" ||
111
+ config_key == "KillSwitchEnabled" ||
112
+ config_key == "KillSwitchMaxNumberOfTries" ||
113
+ config_key == "KillSwitchTimeInterval" ||
114
+ config_key == "UseWhiteList" ||
115
+ config_key == "WhiteListParam" ||
116
+ config_key == "UseRandomSample" ||
117
+ config_key == "RandomSampleParam" ||
118
+ config_key == "PrintScreen" ||
119
+ config_key == "Connection" ||
120
+ config_key == "MaxStringsLength" ||
121
+ config_key == "CookieUrl" ||
122
+ config_key == "CookieParam" ||
123
+ config_key == "CookiePath" ||
124
+ config_key == "CookieDomain" ||
125
+ config_key == "CookieExpires" ||
126
+ config_key == "CookieSecure" ||
127
+ config_key == "CookieExpiresFormat" ||
128
+ config_key == "SessionTimeout" ||
129
+ config_key == "SessionTimeoutKillSwitch" ||
130
+ config_key == "disableTLTDID" ||
131
+ config_key == "ScreenshotFormat" ||
132
+ config_key == "PercentOfScreenshotsSize" ||
133
+ config_key == "PercentToCompressImage" ||
134
+ config_key == "ScreenShotPixelDensity" ||
135
+ config_key == "LogViewLayoutOnScreenTransition" ||
136
+ config_key == "GetImageDataOnScreenLayout" ||
137
+ config_key == "SetGestureDetector" ||
138
+ config_key == "CaptureNativeGesturesOnWebview" ||
139
+ config_key == "LogLocationEnabled" ||
140
+ config_key == "LogLocationTries" ||
141
+ config_key == "LogLocationTimeout" ) {
142
+ println(config_key + "=" + config_value)
143
+ properties.setProperty(config_key, config_value.toString())
144
+ }
145
+ }
146
+ }
147
+
148
+ properties.store(out, null);
149
+ out.close();
150
+ println("Updating:$propertiesFile")
151
+ }
152
+
88
153
  def updateLayoutConfig(mp, json){
89
154
  def layoutConfigPath = "$mp/src/main/assets/TealeafLayoutConfig.json"
90
155
  def layoutConfigDefaultPath = "$mp/src/main/assets/TealeafLayoutConfigDefault.json"
@@ -257,6 +322,8 @@ def updateGradle(mp, json){
257
322
  def updatedBuildGradle = buildGradleFile.text
258
323
 
259
324
  if (json != null && json.Connect) {
325
+ def useRelease = json.Connect.useRelease ?: false
326
+
260
327
  if(json.Connect.AndroidVersion != null) {
261
328
  def connectSDK = "io.github.go-acoustic:connect:"
262
329
  if(json.Connect.AndroidVersion.length() > 0) {
@@ -264,7 +331,22 @@ def updateGradle(mp, json){
264
331
  } else {
265
332
  connectSDK += "+"
266
333
  }
267
- updatedBuildGradle = updatedBuildGradle.replaceAll(~/io.github.go-acoustic:connect:(\+|\d+.\d+.\d+)/, connectSDK)
334
+ updatedBuildGradle = updatedBuildGradle.replaceAll(~/io.github.go-acoustic:connect:(\+|\d+\.\d+\.\d+(-beta)?)/, connectSDK)
335
+ }
336
+
337
+ if (useRelease) {
338
+ project.configurations.all {
339
+ resolutionStrategy {
340
+ componentSelection {
341
+ all { selection ->
342
+ if (selection.candidate.group == 'io.github.go-acoustic' &&
343
+ selection.candidate.version.endsWith('-beta')) {
344
+ selection.reject("useRelease is true — rejecting beta version ${selection.candidate.version}")
345
+ }
346
+ }
347
+ }
348
+ }
349
+ }
268
350
  }
269
351
  }
270
352
 
@@ -282,14 +364,16 @@ try {
282
364
  println("Step 2:")
283
365
  updateTealeafBasicConfig(module_path, configJSONData)
284
366
  println("Step 3:")
285
- updateLayoutConfig(module_path, configJSONData)
367
+ updateConnectBasicConfig(module_path, configJSONData)
286
368
  println("Step 4:")
287
- updateTealeafAdvConfig(module_path, configJSONData)
369
+ updateLayoutConfig(module_path, configJSONData)
288
370
  println("Step 5:")
289
- updateEOCoreBasicConfig(module_path, configJSONData)
371
+ updateTealeafAdvConfig(module_path, configJSONData)
290
372
  println("Step 6:")
291
- updateEOCoreAdvConfig(module_path, configJSONData)
373
+ updateEOCoreBasicConfig(module_path, configJSONData)
292
374
  println("Step 7:")
375
+ updateEOCoreAdvConfig(module_path, configJSONData)
376
+ println("Step 8:")
293
377
  updateGradle(module_path, configJSONData)
294
378
  println("*********************************************************************************************")
295
379
  } catch (FileNotFoundException e) {
@@ -24,7 +24,7 @@
24
24
  "IpPlaceholder": "N/A",
25
25
  "KillSwitchAsync": true,
26
26
  "KillSwitchDelay": 300,
27
- "LibraryVersion": "11.0.6-beta",
27
+ "LibraryVersion": "11.0.8-beta",
28
28
  "LogFullRequestResponsePayloads": true,
29
29
  "MessageTypeHeader": "WorklightHit",
30
30
  "MessageTypes": "4,5",
@@ -0,0 +1,35 @@
1
+ #Fri Apr 24 00:36:32 PDT 2026
2
+ UseWhiteList=true
3
+ PrintScreen=3
4
+ UseRandomSample=false
5
+ CookieDomain=.straussandplesser.com
6
+ PostMessageUrl=https\://lib-us-2.brilliantcollector.com/collector/collectorPost
7
+ SessionTimeout=30
8
+ PercentToCompressImage=80
9
+ CookieExpires=false
10
+ AppKey=b6c3709b7a4c479bb4b5a9fb8fec324c
11
+ KillSwitchEnabled=false
12
+ ScreenShotPixelDensity=1.5
13
+ CookieExpiresFormat=ASCTIME
14
+ RandomSampleParam=
15
+ SessionTimeoutKillSwitch=false
16
+ PercentOfScreenshotsSize=40
17
+ SetGestureDetector=true
18
+ disableTLTDID=false
19
+ GetImageDataOnScreenLayout=false
20
+ CookieUrl=http\://m.straussandplesser.com
21
+ ScreenshotFormat=JPG
22
+ Connection=3
23
+ CookiePath=/
24
+ KillSwitchUrl=https\://lib-us-2.brilliantcollector.com/collector/switch/b6c3709b7a4c479bb4b5a9fb8fec324c
25
+ LogLocationEnabled=true
26
+ LogLocationTimeout=30
27
+ KillSwitchTimeInterval=5
28
+ MaxStringsLength=300
29
+ CookieParam=TLTSID
30
+ CookieSecure=true
31
+ LogViewLayoutOnScreenTransition=true
32
+ KillSwitchMaxNumberOfTries=3
33
+ WhiteListParam=id
34
+ CaptureNativeGesturesOnWebview=false
35
+ LogLocationTries=3
@@ -24,7 +24,7 @@
24
24
  "IpPlaceholder": "N/A",
25
25
  "KillSwitchAsync": true,
26
26
  "KillSwitchDelay": 300,
27
- "LibraryVersion": "10.4.25-beta",
27
+ "LibraryVersion": "10.4.27-beta",
28
28
  "LogFullRequestResponsePayloads": true,
29
29
  "MessageTypeHeader": "WorklightHit",
30
30
  "MessageTypes": "4,5",
@@ -1,6 +1,9 @@
1
1
  #include <jni.h>
2
2
  #include "AcousticConnectRNOnLoad.hpp"
3
+ #include <fbjni/fbjni.h>
3
4
 
4
5
  JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
5
- return margelo::nitro::acousticconnectrn::initialize(vm);
6
+ return facebook::jni::initialize(vm, []() {
7
+ margelo::nitro::acousticconnectrn::registerAllNatives();
8
+ });
6
9
  }
@@ -55,7 +55,8 @@ import com.ibm.eo.EOCore
55
55
  import com.ibm.eo.model.EOMonitoringLevel
56
56
  import com.margelo.nitro.NitroModules.Companion.applicationContext
57
57
  import com.margelo.nitro.acousticconnectrn.HybridAcousticConnectRNSpec
58
- import com.margelo.nitro.acousticconnectrn.Variant_String_Double_Boolean
58
+ import com.margelo.nitro.acousticconnectrn.Variant_Boolean_String_Double
59
+ import com.margelo.nitro.acousticconnectrn.Variant_NullType_String
59
60
  import com.tl.uic.Tealeaf
60
61
  import com.tl.uic.model.ScreenviewType
61
62
  import com.tl.uic.util.DialogUtil
@@ -142,7 +143,7 @@ class HybridAcousticConnectRN(private val reactContext: ReactApplicationContext)
142
143
  */
143
144
  override fun setConfigItemForKey(
144
145
  key: String,
145
- value: Variant_String_Double_Boolean,
146
+ value: Variant_Boolean_String_Double,
146
147
  moduleName: String
147
148
  ): Boolean {
148
149
  val result = EOCore.updateConfig(key, value.toString(), EOCore.getLifecycleObject(moduleName))
@@ -177,12 +178,12 @@ class HybridAcousticConnectRN(private val reactContext: ReactApplicationContext)
177
178
  * @param moduleName The class name of the module's EOLifecycleObject for which the configuration item is referencing.
178
179
  * @return String value if the operation was successful, null otherwise.
179
180
  */
180
- override fun getStringItemForKey(theDefault: String, key: String, moduleName: String): String? {
181
+ override fun getStringItemForKey(theDefault: String, key: String, moduleName: String): Variant_NullType_String? {
181
182
  var result = EOCore.getConfigItemString(key, EOCore.getLifecycleObject(moduleName))
182
183
  if (TextUtils.isEmpty(result)) {
183
184
  result = theDefault
184
185
  }
185
- return result
186
+ return if (result != null) Variant_NullType_String.create(result) else null
186
187
  }
187
188
 
188
189
  /**
@@ -211,7 +212,7 @@ class HybridAcousticConnectRN(private val reactContext: ReactApplicationContext)
211
212
  */
212
213
  override fun logCustomEvent(
213
214
  eventName: String,
214
- values: Map<String, Variant_String_Double_Boolean>,
215
+ values: Map<String, Variant_Boolean_String_Double>,
215
216
  level: Double
216
217
  ): Boolean {
217
218
  val result = Connect.logCustomEvent(eventName, convertToMap(values), level.toInt())
@@ -226,7 +227,7 @@ class HybridAcousticConnectRN(private val reactContext: ReactApplicationContext)
226
227
  * @return True if the operation was successful, false otherwise.
227
228
  */
228
229
  override fun logSignal(
229
- values: Map<String, Variant_String_Double_Boolean>,
230
+ values: Map<String, Variant_Boolean_String_Double>,
230
231
  level: Double
231
232
  ): Boolean {
232
233
  val result = Connect.logSignal(convertToMapAny(values), level.toInt())
@@ -354,7 +355,7 @@ class HybridAcousticConnectRN(private val reactContext: ReactApplicationContext)
354
355
  * @param text The input string.
355
356
  * @return True if the operation was successful, false otherwise.
356
357
  */
357
- override fun logTextChangeEvent(target: Double, controlId: String, text: String?): Boolean {
358
+ override fun logTextChangeEvent(target: Double, controlId: String, text: Variant_NullType_String?): Boolean {
358
359
  var result = false
359
360
  try {
360
361
  val context: ReactApplicationContext = reactContext
@@ -400,8 +401,8 @@ class HybridAcousticConnectRN(private val reactContext: ReactApplicationContext)
400
401
  * @param referrer The referrer for the screen view.
401
402
  * @return True if the operation was successful, false otherwise.
402
403
  */
403
- override fun logScreenViewContextLoad(logicalPageName: String?, referrer: String?): Boolean {
404
- val result = logScreenview(getCurrentActivity()!!, logicalPageName.toString(), ScreenviewType.LOAD, referrer);
404
+ override fun logScreenViewContextLoad(logicalPageName: Variant_NullType_String?, referrer: Variant_NullType_String?): Boolean {
405
+ val result = logScreenview(getCurrentActivity()!!, logicalPageName?.asSecondOrNull().toString(), ScreenviewType.LOAD, referrer?.asSecondOrNull());
405
406
  return result
406
407
  }
407
408
 
@@ -412,8 +413,8 @@ class HybridAcousticConnectRN(private val reactContext: ReactApplicationContext)
412
413
  * @param referrer The referrer for the screen view.
413
414
  * @return True if the operation was successful, false otherwise.
414
415
  */
415
- override fun logScreenViewContextUnload(logicalPageName: String?, referrer: String?): Boolean {
416
- val result = logScreenview(getCurrentActivity()!!, logicalPageName.toString(), ScreenviewType.UNLOAD, referrer);
416
+ override fun logScreenViewContextUnload(logicalPageName: Variant_NullType_String?, referrer: Variant_NullType_String?): Boolean {
417
+ val result = logScreenview(getCurrentActivity()!!, logicalPageName?.asSecondOrNull().toString(), ScreenviewType.UNLOAD, referrer?.asSecondOrNull());
417
418
  return result
418
419
  }
419
420
 
@@ -698,7 +699,7 @@ class HybridAcousticConnectRN(private val reactContext: ReactApplicationContext)
698
699
  override fun logDialogCustomEvent(
699
700
  dialogId: String,
700
701
  eventName: String,
701
- values: Map<String, Variant_String_Double_Boolean>
702
+ values: Map<String, Variant_Boolean_String_Double>
702
703
  ): Boolean {
703
704
  var result = false
704
705
  try {
@@ -726,12 +727,12 @@ class HybridAcousticConnectRN(private val reactContext: ReactApplicationContext)
726
727
  }
727
728
 
728
729
  /**
729
- * Converts a map of Variant_String_Double_Boolean to a HashMap<String?, String?>.
730
+ * Converts a map of Variant_Boolean_String_Double to a HashMap<String?, String?>.
730
731
  *
731
732
  * @param values The map to be converted.
732
733
  * @return A HashMap<String?, String?> representation of the input map which library can use.
733
734
  */
734
- private fun convertToMap(values: Map<String, Variant_String_Double_Boolean>): HashMap<String?, String?> {
735
+ private fun convertToMap(values: Map<String, Variant_Boolean_String_Double>): HashMap<String?, String?> {
735
736
  val map = HashMap<String?, String?>()
736
737
  for (key in values.keys) {
737
738
  val value = values[key]
@@ -743,12 +744,12 @@ class HybridAcousticConnectRN(private val reactContext: ReactApplicationContext)
743
744
  }
744
745
 
745
746
  /**
746
- * Converts a map of Variant_String_Double_Boolean to a HashMap<String?, String?>.
747
+ * Converts a map of Variant_Boolean_String_Double to a HashMap<String?, String?>.
747
748
  *
748
749
  * @param values The map to be converted.
749
750
  * @return A HashMap<String?, String?> representation of the input map which library can use.
750
751
  */
751
- private fun convertToMapAny(values: Map<String, Variant_String_Double_Boolean>): java.util.HashMap<String?, Any?>? {
752
+ private fun convertToMapAny(values: Map<String, Variant_Boolean_String_Double>): java.util.HashMap<String?, Any?>? {
752
753
  val map = HashMap<String?, Any?>()
753
754
  for (key in values.keys) {
754
755
  val value = values[key]
@@ -12,9 +12,68 @@
12
12
 
13
13
  import Foundation
14
14
  import Connect
15
+ import NitroModules
16
+
17
+ // EOCore and Tealeaf ship as separate modules in the Release iOS SDK and in the
18
+ // Debug SDK before 2.1.2. From Debug 2.1.2 onward they are merged into Connect
19
+ // and these modules are no longer on the search path — so we import them
20
+ // conditionally to support both variants from the same source.
21
+ #if canImport(EOCore)
15
22
  import EOCore
23
+ #endif
24
+ #if canImport(Tealeaf)
16
25
  import Tealeaf
17
- import NitroModules
26
+ #endif
27
+
28
+ // In the unified SDK, module-name constants were dropped along with the modules
29
+ // themselves. The replacement helper (`ConnectApplicationHelper`) ignores the
30
+ // module name — a single config store holds all keys. We still keep the old
31
+ // names so existing call sites compile unchanged on both variants.
32
+ #if !canImport(EOCore)
33
+ private let kEOCoreModule = "EOCore"
34
+ private let kTLFCoreModule = "TLFCoreModule"
35
+ #endif
36
+
37
+ // Cross-SDK bridge for the config-item set/get API. On the old SDK this calls
38
+ // through `EOApplicationHelper` with a module name; on the unified SDK it calls
39
+ // through `ConnectApplicationHelper` and the module name is ignored.
40
+ private enum ConnectConfigStore {
41
+ @discardableResult
42
+ static func set(_ key: String, value: Any, forModule moduleName: String) -> Bool {
43
+ #if canImport(EOCore)
44
+ return EOApplicationHelper.sharedInstance().setConfigItem(key, value: value, forModuleName: moduleName)
45
+ #else
46
+ return ConnectApplicationHelper.sharedInstance().setConfigurableItem(key, value: value)
47
+ #endif
48
+ }
49
+
50
+ static func bool(forKey key: String, default def: Bool, moduleName: String) -> Bool {
51
+ #if canImport(EOCore)
52
+ return EOApplicationHelper().getBOOLconfigItem(forKey: key, withDefault: def, forModuleName: moduleName)
53
+ #else
54
+ let raw = ConnectApplicationHelper.sharedInstance().value(forConfigurableItem: key)
55
+ if let n = raw as? NSNumber { return n.boolValue }
56
+ if let s = raw as? String { return (s as NSString).boolValue }
57
+ return def
58
+ #endif
59
+ }
60
+
61
+ static func string(forKey key: String, default def: String, moduleName: String) -> String? {
62
+ #if canImport(EOCore)
63
+ return EOApplicationHelper().getStringItem(forKey: key, withDefault: def, forModuleName: moduleName)
64
+ #else
65
+ return (ConnectApplicationHelper.sharedInstance().value(forConfigurableItem: key) as? String) ?? def
66
+ #endif
67
+ }
68
+
69
+ static func number(forKey key: String, default def: Double, moduleName: String) -> Double {
70
+ #if canImport(EOCore)
71
+ return (EOApplicationHelper().getNumberItem(forKey: key, withDefault: NSNumber(value: def), forModuleName: moduleName) as? NSNumber)?.doubleValue ?? def
72
+ #else
73
+ return (ConnectApplicationHelper.sharedInstance().value(forConfigurableItem: key) as? NSNumber)?.doubleValue ?? def
74
+ #endif
75
+ }
76
+ }
18
77
 
19
78
  class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
20
79
 
@@ -93,16 +152,16 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
93
152
  let connectData = jsonData["Connect"] as? [String: Any] {
94
153
  for (key, value) in connectData {
95
154
  if tealeafKeys.contains(key) {
96
- EOApplicationHelper.sharedInstance().setConfigItem(key, value: value, forModuleName: kTLFCoreModule)
155
+ ConnectConfigStore.set(key, value: value, forModule: kTLFCoreModule)
97
156
  } else if eocoreKeys.contains(key) {
98
- EOApplicationHelper.sharedInstance().setConfigItem(key, value: value, forModuleName: kEOCoreModule)
157
+ ConnectConfigStore.set(key, value: value, forModule: kEOCoreModule)
99
158
  } else if key == "layoutConfig",
100
159
  let layoutConfig = value as? [String: Any] {
101
160
  if let autoLayout = layoutConfig["AutoLayout"] {
102
- EOApplicationHelper.sharedInstance().setConfigItem("AutoLayout", value: autoLayout, forModuleName: kTLFCoreModule)
161
+ ConnectConfigStore.set("AutoLayout", value: autoLayout, forModule: kTLFCoreModule)
103
162
  }
104
163
  if let appendMapIds = layoutConfig["AppendMapIds"] {
105
- EOApplicationHelper.sharedInstance().setConfigItem("AppendMapIds", value: appendMapIds, forModuleName: kTLFCoreModule)
164
+ ConnectConfigStore.set("AppendMapIds", value: appendMapIds, forModule: kTLFCoreModule)
106
165
  }
107
166
  }
108
167
  }
@@ -116,8 +175,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
116
175
  /// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
117
176
  /// - Returns: Whether it was able to set the value as Boolean value.
118
177
  func setBooleanConfigItemForKey(key: String, value: Bool, moduleName: String) throws -> Bool {
119
- let result = EOApplicationHelper().setConfigItem(key, value: value, forModuleName: moduleName)
120
- return result
178
+ return ConnectConfigStore.set(key, value: value, forModule: moduleName)
121
179
  }
122
180
 
123
181
  /// Sets the module's configuration item from AdvancedConfig.json or BasicConfig.plist that matches the specified key as a NString value.
@@ -127,8 +185,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
127
185
  /// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
128
186
  /// - Returns: Whether it was able to set the value as Boolean value.
129
187
  func setStringItemForKey(key: String, value: String, moduleName: String) throws -> Bool {
130
- let result = EOApplicationHelper().setConfigItem(key, value: value, forModuleName: moduleName)
131
- return result
188
+ return ConnectConfigStore.set(key, value: value, forModule: moduleName)
132
189
  }
133
190
 
134
191
  /// Sets the module's configuration item from AdvancedConfig.json or BasicConfig.plist that matches the specified key as a NSNumber value.
@@ -138,8 +195,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
138
195
  /// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
139
196
  /// - Returns: Whether it was able to set the value as Boolean value.
140
197
  func setNumberItemForKey(key: String, value: Double, moduleName: String) throws -> Bool {
141
- let result = EOApplicationHelper().setConfigItem(key, value: value, forModuleName: moduleName)
142
- return result
198
+ return ConnectConfigStore.set(key, value: value, forModule: moduleName)
143
199
  }
144
200
 
145
201
 
@@ -149,9 +205,8 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
149
205
  /// - value: Value to use.
150
206
  /// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
151
207
  /// - Returns: Whether it was able to set the value.
152
- func setConfigItemForKey(key: String, value: Variant_String_Double_Bool, moduleName: String) throws -> Bool {
153
- var result = EOApplicationHelper().setConfigItem(key, value: convertVariantToAny(value), forModuleName: moduleName)
154
- return true
208
+ func setConfigItemForKey(key: String, value: Variant_Bool_String_Double, moduleName: String) throws -> Bool {
209
+ return ConnectConfigStore.set(key, value: convertVariantToAny(value), forModule: moduleName)
155
210
  }
156
211
 
157
212
  /// Gets the module's configuration item from AdvancedConfig.json or BasicConfig.plist that matches the specified key as a BOOL value.
@@ -161,8 +216,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
161
216
  /// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
162
217
  /// - Returns: The value of the configuration item key as a BOOL value.
163
218
  func getBooleanConfigItemForKey(theDefault: Bool, key: String, moduleName: String) throws -> Bool {
164
- var result = EOApplicationHelper().getBOOLconfigItem(forKey: key, withDefault: theDefault, forModuleName: moduleName)
165
- return result
219
+ return ConnectConfigStore.bool(forKey: key, default: theDefault, moduleName: moduleName)
166
220
  }
167
221
 
168
222
  /// Gets the module's configuration item from AdvancedConfig.json or BasicConfig.plist that matches the specified key as a NString value.
@@ -171,9 +225,9 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
171
225
  /// - theDefault: Default value if not found.
172
226
  /// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
173
227
  /// - Returns: The value of the configuration item key as a NString value.
174
- func getStringItemForKey(theDefault: String, key: String, moduleName: String) throws -> String? {
175
- var result = EOApplicationHelper().getStringItem(forKey: key, withDefault: theDefault, forModuleName: moduleName)
176
- return result
228
+ func getStringItemForKey(theDefault: String, key: String, moduleName: String) throws -> Variant_NullType_String? {
229
+ let result = ConnectConfigStore.string(forKey: key, default: theDefault, moduleName: moduleName)
230
+ return result.map { .second($0) }
177
231
  }
178
232
 
179
233
  /// Gets the module's configuration item from AdvancedConfig.json or BasicConfig.plist that matches the specified key as a NSNumber value.
@@ -183,8 +237,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
183
237
  /// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
184
238
  /// - Returns: The value of the configuration item key as a NSNumber value.
185
239
  func getNumberItemForKey(theDefault: Double, key: String, moduleName: String) throws -> Double {
186
- let result = EOApplicationHelper().getNumberItem(forKey: key, withDefault: theDefault as NSNumber, forModuleName: moduleName) as! Double
187
- return result
240
+ return ConnectConfigStore.number(forKey: key, default: theDefault, moduleName: moduleName)
188
241
  }
189
242
 
190
243
  /// Log custom event.
@@ -193,7 +246,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
193
246
  /// - values: additional key value pairs to be logged with the message.
194
247
  /// - level: set a custom log level to the event.
195
248
  /// - Returns: Boolean value will return whether it was able to log the custom event.
196
- func logCustomEvent(eventName: String, values: Dictionary<String, Variant_String_Double_Bool>, level: Double) throws -> Bool {
249
+ func logCustomEvent(eventName: String, values: Dictionary<String, Variant_Bool_String_Double>, level: Double) throws -> Bool {
197
250
  let logLevel = try getLogLevel(level: level)
198
251
  let result = ConnectCustomEvent().logEvent(eventName, values: convertToAnyDictionary(input: values), level: logLevel)
199
252
  return result
@@ -204,7 +257,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
204
257
  /// - values: additional key value pairs to be logged with the signal message.
205
258
  /// - level: set a custom log level to the event.
206
259
  /// - Returns: Boolean value will return whether it was able to log the signal message.
207
- func logSignal(values: Dictionary<String, Variant_String_Double_Bool>, level: Double) throws -> Bool {
260
+ func logSignal(values: Dictionary<String, Variant_Bool_String_Double>, level: Double) throws -> Bool {
208
261
  let logLevel = try getLogLevel(level: level)
209
262
  let result = ConnectCustomEvent().logSignal(convertToAnyDictionary(input: values), level: logLevel)
210
263
  return result
@@ -265,12 +318,12 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
265
318
  /// - controlId: Control id a component from React Native.
266
319
  /// - text: The input string from txt control.
267
320
  /// - Returns: Boolean value will return whether it was able to log the text change event.
268
- func logTextChangeEvent(target: Double, controlId: String, text: String?) throws -> Bool {
321
+ func logTextChangeEvent(target: Double, controlId: String, text: Variant_NullType_String?) throws -> Bool {
269
322
  let view:UIView? = nil
270
323
  var data: [String: Any] = [:]
271
-
272
- if let unwrappedText = text {
273
- data["text"] = unwrappedText
324
+
325
+ if case .second(let str) = text {
326
+ data["text"] = str
274
327
  }
275
328
  let result = ConnectCustomEvent().logTextChange(view, controlId: controlId, data: data)
276
329
  return result
@@ -289,9 +342,11 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
289
342
  /// - logicalPageName: Page name or title e.g. "Login View Controller"; Must not be empty.
290
343
  /// - referrer: Page name or title that loads logicalPageName. Could be empty.
291
344
  /// - Returns: Boolean value will return whether it was able to log the screenview event.
292
- func logScreenViewContextLoad(logicalPageName: String?, referrer: String?) throws -> Bool {
293
- let cllasss = logicalPageName == nil ? "ReactNative" : "ReactNative_\(logicalPageName)"
294
- let result = ConnectCustomEvent().logScreenViewContext(logicalPageName, withClass: cllasss, applicationContext: ConnectScreenViewType.load, referrer: referrer)
345
+ func logScreenViewContextLoad(logicalPageName: Variant_NullType_String?, referrer: Variant_NullType_String?) throws -> Bool {
346
+ let pageName: String? = { if case .second(let s) = logicalPageName { return s }; return nil }()
347
+ let ref: String? = { if case .second(let s) = referrer { return s }; return nil }()
348
+ let cllasss = pageName == nil ? "ReactNative" : "ReactNative_\(pageName!)"
349
+ let result = ConnectCustomEvent().logScreenViewContext(pageName, withClass: cllasss, applicationContext: ConnectScreenViewType.load, referrer: ref)
295
350
  return result
296
351
  }
297
352
 
@@ -300,9 +355,11 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
300
355
  /// - logicalPageName: Page name or title e.g. "Login View Controller"; Must not be empty.
301
356
  /// - referrer: Page name or title that loads logicalPageName. Could be empty.
302
357
  /// - Returns: Boolean value will return whether it was able to log the screenview event.
303
- func logScreenViewContextUnload(logicalPageName: String?, referrer: String?) throws -> Bool {
304
- let cllasss = logicalPageName == nil ? "ReactNative" : "ReactNative_\(logicalPageName)"
305
- let result = ConnectCustomEvent().logScreenViewContext(logicalPageName, withClass: cllasss, applicationContext: ConnectScreenViewType.unload, referrer: referrer)
358
+ func logScreenViewContextUnload(logicalPageName: Variant_NullType_String?, referrer: Variant_NullType_String?) throws -> Bool {
359
+ let pageName: String? = { if case .second(let s) = logicalPageName { return s }; return nil }()
360
+ let ref: String? = { if case .second(let s) = referrer { return s }; return nil }()
361
+ let cllasss = pageName == nil ? "ReactNative" : "ReactNative_\(pageName!)"
362
+ let result = ConnectCustomEvent().logScreenViewContext(pageName, withClass: cllasss, applicationContext: ConnectScreenViewType.unload, referrer: ref)
306
363
  return result
307
364
  }
308
365
 
@@ -382,7 +439,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
382
439
  /// - eventName: The name of the custom event.
383
440
  /// - values: A map of values associated with the event.
384
441
  /// - Returns: Boolean value will return whether it was able to log the dialog custom event.
385
- func logDialogCustomEvent(dialogId: String, eventName: String, values: Dictionary<String, Variant_String_Double_Bool>) throws -> Bool {
442
+ func logDialogCustomEvent(dialogId: String, eventName: String, values: Dictionary<String, Variant_Bool_String_Double>) throws -> Bool {
386
443
  var eventValues: [String: Any] = [
387
444
  "dialogId": dialogId,
388
445
  "customEventName": eventName,
@@ -406,31 +463,31 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
406
463
  return moduleName
407
464
  }
408
465
 
409
- func convertToAnyDictionary(input: [String: Variant_String_Double_Bool]) -> [String: Any] {
466
+ func convertToAnyDictionary(input: [String: Variant_Bool_String_Double]) -> [String: Any] {
410
467
  var result: [String: Any] = [:]
411
-
468
+
412
469
  for (key, value) in input {
413
470
  switch value {
414
- case .first(let stringValue):
471
+ case .first(let boolValue):
472
+ result[key] = boolValue
473
+ case .second(let stringValue):
415
474
  result[key] = stringValue
416
- case .second(let doubleValue):
475
+ case .third(let doubleValue):
417
476
  result[key] = doubleValue
418
- case .third(let boolValue):
419
- result[key] = boolValue
420
477
  }
421
478
  }
422
-
479
+
423
480
  return result
424
481
  }
425
-
426
- func convertVariantToAny(_ variant: Variant_String_Double_Bool) -> Any {
482
+
483
+ func convertVariantToAny(_ variant: Variant_Bool_String_Double) -> Any {
427
484
  switch variant {
428
- case .first(let stringValue):
485
+ case .first(let boolValue):
486
+ return boolValue
487
+ case .second(let stringValue):
429
488
  return stringValue
430
- case .second(let doubleValue):
489
+ case .third(let doubleValue):
431
490
  return doubleValue
432
- case .third(let boolValue):
433
- return boolValue
434
491
  }
435
492
  }
436
493
 
@@ -1 +1 @@
1
- * linguist-generated
1
+ ** linguist-generated=true