react-native-acoustic-connect-beta 18.0.22 → 18.0.24
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 +24 -4
- package/README.md +237 -67
- package/android/build.gradle +47 -2
- package/android/gradle.properties +3 -3
- package/android/src/main/assets/ConnectAdvancedConfig.json +1 -1
- package/android/src/main/assets/ConnectBasicConfig.properties +1 -1
- package/android/src/main/assets/TealeafAdvancedConfig.json +1 -1
- package/android/src/main/java/com/acousticconnectrn/AcousticConnectRNPackage.java +9 -32
- package/android/src/main/java/com/acousticconnectrn/HybridAcousticConnectRN.kt +258 -87
- package/ios/HybridAcousticConnectRN.swift +181 -73
- package/lib/commonjs/TLTRN.js +18 -12
- package/lib/commonjs/TLTRN.js.map +1 -1
- package/lib/commonjs/components/Connect.js +3 -0
- package/lib/commonjs/components/Connect.js.map +1 -1
- package/lib/module/TLTRN.js +18 -12
- package/lib/module/TLTRN.js.map +1 -1
- package/lib/module/components/Connect.js +3 -0
- package/lib/module/components/Connect.js.map +1 -1
- package/lib/typescript/src/TLTRN.d.ts.map +1 -1
- package/lib/typescript/src/components/Connect.d.ts.map +1 -1
- package/lib/typescript/src/specs/react-native-acoustic-connect.nitro.d.ts +62 -0
- package/lib/typescript/src/specs/react-native-acoustic-connect.nitro.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridAcousticConnectRNSpec.cpp +10 -0
- package/nitrogen/generated/android/c++/JHybridAcousticConnectRNSpec.hpp +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/HybridAcousticConnectRNSpec.kt +8 -0
- package/nitrogen/generated/ios/c++/HybridAcousticConnectRNSpecSwift.hpp +16 -0
- package/nitrogen/generated/ios/swift/HybridAcousticConnectRNSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridAcousticConnectRNSpec_cxx.swift +24 -0
- package/nitrogen/generated/shared/c++/HybridAcousticConnectRNSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridAcousticConnectRNSpec.hpp +2 -0
- package/package.json +7 -4
- package/scripts/ConnectConfig.json +1 -1
- package/src/TLTRN.ts +23 -16
- package/src/components/Connect.tsx +3 -0
- package/src/specs/react-native-acoustic-connect.nitro.ts +63 -0
|
@@ -8,6 +8,68 @@ export interface AcousticConnectRN extends HybridObject<{
|
|
|
8
8
|
ios: 'swift';
|
|
9
9
|
android: 'kotlin';
|
|
10
10
|
}> {
|
|
11
|
+
/**
|
|
12
|
+
* Re-enables the Connect SDK after a prior {@link disable} call.
|
|
13
|
+
*
|
|
14
|
+
* The SDK auto-initialises at module load time using the values from
|
|
15
|
+
* `ConnectConfig.json` at the consumer's project root — so for most apps
|
|
16
|
+
* there is no need to call `enable()` at all. The method exists as the
|
|
17
|
+
* pair of {@link disable}: if a consent flow, A/B-test gate, or opt-out
|
|
18
|
+
* toggle previously called `disable()`, calling `enable()` brings the
|
|
19
|
+
* SDK back up using the same bundled configuration.
|
|
20
|
+
*
|
|
21
|
+
* @returns `true` when the call was accepted and dispatched to the native
|
|
22
|
+
* SDK. `false` only when the platform cannot satisfy a precondition
|
|
23
|
+
* (e.g. Android without an `Application` context yet).
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* **Single source of truth.** All configuration (AppKey, PostMessageUrl,
|
|
27
|
+
* push, platform extras) lives in `ConnectConfig.json` at the consumer's
|
|
28
|
+
* project root. The podspec (iOS) and `config.gradle` (Android) bake
|
|
29
|
+
* those values into the bundled config that the native bridge reads at
|
|
30
|
+
* init time. There is no runtime override path — by design, to eliminate
|
|
31
|
+
* the inconsistency surface that runtime arguments would create against
|
|
32
|
+
* the bundled config.
|
|
33
|
+
*
|
|
34
|
+
* **Idempotency.** Owned by the native SDK. iOS
|
|
35
|
+
* `ConnectSDK.shared.enable(with:)` short-circuits via
|
|
36
|
+
* `guard !isEnabled else { return }` in its internal `enableCore`; the
|
|
37
|
+
* Android `Connect.init` / `Connect.enable` pair behaves the same way
|
|
38
|
+
* once the SDK is running.
|
|
39
|
+
*
|
|
40
|
+
* **Threading.** Returns synchronously; the native SDK call is
|
|
41
|
+
* fire-and-forget on the main thread / actor.
|
|
42
|
+
*
|
|
43
|
+
* @example User opt-in after a prior opt-out
|
|
44
|
+
* ```ts
|
|
45
|
+
* import AcousticConnectRN from 'react-native-acoustic-connect-beta'
|
|
46
|
+
*
|
|
47
|
+
* function onUserOptIn() {
|
|
48
|
+
* AcousticConnectRN.enable()
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
enable(): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Disables the Connect SDK and stops all data capture.
|
|
55
|
+
*
|
|
56
|
+
* After this call the SDK flushes pending data to the backend, stops
|
|
57
|
+
* listening for events, and releases push state. Call {@link enable}
|
|
58
|
+
* to bring the SDK back up using the same bundled configuration.
|
|
59
|
+
*
|
|
60
|
+
* @returns `true` when the call was accepted and dispatched. Idempotent —
|
|
61
|
+
* calling `disable()` on an already-disabled SDK is safe.
|
|
62
|
+
*
|
|
63
|
+
* @example User opt-out flow
|
|
64
|
+
* ```ts
|
|
65
|
+
* import AcousticConnectRN from 'react-native-acoustic-connect-beta'
|
|
66
|
+
*
|
|
67
|
+
* function onUserOptOut() {
|
|
68
|
+
* AcousticConnectRN.disable()
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
disable(): boolean;
|
|
11
73
|
setBooleanConfigItemForKey(key: string, value: boolean, moduleName: string): boolean;
|
|
12
74
|
setStringItemForKey(key: string, value: string, moduleName: string): boolean;
|
|
13
75
|
setNumberItemForKey(key: string, value: number, moduleName: string): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-native-acoustic-connect.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/react-native-acoustic-connect.nitro.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,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A;IACtD,wBAAwB,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAC,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAA;IACjH,0BAA0B,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAC,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAA;IACnH,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;IAErD,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAA;IACtF,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAA;IACvE,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAA;IAC7F,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,OAAO,CAAA;CACxH"}
|
|
@@ -51,6 +51,16 @@ namespace margelo::nitro::acousticconnectrn {
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
// Methods
|
|
54
|
+
bool JHybridAcousticConnectRNSpec::enable() {
|
|
55
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("enable");
|
|
56
|
+
auto __result = method(_javaPart);
|
|
57
|
+
return static_cast<bool>(__result);
|
|
58
|
+
}
|
|
59
|
+
bool JHybridAcousticConnectRNSpec::disable() {
|
|
60
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("disable");
|
|
61
|
+
auto __result = method(_javaPart);
|
|
62
|
+
return static_cast<bool>(__result);
|
|
63
|
+
}
|
|
54
64
|
bool JHybridAcousticConnectRNSpec::setBooleanConfigItemForKey(const std::string& key, bool value, const std::string& moduleName) {
|
|
55
65
|
static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean(jni::alias_ref<jni::JString> /* key */, jboolean /* value */, jni::alias_ref<jni::JString> /* moduleName */)>("setBooleanConfigItemForKey");
|
|
56
66
|
auto __result = method(_javaPart, jni::make_jstring(key), value, jni::make_jstring(moduleName));
|
|
@@ -54,6 +54,8 @@ namespace margelo::nitro::acousticconnectrn {
|
|
|
54
54
|
|
|
55
55
|
public:
|
|
56
56
|
// Methods
|
|
57
|
+
bool enable() override;
|
|
58
|
+
bool disable() override;
|
|
57
59
|
bool setBooleanConfigItemForKey(const std::string& key, bool value, const std::string& moduleName) override;
|
|
58
60
|
bool setStringItemForKey(const std::string& key, const std::string& value, const std::string& moduleName) override;
|
|
59
61
|
bool setNumberItemForKey(const std::string& key, double value, const std::string& moduleName) override;
|
|
@@ -29,6 +29,14 @@ abstract class HybridAcousticConnectRNSpec: HybridObject() {
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
// Methods
|
|
32
|
+
@DoNotStrip
|
|
33
|
+
@Keep
|
|
34
|
+
abstract fun enable(): Boolean
|
|
35
|
+
|
|
36
|
+
@DoNotStrip
|
|
37
|
+
@Keep
|
|
38
|
+
abstract fun disable(): Boolean
|
|
39
|
+
|
|
32
40
|
@DoNotStrip
|
|
33
41
|
@Keep
|
|
34
42
|
abstract fun setBooleanConfigItemForKey(key: String, value: Boolean, moduleName: String): Boolean
|
|
@@ -70,6 +70,22 @@ namespace margelo::nitro::acousticconnectrn {
|
|
|
70
70
|
|
|
71
71
|
public:
|
|
72
72
|
// Methods
|
|
73
|
+
inline bool enable() override {
|
|
74
|
+
auto __result = _swiftPart.enable();
|
|
75
|
+
if (__result.hasError()) [[unlikely]] {
|
|
76
|
+
std::rethrow_exception(__result.error());
|
|
77
|
+
}
|
|
78
|
+
auto __value = std::move(__result.value());
|
|
79
|
+
return __value;
|
|
80
|
+
}
|
|
81
|
+
inline bool disable() override {
|
|
82
|
+
auto __result = _swiftPart.disable();
|
|
83
|
+
if (__result.hasError()) [[unlikely]] {
|
|
84
|
+
std::rethrow_exception(__result.error());
|
|
85
|
+
}
|
|
86
|
+
auto __value = std::move(__result.value());
|
|
87
|
+
return __value;
|
|
88
|
+
}
|
|
73
89
|
inline bool setBooleanConfigItemForKey(const std::string& key, bool value, const std::string& moduleName) override {
|
|
74
90
|
auto __result = _swiftPart.setBooleanConfigItemForKey(key, std::forward<decltype(value)>(value), moduleName);
|
|
75
91
|
if (__result.hasError()) [[unlikely]] {
|
|
@@ -13,6 +13,8 @@ public protocol HybridAcousticConnectRNSpec_protocol: HybridObject {
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
// Methods
|
|
16
|
+
func enable() throws -> Bool
|
|
17
|
+
func disable() throws -> Bool
|
|
16
18
|
func setBooleanConfigItemForKey(key: String, value: Bool, moduleName: String) throws -> Bool
|
|
17
19
|
func setStringItemForKey(key: String, value: String, moduleName: String) throws -> Bool
|
|
18
20
|
func setNumberItemForKey(key: String, value: Double, moduleName: String) throws -> Bool
|
|
@@ -124,6 +124,30 @@ open class HybridAcousticConnectRNSpec_cxx {
|
|
|
124
124
|
|
|
125
125
|
|
|
126
126
|
// Methods
|
|
127
|
+
@inline(__always)
|
|
128
|
+
public final func enable() -> bridge.Result_bool_ {
|
|
129
|
+
do {
|
|
130
|
+
let __result = try self.__implementation.enable()
|
|
131
|
+
let __resultCpp = __result
|
|
132
|
+
return bridge.create_Result_bool_(__resultCpp)
|
|
133
|
+
} catch (let __error) {
|
|
134
|
+
let __exceptionPtr = __error.toCpp()
|
|
135
|
+
return bridge.create_Result_bool_(__exceptionPtr)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@inline(__always)
|
|
140
|
+
public final func disable() -> bridge.Result_bool_ {
|
|
141
|
+
do {
|
|
142
|
+
let __result = try self.__implementation.disable()
|
|
143
|
+
let __resultCpp = __result
|
|
144
|
+
return bridge.create_Result_bool_(__resultCpp)
|
|
145
|
+
} catch (let __error) {
|
|
146
|
+
let __exceptionPtr = __error.toCpp()
|
|
147
|
+
return bridge.create_Result_bool_(__exceptionPtr)
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
127
151
|
@inline(__always)
|
|
128
152
|
public final func setBooleanConfigItemForKey(key: std.string, value: Bool, moduleName: std.string) -> bridge.Result_bool_ {
|
|
129
153
|
do {
|
|
@@ -14,6 +14,8 @@ namespace margelo::nitro::acousticconnectrn {
|
|
|
14
14
|
HybridObject::loadHybridMethods();
|
|
15
15
|
// load custom methods/properties
|
|
16
16
|
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("enable", &HybridAcousticConnectRNSpec::enable);
|
|
18
|
+
prototype.registerHybridMethod("disable", &HybridAcousticConnectRNSpec::disable);
|
|
17
19
|
prototype.registerHybridMethod("setBooleanConfigItemForKey", &HybridAcousticConnectRNSpec::setBooleanConfigItemForKey);
|
|
18
20
|
prototype.registerHybridMethod("setStringItemForKey", &HybridAcousticConnectRNSpec::setStringItemForKey);
|
|
19
21
|
prototype.registerHybridMethod("setNumberItemForKey", &HybridAcousticConnectRNSpec::setNumberItemForKey);
|
|
@@ -52,6 +52,8 @@ namespace margelo::nitro::acousticconnectrn {
|
|
|
52
52
|
|
|
53
53
|
public:
|
|
54
54
|
// Methods
|
|
55
|
+
virtual bool enable() = 0;
|
|
56
|
+
virtual bool disable() = 0;
|
|
55
57
|
virtual bool setBooleanConfigItemForKey(const std::string& key, bool value, const std::string& moduleName) = 0;
|
|
56
58
|
virtual bool setStringItemForKey(const std::string& key, const std::string& value, const std::string& moduleName) = 0;
|
|
57
59
|
virtual bool setNumberItemForKey(const std::string& key, double value, const std::string& moduleName) = 0;
|
package/package.json
CHANGED
|
@@ -23,6 +23,9 @@
|
|
|
23
23
|
"release-it": "^19.0.2",
|
|
24
24
|
"typescript": "5.0.4"
|
|
25
25
|
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=20.0.0"
|
|
28
|
+
},
|
|
26
29
|
"eslintConfig": {
|
|
27
30
|
"extends": [
|
|
28
31
|
"@react-native",
|
|
@@ -94,9 +97,9 @@
|
|
|
94
97
|
"module": "./lib/module/index.js",
|
|
95
98
|
"name": "react-native-acoustic-connect-beta",
|
|
96
99
|
"peerDependencies": {
|
|
97
|
-
"react": "
|
|
98
|
-
"react-native": "
|
|
99
|
-
"react-native-nitro-modules": ">=0.35.0 <0.
|
|
100
|
+
"react": ">=19.1.1 <20.0.0",
|
|
101
|
+
"react-native": ">=0.82.0 <0.86.0",
|
|
102
|
+
"react-native-nitro-modules": ">=0.35.0 <0.37.0"
|
|
100
103
|
},
|
|
101
104
|
"prettier": {
|
|
102
105
|
"quoteProps": "consistent",
|
|
@@ -192,7 +195,7 @@
|
|
|
192
195
|
"source": "src/index",
|
|
193
196
|
"summary": "react-native ios android tealeaf connect cxa wxca er enhanced-replay",
|
|
194
197
|
"types": "./lib/typescript/src/index.d.ts",
|
|
195
|
-
"version": "18.0.
|
|
198
|
+
"version": "18.0.24",
|
|
196
199
|
"workspaces": [
|
|
197
200
|
"example"
|
|
198
201
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Connect": {
|
|
3
|
-
"AndroidVersion": "11.0.
|
|
3
|
+
"AndroidVersion": "11.0.12-beta",
|
|
4
4
|
"AppKey": "b6c3709b7a4c479bb4b5a9fb8fec324c",
|
|
5
5
|
"KillSwitchUrl": "https://lib-us-2.brilliantcollector.com/collector/switch/b6c3709b7a4c479bb4b5a9fb8fec324c",
|
|
6
6
|
"PostMessageUrl": "https://lib-us-2.brilliantcollector.com/collector/collectorPost",
|
package/src/TLTRN.ts
CHANGED
|
@@ -105,27 +105,34 @@ class TLTRN {
|
|
|
105
105
|
return result;
|
|
106
106
|
};
|
|
107
107
|
|
|
108
|
-
static logClickEvent = async (event: any) => {
|
|
108
|
+
static logClickEvent = async (event: any) => {
|
|
109
109
|
let result = false
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
// Fabric exposes the host tag as `__nativeTag` (double underscore).
|
|
112
|
+
// Paper used `_nativeTag` (single). Read both for safety.
|
|
113
|
+
const target = event?.target?.__nativeTag ?? event?.target?._nativeTag;
|
|
114
|
+
if (target == null) {
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
let
|
|
118
|
+
// controlId comes from the touched view's `id` prop. Fiber internals can
|
|
119
|
+
// vary across React versions, so guard each access.
|
|
120
|
+
let controlId = '';
|
|
121
|
+
try {
|
|
122
|
+
const fiberId = event?._targetInst?.memoizedProps?.id;
|
|
123
|
+
if (typeof fiberId === 'string' && fiberId.length > 0) {
|
|
124
|
+
controlId = fiberId;
|
|
125
|
+
} else if (Array.isArray(event?._dispatchInstances)) {
|
|
126
|
+
const found = event._dispatchInstances.find(
|
|
127
|
+
(node: any) => node?.memoizedProps?.id
|
|
128
|
+
);
|
|
129
|
+
if (found) controlId = found.memoizedProps.id;
|
|
130
|
+
}
|
|
131
|
+
} catch {}
|
|
121
132
|
|
|
122
133
|
try {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
} else if (Platform.OS === 'android') {
|
|
126
|
-
result = AcousticConnectRN.logClickEvent(target, controlId);
|
|
127
|
-
}
|
|
128
|
-
} catch(error: Error | any){
|
|
134
|
+
result = AcousticConnectRN.logClickEvent(target, controlId);
|
|
135
|
+
} catch (error: Error | any) {
|
|
129
136
|
console.log('LogClickEvent error: ', error.message);
|
|
130
137
|
}
|
|
131
138
|
return result;
|
|
@@ -37,6 +37,9 @@ const Connect: React.FC<ConnectProps> = ({
|
|
|
37
37
|
navigationRef,
|
|
38
38
|
}) => {
|
|
39
39
|
const child = children as any;
|
|
40
|
+
// CA-138631: React 19 moved the ref off `element.ref` onto `element.props.ref`.
|
|
41
|
+
// Read `props.ref` first; the legacy `child.ref` fallback is a defensive
|
|
42
|
+
// guard from the React 18 era — kept to avoid a behavioural change.
|
|
40
43
|
const childProvidedRef = child?.props?.ref ?? child?.ref;
|
|
41
44
|
const internalRef = useRef<any>(null);
|
|
42
45
|
|
|
@@ -21,6 +21,69 @@ export type KeyValueObject = {
|
|
|
21
21
|
export type ConnectMonitoringLevelType = 'Ignore' | 'CellularAndWiFi' | 'WiFi'
|
|
22
22
|
|
|
23
23
|
export interface AcousticConnectRN extends HybridObject<{ ios: 'swift', android: 'kotlin' }> {
|
|
24
|
+
/**
|
|
25
|
+
* Re-enables the Connect SDK after a prior {@link disable} call.
|
|
26
|
+
*
|
|
27
|
+
* The SDK auto-initialises at module load time using the values from
|
|
28
|
+
* `ConnectConfig.json` at the consumer's project root — so for most apps
|
|
29
|
+
* there is no need to call `enable()` at all. The method exists as the
|
|
30
|
+
* pair of {@link disable}: if a consent flow, A/B-test gate, or opt-out
|
|
31
|
+
* toggle previously called `disable()`, calling `enable()` brings the
|
|
32
|
+
* SDK back up using the same bundled configuration.
|
|
33
|
+
*
|
|
34
|
+
* @returns `true` when the call was accepted and dispatched to the native
|
|
35
|
+
* SDK. `false` only when the platform cannot satisfy a precondition
|
|
36
|
+
* (e.g. Android without an `Application` context yet).
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* **Single source of truth.** All configuration (AppKey, PostMessageUrl,
|
|
40
|
+
* push, platform extras) lives in `ConnectConfig.json` at the consumer's
|
|
41
|
+
* project root. The podspec (iOS) and `config.gradle` (Android) bake
|
|
42
|
+
* those values into the bundled config that the native bridge reads at
|
|
43
|
+
* init time. There is no runtime override path — by design, to eliminate
|
|
44
|
+
* the inconsistency surface that runtime arguments would create against
|
|
45
|
+
* the bundled config.
|
|
46
|
+
*
|
|
47
|
+
* **Idempotency.** Owned by the native SDK. iOS
|
|
48
|
+
* `ConnectSDK.shared.enable(with:)` short-circuits via
|
|
49
|
+
* `guard !isEnabled else { return }` in its internal `enableCore`; the
|
|
50
|
+
* Android `Connect.init` / `Connect.enable` pair behaves the same way
|
|
51
|
+
* once the SDK is running.
|
|
52
|
+
*
|
|
53
|
+
* **Threading.** Returns synchronously; the native SDK call is
|
|
54
|
+
* fire-and-forget on the main thread / actor.
|
|
55
|
+
*
|
|
56
|
+
* @example User opt-in after a prior opt-out
|
|
57
|
+
* ```ts
|
|
58
|
+
* import AcousticConnectRN from 'react-native-acoustic-connect-beta'
|
|
59
|
+
*
|
|
60
|
+
* function onUserOptIn() {
|
|
61
|
+
* AcousticConnectRN.enable()
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
enable(): boolean
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Disables the Connect SDK and stops all data capture.
|
|
69
|
+
*
|
|
70
|
+
* After this call the SDK flushes pending data to the backend, stops
|
|
71
|
+
* listening for events, and releases push state. Call {@link enable}
|
|
72
|
+
* to bring the SDK back up using the same bundled configuration.
|
|
73
|
+
*
|
|
74
|
+
* @returns `true` when the call was accepted and dispatched. Idempotent —
|
|
75
|
+
* calling `disable()` on an already-disabled SDK is safe.
|
|
76
|
+
*
|
|
77
|
+
* @example User opt-out flow
|
|
78
|
+
* ```ts
|
|
79
|
+
* import AcousticConnectRN from 'react-native-acoustic-connect-beta'
|
|
80
|
+
*
|
|
81
|
+
* function onUserOptOut() {
|
|
82
|
+
* AcousticConnectRN.disable()
|
|
83
|
+
* }
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
disable(): boolean
|
|
24
87
|
setBooleanConfigItemForKey(key: string, value: boolean, moduleName: string): boolean
|
|
25
88
|
setStringItemForKey(key: string, value: string, moduleName: string): boolean
|
|
26
89
|
setNumberItemForKey(key: string, value: number, moduleName: string): boolean
|