react-native-acoustic-connect-beta 19.0.5 → 19.0.7
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/AcousticConnectRN.podspec +34 -1
- package/CHANGELOG.md +6 -0
- package/android/build.gradle +71 -0
- package/android/src/main/assets/ConnectBasicConfig.properties +1 -1
- package/android/src/main/java/com/acousticconnectrn/HybridAcousticConnectRN.kt +4 -2
- package/ios/ConnectRNParsing.swift +154 -0
- package/ios/HybridAcousticConnectRN.swift +15 -115
- package/package.json +3 -1
|
@@ -115,12 +115,45 @@ Pod::Spec.new do |s|
|
|
|
115
115
|
# Implementation (C++ objects)
|
|
116
116
|
"cpp/**/*.{hpp,cpp}",
|
|
117
117
|
]
|
|
118
|
+
# Unit tests live in ios/Tests and belong to the UnitTests test_spec below,
|
|
119
|
+
# not to the library target (source_files globs ios/**/*.swift).
|
|
120
|
+
s.exclude_files = "ios/Tests/**"
|
|
118
121
|
|
|
119
122
|
s.pod_target_xcconfig = {
|
|
120
123
|
# C++ compiler flags, mainly for folly.
|
|
121
|
-
"GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) FOLLY_NO_CONFIG FOLLY_CFG_NO_COROUTINES"
|
|
124
|
+
"GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) FOLLY_NO_CONFIG FOLLY_CFG_NO_COROUTINES",
|
|
125
|
+
# @testable import (UnitTests test_spec) needs testability in Debug.
|
|
126
|
+
"ENABLE_TESTABILITY[config=Debug]" => "YES"
|
|
122
127
|
}
|
|
123
128
|
|
|
129
|
+
# Native unit tests. Run through a consumer app's Pods project:
|
|
130
|
+
# Podfile: pod 'AcousticConnectRN', :path => '../..', :testspecs => ['UnitTests']
|
|
131
|
+
# xcodebuild test -workspace <app>.xcworkspace -scheme AcousticConnectRN \
|
|
132
|
+
# -destination 'platform=iOS Simulator,name=<booted sim>'
|
|
133
|
+
# The tests use Swift Testing. They do NOT `@testable import` the pod
|
|
134
|
+
# module — see the source_files comment below for why that's impossible.
|
|
135
|
+
s.test_spec 'UnitTests' do |ts|
|
|
136
|
+
# The sources under test are compiled directly into the test bundle
|
|
137
|
+
# instead of `@testable import`ing the pod module: nitrogen's generated
|
|
138
|
+
# Swift compatibility header emits C++ thunks referencing nitro C++ types
|
|
139
|
+
# (margelo::nitro::ArrayBufferHolder) without including their headers, so
|
|
140
|
+
# the AcousticConnectRN clang module cannot be built by any Swift client —
|
|
141
|
+
# including a test target. Compiling the files here is safe: the linker
|
|
142
|
+
# pulls static-archive members lazily, so the parent lib's copies of
|
|
143
|
+
# these objects are never loaded and no duplicate symbols arise.
|
|
144
|
+
ts.source_files = [
|
|
145
|
+
'ios/Tests/**/*.swift',
|
|
146
|
+
'ios/ConnectRNParsing.swift',
|
|
147
|
+
'nitrogen/generated/ios/swift/Variant_Bool_String_Double.swift',
|
|
148
|
+
]
|
|
149
|
+
# ios/ConnectRNParsing.swift does `import Connect`. CocoaPods test_specs
|
|
150
|
+
# inherit the parent spec's dependencies implicitly, so this line is
|
|
151
|
+
# observably redundant today — declared explicitly anyway so the test
|
|
152
|
+
# bundle's dependency on the Connect SDK doesn't rely on that inheritance
|
|
153
|
+
# behavior remaining unchanged (e.g. a future migration off CocoaPods).
|
|
154
|
+
ts.dependency dependencyName, *dependencyRequirements
|
|
155
|
+
end
|
|
156
|
+
|
|
124
157
|
s.resource_bundle = {
|
|
125
158
|
'AcousticConnectRNConfig' => ['ios/AcousticConnectRNConfig.json'],
|
|
126
159
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 19.0.7 (2026-07-03)
|
|
2
|
+
|
|
3
|
+
### Reverts
|
|
4
|
+
|
|
5
|
+
* Revert "Beta ReactNativeConnect build: 18.0.36" ([609ad7d](https://github.com/aipoweredmarketer/react-native-acoustic-connect-beta/commit/609ad7d3244ec06f27dced5864d40585c5b3c9cf))
|
|
6
|
+
## [19.0.6](https://github.com/aipoweredmarketer/react-native-acoustic-connect-beta/compare/19.0.5...19.0.6) (2026-07-02)
|
|
1
7
|
## [19.0.5](https://github.com/aipoweredmarketer/react-native-acoustic-connect-beta/compare/19.0.4...19.0.5) (2026-07-02)
|
|
2
8
|
## [19.0.4](https://github.com/aipoweredmarketer/react-native-acoustic-connect-beta/compare/19.0.3...19.0.4) (2026-07-01)
|
|
3
9
|
## [19.0.3](https://github.com/aipoweredmarketer/react-native-acoustic-connect-beta/compare/19.0.2...19.0.3) (2026-06-30)
|
package/android/build.gradle
CHANGED
|
@@ -32,6 +32,7 @@ def isNewArchitectureEnabled() {
|
|
|
32
32
|
|
|
33
33
|
apply plugin: "com.android.library"
|
|
34
34
|
apply plugin: 'org.jetbrains.kotlin.android'
|
|
35
|
+
apply plugin: 'jacoco'
|
|
35
36
|
apply from: '../nitrogen/generated/android/AcousticConnectRN+autolinking.gradle'
|
|
36
37
|
|
|
37
38
|
if (isNewArchitectureEnabled()) {
|
|
@@ -117,6 +118,17 @@ android {
|
|
|
117
118
|
disable "GradleCompatible"
|
|
118
119
|
}
|
|
119
120
|
|
|
121
|
+
testOptions {
|
|
122
|
+
unitTests {
|
|
123
|
+
// Unstubbed android.jar methods return defaults instead of throwing —
|
|
124
|
+
// needed for the few framework calls Robolectric doesn't cover.
|
|
125
|
+
returnDefaultValues = true
|
|
126
|
+
// Robolectric needs the library manifest + resources on the test
|
|
127
|
+
// classpath.
|
|
128
|
+
includeAndroidResources = true
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
120
132
|
compileOptions {
|
|
121
133
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
122
134
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
@@ -233,3 +245,62 @@ if (isNewArchitectureEnabled()) {
|
|
|
233
245
|
codegenJavaPackageName = "com.acousticconnectrn"
|
|
234
246
|
}
|
|
235
247
|
}
|
|
248
|
+
|
|
249
|
+
// JVM unit tests (android/src/test) — run from a consumer app's gradle, e.g.
|
|
250
|
+
// cd example/android && ./gradlew :react-native-acoustic-connect-beta:testDebugUnitTest
|
|
251
|
+
// No emulator: testDebugUnitTest does not trigger externalNativeBuild/CMake.
|
|
252
|
+
// RN + nitro are compileOnly above (provided by the host app), so they are
|
|
253
|
+
// re-declared for the test runtime classpath; the Connect SDK is already
|
|
254
|
+
// `implementation` and flows to tests automatically. Note: nitro's Promise is
|
|
255
|
+
// JNI-backed, so the push*/logIdentity Promise-returning methods cannot be
|
|
256
|
+
// exercised in JVM tests — they are covered by the sample-build CI gates.
|
|
257
|
+
dependencies {
|
|
258
|
+
testImplementation "junit:junit:4.13.2"
|
|
259
|
+
testImplementation "io.mockk:mockk:1.13.16"
|
|
260
|
+
// @Config(sdk = [35]) in the tests until Robolectric supports SDK 36.
|
|
261
|
+
testImplementation "org.robolectric:robolectric:4.14.1"
|
|
262
|
+
// Deliberately `+`, matching the compileOnly declaration above: this
|
|
263
|
+
// coordinate never resolves from a repository — the RN Gradle plugin
|
|
264
|
+
// substitutes it with the HOST app's `com.facebook.react:react-android`
|
|
265
|
+
// at resolution time, so tests always run against the same RN version the
|
|
266
|
+
// consuming build uses. Pinning (e.g. `0.82.1`) would name an artifact
|
|
267
|
+
// version that doesn't exist on Maven for RN >= 0.72 and adds only false
|
|
268
|
+
// precision; without the substitution both forms fail loudly.
|
|
269
|
+
//noinspection GradleDynamicVersion
|
|
270
|
+
testImplementation "com.facebook.react:react-native:+"
|
|
271
|
+
testImplementation project(":react-native-nitro-modules")
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// Coverage for the JVM unit tests. Robolectric needs
|
|
275
|
+
// includeNoLocationClasses to attribute coverage to instrumented classes.
|
|
276
|
+
tasks.withType(Test).configureEach {
|
|
277
|
+
jacoco {
|
|
278
|
+
includeNoLocationClasses = true
|
|
279
|
+
excludes = ['jdk.internal.*']
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// XML (parsed by the Jenkins Slack summary) + HTML (archived artifact)
|
|
284
|
+
// coverage report over the debug unit tests. Registered afterEvaluate
|
|
285
|
+
// because AGP creates the variant test task then. Generated nitro bindings
|
|
286
|
+
// are excluded — they are codegen output, not logic this module owns.
|
|
287
|
+
project.afterEvaluate {
|
|
288
|
+
tasks.register('jacocoDebugUnitTestReport', JacocoReport) {
|
|
289
|
+
dependsOn 'testDebugUnitTest'
|
|
290
|
+
group = 'verification'
|
|
291
|
+
description = 'JaCoCo coverage report for the debug JVM unit tests.'
|
|
292
|
+
|
|
293
|
+
def generatedExcludes = ['com/margelo/nitro/**', '**/BuildConfig*']
|
|
294
|
+
classDirectories.setFrom(files(
|
|
295
|
+
fileTree(dir: "${buildDir}/tmp/kotlin-classes/debug", excludes: generatedExcludes),
|
|
296
|
+
fileTree(dir: "${buildDir}/intermediates/javac/debug", includes: ['**/classes/**'], excludes: generatedExcludes)
|
|
297
|
+
))
|
|
298
|
+
sourceDirectories.setFrom(files("${projectDir}/src/main/java"))
|
|
299
|
+
executionData.setFrom(fileTree(dir: buildDir, includes: ['jacoco/testDebugUnitTest.exec']))
|
|
300
|
+
|
|
301
|
+
reports {
|
|
302
|
+
xml.required = true
|
|
303
|
+
html.required = true
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
@@ -1206,7 +1206,8 @@ class HybridAcousticConnectRN : HybridAcousticConnectRNSpec(),
|
|
|
1206
1206
|
* @param values The map to be converted.
|
|
1207
1207
|
* @return A HashMap<String?, String?> representation of the input map which library can use.
|
|
1208
1208
|
*/
|
|
1209
|
-
|
|
1209
|
+
// internal (not private) so the unit tests in src/test can exercise it.
|
|
1210
|
+
internal fun convertToMap(values: Map<String, Variant_Boolean_String_Double>): HashMap<String?, String?> {
|
|
1210
1211
|
val map = HashMap<String?, String?>()
|
|
1211
1212
|
for (key in values.keys) {
|
|
1212
1213
|
val value = values[key]
|
|
@@ -1223,7 +1224,8 @@ class HybridAcousticConnectRN : HybridAcousticConnectRNSpec(),
|
|
|
1223
1224
|
* @param values The map to be converted.
|
|
1224
1225
|
* @return A HashMap<String?, String?> representation of the input map which library can use.
|
|
1225
1226
|
*/
|
|
1226
|
-
|
|
1227
|
+
// internal (not private) so the unit tests in src/test can exercise it.
|
|
1228
|
+
internal fun convertToMapAny(values: Map<String, Variant_Boolean_String_Double>): java.util.HashMap<String?, Any?>? {
|
|
1227
1229
|
val map = HashMap<String?, Any?>()
|
|
1228
1230
|
for (key in values.keys) {
|
|
1229
1231
|
val value = values[key]
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// Copyright (C) 2026 Acoustic, L.P. All rights reserved.
|
|
2
|
+
//
|
|
3
|
+
// NOTICE: This file contains material that is confidential and proprietary to
|
|
4
|
+
// Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
5
|
+
// industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
6
|
+
// Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
7
|
+
// prohibited.
|
|
8
|
+
|
|
9
|
+
import Foundation
|
|
10
|
+
import Connect
|
|
11
|
+
import OSLog
|
|
12
|
+
|
|
13
|
+
// Same subsystem/category as the bridge's config logger so the extraction
|
|
14
|
+
// does not change where these lines surface in Console.app.
|
|
15
|
+
private let configLog = Logger(subsystem: "com.acoustic.AcousticConnectRN", category: "config")
|
|
16
|
+
|
|
17
|
+
/// Pure parsing / mapping / conversion logic extracted from
|
|
18
|
+
/// `HybridAcousticConnectRN` (behaviour-preserving extraction) so it can be
|
|
19
|
+
/// unit-tested without constructing the hybrid — the hybrid's `init`
|
|
20
|
+
/// dispatches `load()`, which enables the real SDK with the bundled AppKey.
|
|
21
|
+
internal enum ConnectRNParsing {
|
|
22
|
+
|
|
23
|
+
internal enum IOSPushMode: Equatable {
|
|
24
|
+
case automatic, manual
|
|
25
|
+
var descriptor: String { self == .automatic ? "automatic" : "manual" }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/// Lenient `PushEnabled` parser — accepts a `Bool` directly, or a string
|
|
29
|
+
/// like `"true"`/`"false"`/`"yes"`/`"no"`. Anything else falls back to
|
|
30
|
+
/// `false` with a warning so a typo in the JSON doesn't silently enable
|
|
31
|
+
/// push when the developer thought they'd turned it off.
|
|
32
|
+
static func parsePushEnabled(_ raw: Any?) -> Bool {
|
|
33
|
+
if let b = raw as? Bool { return b }
|
|
34
|
+
if let n = raw as? NSNumber { return n.boolValue }
|
|
35
|
+
if let s = raw as? String {
|
|
36
|
+
switch s.lowercased() {
|
|
37
|
+
case "true", "yes", "1": return true
|
|
38
|
+
case "false", "no", "0", "": return false
|
|
39
|
+
default:
|
|
40
|
+
configLog.warning("PushEnabled string \"\(s, privacy: .public)\" not recognised. Falling back to false.")
|
|
41
|
+
return false
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if raw != nil {
|
|
45
|
+
configLog.warning("PushEnabled is set but is neither a Bool nor a recognised string. Falling back to false.")
|
|
46
|
+
}
|
|
47
|
+
return false
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static func parseIOSPushMode(_ raw: String?) -> IOSPushMode {
|
|
51
|
+
switch raw?.lowercased() {
|
|
52
|
+
case "automatic", "auto", nil, "":
|
|
53
|
+
return .automatic
|
|
54
|
+
case "manual":
|
|
55
|
+
return .manual
|
|
56
|
+
default:
|
|
57
|
+
configLog.error("iOSPushMode \"\(raw ?? "", privacy: .public)\" not recognised. Allowed values: \"automatic\", \"manual\". Falling back to \"automatic\".")
|
|
58
|
+
return .automatic
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/// Resolves `PushEnabled` + `iOSPushMode` + `iOSAppGroupIdentifier` from the
|
|
63
|
+
/// bundled config into a `ConnectPushConfig`. Validation errors are logged
|
|
64
|
+
/// at `.error`; soft mismatches at `.warning`. The SDK always falls back to
|
|
65
|
+
/// a safe default (`.off`) so an invalid config never crashes the app.
|
|
66
|
+
static func resolvePushConfig(from connectData: [String: Any]) -> ConnectPushConfig {
|
|
67
|
+
let pushEnabled = parsePushEnabled(connectData["PushEnabled"])
|
|
68
|
+
let iOSPushModeRaw = connectData["iOSPushMode"] as? String
|
|
69
|
+
let groupId = connectData["iOSAppGroupIdentifier"] as? String
|
|
70
|
+
|
|
71
|
+
configLog.info("PushEnabled: \(pushEnabled)")
|
|
72
|
+
|
|
73
|
+
// Inconsistency: iOSPushMode is set but PushEnabled is false. The
|
|
74
|
+
// mode value would never take effect; warn the developer so they
|
|
75
|
+
// know to fix one or the other.
|
|
76
|
+
if !pushEnabled, let raw = iOSPushModeRaw, !raw.isEmpty {
|
|
77
|
+
configLog.error("iOSPushMode \"\(raw, privacy: .public)\" is set but PushEnabled is false. Ignoring iOSPushMode; SDK will run with push disabled.")
|
|
78
|
+
return .off
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
guard pushEnabled else {
|
|
82
|
+
configLog.info("iOSPushMode: (not used, PushEnabled is false)")
|
|
83
|
+
configLog.info("iOSAppGroupIdentifier: (not used, PushEnabled is false)")
|
|
84
|
+
return .off
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
let mode = parseIOSPushMode(iOSPushModeRaw)
|
|
88
|
+
configLog.info("iOSPushMode: \(mode.descriptor, privacy: .public)")
|
|
89
|
+
if let groupId = groupId, !groupId.isEmpty {
|
|
90
|
+
configLog.info("iOSAppGroupIdentifier: \(groupId, privacy: .public)")
|
|
91
|
+
} else {
|
|
92
|
+
configLog.warning("iOSAppGroupIdentifier is not set. Required if your app uses a Notification Service or Notification Content extension to render rich push payloads.")
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
switch mode {
|
|
96
|
+
case .automatic:
|
|
97
|
+
return ConnectPushConfig(mode: .automatic, appGroupIdentifier: groupId)
|
|
98
|
+
case .manual:
|
|
99
|
+
return ConnectPushConfig(mode: .manual, appGroupIdentifier: groupId)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Note: nsError(from: PushErrorInfo) stays in HybridAcousticConnectRN —
|
|
104
|
+
// PushErrorInfo is a C++-backed nitro type, and this file is also
|
|
105
|
+
// compiled into the UnitTests bundle, which builds without C++ interop.
|
|
106
|
+
|
|
107
|
+
/// Maps the JS-facing module name to the config store's module name
|
|
108
|
+
/// ("Connect" → "TLFCoreModule").
|
|
109
|
+
static func storeModuleName(for moduleName: String) -> String {
|
|
110
|
+
if moduleName.caseInsensitiveCompare("Connect") == .orderedSame {
|
|
111
|
+
return "TLFCoreModule"
|
|
112
|
+
}
|
|
113
|
+
return moduleName
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
static func convertToAnyDictionary(input: [String: Variant_Bool_String_Double]) -> [String: Any] {
|
|
117
|
+
var result: [String: Any] = [:]
|
|
118
|
+
|
|
119
|
+
for (key, value) in input {
|
|
120
|
+
switch value {
|
|
121
|
+
case .first(let boolValue):
|
|
122
|
+
result[key] = boolValue
|
|
123
|
+
case .second(let stringValue):
|
|
124
|
+
result[key] = stringValue
|
|
125
|
+
case .third(let doubleValue):
|
|
126
|
+
result[key] = doubleValue
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return result
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
static func convertVariantToAny(_ variant: Variant_Bool_String_Double) -> Any {
|
|
134
|
+
switch variant {
|
|
135
|
+
case .first(let boolValue):
|
|
136
|
+
return boolValue
|
|
137
|
+
case .second(let stringValue):
|
|
138
|
+
return stringValue
|
|
139
|
+
case .third(let doubleValue):
|
|
140
|
+
return doubleValue
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
static func logLevel(from level: Double) -> kConnectMonitoringLevelType {
|
|
145
|
+
let intValue: Int = Int(level)
|
|
146
|
+
if intValue == 0 {
|
|
147
|
+
return kConnectMonitoringLevelType.connectMonitoringLevelIgnore
|
|
148
|
+
} else if intValue == 1 {
|
|
149
|
+
return kConnectMonitoringLevelType.connectMonitoringLevelCellularAndWiFi
|
|
150
|
+
} else {
|
|
151
|
+
return kConnectMonitoringLevelType.connectMonitoringLevelWiFi
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -143,7 +143,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
143
143
|
configLog.info("KillSwitchUrl: \(killSwitch, privacy: .public)")
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
let pushConfig =
|
|
146
|
+
let pushConfig = ConnectRNParsing.resolvePushConfig(from: connectData)
|
|
147
147
|
|
|
148
148
|
// Non-release integrations (useRelease:false — the AcousticConnectDebug
|
|
149
149
|
// SDK variant) turn on the Connect/Tealeaf/EOCore verbose native logging
|
|
@@ -174,84 +174,9 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
174
174
|
bridgeLog.info("SDK initialised: appKey length=\(appKey.count), push=\(pushConfig.modeDescription, privacy: .public), isReactNative=true, wrapNavigationContainer=true")
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
/// a safe default (`.off`) so an invalid config never crashes the app.
|
|
181
|
-
@MainActor
|
|
182
|
-
private func resolvePushConfig(from connectData: [String: Any]) -> ConnectPushConfig {
|
|
183
|
-
let pushEnabled = self.parsePushEnabled(connectData["PushEnabled"])
|
|
184
|
-
let iOSPushModeRaw = connectData["iOSPushMode"] as? String
|
|
185
|
-
let groupId = connectData["iOSAppGroupIdentifier"] as? String
|
|
186
|
-
|
|
187
|
-
configLog.info("PushEnabled: \(pushEnabled)")
|
|
188
|
-
|
|
189
|
-
// Inconsistency: iOSPushMode is set but PushEnabled is false. The
|
|
190
|
-
// mode value would never take effect; warn the developer so they
|
|
191
|
-
// know to fix one or the other.
|
|
192
|
-
if !pushEnabled, let raw = iOSPushModeRaw, !raw.isEmpty {
|
|
193
|
-
configLog.error("iOSPushMode \"\(raw, privacy: .public)\" is set but PushEnabled is false. Ignoring iOSPushMode; SDK will run with push disabled.")
|
|
194
|
-
return .off
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
guard pushEnabled else {
|
|
198
|
-
configLog.info("iOSPushMode: (not used, PushEnabled is false)")
|
|
199
|
-
configLog.info("iOSAppGroupIdentifier: (not used, PushEnabled is false)")
|
|
200
|
-
return .off
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
let mode = self.parseIOSPushMode(iOSPushModeRaw)
|
|
204
|
-
configLog.info("iOSPushMode: \(mode.descriptor, privacy: .public)")
|
|
205
|
-
if let groupId = groupId, !groupId.isEmpty {
|
|
206
|
-
configLog.info("iOSAppGroupIdentifier: \(groupId, privacy: .public)")
|
|
207
|
-
} else {
|
|
208
|
-
configLog.warning("iOSAppGroupIdentifier is not set. Required if your app uses a Notification Service or Notification Content extension to render rich push payloads.")
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
switch mode {
|
|
212
|
-
case .automatic:
|
|
213
|
-
return ConnectPushConfig(mode: .automatic, appGroupIdentifier: groupId)
|
|
214
|
-
case .manual:
|
|
215
|
-
return ConnectPushConfig(mode: .manual, appGroupIdentifier: groupId)
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/// Lenient `PushEnabled` parser — accepts a `Bool` directly, or a string
|
|
220
|
-
/// like `"true"`/`"false"`/`"yes"`/`"no"`. Anything else falls back to
|
|
221
|
-
/// `false` with a warning so a typo in the JSON doesn't silently enable
|
|
222
|
-
/// push when the developer thought they'd turned it off.
|
|
223
|
-
private func parsePushEnabled(_ raw: Any?) -> Bool {
|
|
224
|
-
if let b = raw as? Bool { return b }
|
|
225
|
-
if let n = raw as? NSNumber { return n.boolValue }
|
|
226
|
-
if let s = raw as? String {
|
|
227
|
-
switch s.lowercased() {
|
|
228
|
-
case "true", "yes", "1": return true
|
|
229
|
-
case "false", "no", "0", "": return false
|
|
230
|
-
default:
|
|
231
|
-
configLog.warning("PushEnabled string \"\(s, privacy: .public)\" not recognised. Falling back to false.")
|
|
232
|
-
return false
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
if raw != nil {
|
|
236
|
-
configLog.warning("PushEnabled is set but is neither a Bool nor a recognised string. Falling back to false.")
|
|
237
|
-
}
|
|
238
|
-
return false
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
private enum IOSPushMode { case automatic, manual
|
|
242
|
-
var descriptor: String { self == .automatic ? "automatic" : "manual" } }
|
|
243
|
-
|
|
244
|
-
private func parseIOSPushMode(_ raw: String?) -> IOSPushMode {
|
|
245
|
-
switch raw?.lowercased() {
|
|
246
|
-
case "automatic", "auto", nil, "":
|
|
247
|
-
return .automatic
|
|
248
|
-
case "manual":
|
|
249
|
-
return .manual
|
|
250
|
-
default:
|
|
251
|
-
configLog.error("iOSPushMode \"\(raw ?? "", privacy: .public)\" not recognised. Allowed values: \"automatic\", \"manual\". Falling back to \"automatic\".")
|
|
252
|
-
return .automatic
|
|
253
|
-
}
|
|
254
|
-
}
|
|
177
|
+
// Push-config resolution and the PushEnabled / iOSPushMode parsers moved
|
|
178
|
+
// to ConnectRNParsing (behaviour-preserving extraction) so
|
|
179
|
+
// they are unit-testable without constructing this hybrid.
|
|
255
180
|
|
|
256
181
|
/// Reads and returns the `Connect` dictionary from the bundled
|
|
257
182
|
/// `AcousticConnectRNConfig.json`. The bundle is populated at pod install
|
|
@@ -488,7 +413,10 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
488
413
|
// MARK: - Push: helpers
|
|
489
414
|
|
|
490
415
|
/// Builds an `NSError` from the structured bridge error object, shared by
|
|
491
|
-
/// `pushDidFailToRegister` and `pushDidReceiveAuthorization`.
|
|
416
|
+
/// `pushDidFailToRegister` and `pushDidReceiveAuthorization`. Kept here
|
|
417
|
+
/// (not in ConnectRNParsing) because `PushErrorInfo` is a C++-backed
|
|
418
|
+
/// nitro type and ConnectRNParsing is also compiled into the UnitTests
|
|
419
|
+
/// bundle, which builds without C++ interop.
|
|
492
420
|
private static func nsError(from info: PushErrorInfo) -> NSError {
|
|
493
421
|
NSError(
|
|
494
422
|
domain: info.domain ?? "ConnectRNBridge",
|
|
@@ -816,39 +744,18 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
816
744
|
return true
|
|
817
745
|
}
|
|
818
746
|
|
|
747
|
+
// The bodies below moved to ConnectRNParsing (behaviour-preserving
|
|
748
|
+
// extraction); these thin delegates keep the class API stable.
|
|
819
749
|
func testModuleName(moduleName: String) throws -> String {
|
|
820
|
-
|
|
821
|
-
return "TLFCoreModule"
|
|
822
|
-
}
|
|
823
|
-
return moduleName
|
|
750
|
+
return ConnectRNParsing.storeModuleName(for: moduleName)
|
|
824
751
|
}
|
|
825
|
-
|
|
826
|
-
func convertToAnyDictionary(input: [String: Variant_Bool_String_Double]) -> [String: Any] {
|
|
827
|
-
var result: [String: Any] = [:]
|
|
828
|
-
|
|
829
|
-
for (key, value) in input {
|
|
830
|
-
switch value {
|
|
831
|
-
case .first(let boolValue):
|
|
832
|
-
result[key] = boolValue
|
|
833
|
-
case .second(let stringValue):
|
|
834
|
-
result[key] = stringValue
|
|
835
|
-
case .third(let doubleValue):
|
|
836
|
-
result[key] = doubleValue
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
752
|
|
|
840
|
-
|
|
753
|
+
func convertToAnyDictionary(input: [String: Variant_Bool_String_Double]) -> [String: Any] {
|
|
754
|
+
return ConnectRNParsing.convertToAnyDictionary(input: input)
|
|
841
755
|
}
|
|
842
756
|
|
|
843
757
|
func convertVariantToAny(_ variant: Variant_Bool_String_Double) -> Any {
|
|
844
|
-
|
|
845
|
-
case .first(let boolValue):
|
|
846
|
-
return boolValue
|
|
847
|
-
case .second(let stringValue):
|
|
848
|
-
return stringValue
|
|
849
|
-
case .third(let doubleValue):
|
|
850
|
-
return doubleValue
|
|
851
|
-
}
|
|
758
|
+
return ConnectRNParsing.convertVariantToAny(variant)
|
|
852
759
|
}
|
|
853
760
|
|
|
854
761
|
// func convertKeyValueMapToDictionary(_ keyValueMap: KeyValueMap) -> [AnyHashable: Any] {
|
|
@@ -863,14 +770,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
863
770
|
// }
|
|
864
771
|
|
|
865
772
|
func getLogLevelHelper(level: Double) throws -> kConnectMonitoringLevelType {
|
|
866
|
-
|
|
867
|
-
if intValue == 0 {
|
|
868
|
-
return kConnectMonitoringLevelType.connectMonitoringLevelIgnore
|
|
869
|
-
} else if intValue == 1 {
|
|
870
|
-
return kConnectMonitoringLevelType.connectMonitoringLevelCellularAndWiFi
|
|
871
|
-
} else {
|
|
872
|
-
return kConnectMonitoringLevelType.connectMonitoringLevelWiFi
|
|
873
|
-
}
|
|
773
|
+
return ConnectRNParsing.logLevel(from: level)
|
|
874
774
|
}
|
|
875
775
|
|
|
876
776
|
func getLogLevel(level: Double) throws -> kConnectMonitoringLevelType {
|
package/package.json
CHANGED
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"android/gradle.properties",
|
|
77
77
|
"android/CMakeLists.txt",
|
|
78
78
|
"android/src",
|
|
79
|
+
"!android/src/test/**",
|
|
79
80
|
"android/config.gradle",
|
|
80
81
|
"android/src/main/assets/**",
|
|
81
82
|
"ios/**/*.h",
|
|
@@ -83,6 +84,7 @@
|
|
|
83
84
|
"ios/**/*.mm",
|
|
84
85
|
"ios/**/*.cpp",
|
|
85
86
|
"ios/**/*.swift",
|
|
87
|
+
"!ios/Tests/**",
|
|
86
88
|
"ios/AcousticConnectRNConfig.json",
|
|
87
89
|
"app.plugin.js",
|
|
88
90
|
"plugin/build",
|
|
@@ -225,7 +227,7 @@
|
|
|
225
227
|
"source": "src/index",
|
|
226
228
|
"summary": "react-native ios android tealeaf connect cxa wxca er enhanced-replay",
|
|
227
229
|
"types": "./lib/typescript/src/index.d.ts",
|
|
228
|
-
"version": "19.0.
|
|
230
|
+
"version": "19.0.7",
|
|
229
231
|
"workspaces": [
|
|
230
232
|
"example",
|
|
231
233
|
"Examples/bare-workflow"
|