react-native-acoustic-connect-beta 18.0.28 → 18.0.30
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 +19 -2
- package/android/build.gradle +17 -0
- package/android/src/main/assets/ConnectBasicConfig.properties +1 -1
- package/android/src/main/java/com/acousticconnectrn/HybridAcousticConnectRN.kt +122 -14
- package/ios/AcousticConnectRNConfig.json +5 -1
- package/ios/HybridAcousticConnectRN.swift +31 -1
- package/lib/typescript/src/specs/react-native-acoustic-connect.nitro.d.ts +40 -0
- package/lib/typescript/src/specs/react-native-acoustic-connect.nitro.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridAcousticConnectRNSpec.cpp +22 -0
- package/nitrogen/generated/android/c++/JHybridAcousticConnectRNSpec.hpp +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/HybridAcousticConnectRNSpec.kt +4 -0
- package/nitrogen/generated/ios/AcousticConnectRN-Swift-Cxx-Bridge.hpp +54 -14
- package/nitrogen/generated/ios/c++/HybridAcousticConnectRNSpecSwift.hpp +8 -0
- package/nitrogen/generated/ios/swift/HybridAcousticConnectRNSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridAcousticConnectRNSpec_cxx.swift +41 -0
- package/nitrogen/generated/shared/c++/HybridAcousticConnectRNSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridAcousticConnectRNSpec.hpp +1 -0
- package/package.json +1 -1
- package/src/specs/react-native-acoustic-connect.nitro.ts +46 -0
|
@@ -2,8 +2,25 @@ require "json"
|
|
|
2
2
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
4
|
|
|
5
|
-
#
|
|
6
|
-
|
|
5
|
+
# Resolve the consumer's ConnectConfig.json from the Podfile's project root.
|
|
6
|
+
#
|
|
7
|
+
# Using CocoaPods' install root (the directory containing the Podfile) rather
|
|
8
|
+
# than a path relative to this podspec makes config resolution correct in every
|
|
9
|
+
# layout, so SDK integration is seamless for clients:
|
|
10
|
+
# - Standalone consumer: the pod lives under <app>/node_modules, the install
|
|
11
|
+
# root is <app>/ios, so <install_root>/../ConnectConfig.json resolves to
|
|
12
|
+
# <app>/ConnectConfig.json.
|
|
13
|
+
# - In-repo example apps (this monorepo's Examples/*): the install root is the
|
|
14
|
+
# example's own ios/ dir, so it resolves to that example's ConnectConfig.json
|
|
15
|
+
# instead of escaping above the repo (which a podspec-relative climb did).
|
|
16
|
+
# Falls back to the legacy podspec-relative path when the install root isn't
|
|
17
|
+
# available (e.g. `pod spec lint`), preserving prior behaviour.
|
|
18
|
+
installRoot = (defined?(Pod::Config) && Pod::Config.instance.installation_root) || nil
|
|
19
|
+
consumerConfigPath = File.join(installRoot.to_s, '..', 'ConnectConfig.json') if installRoot
|
|
20
|
+
connectConfigPath =
|
|
21
|
+
(consumerConfigPath && File.exist?(consumerConfigPath)) ? consumerConfigPath
|
|
22
|
+
: File.join(__dir__, '..', '..', 'ConnectConfig.json')
|
|
23
|
+
connectConfig = JSON.parse(File.read(connectConfigPath))
|
|
7
24
|
repository = package["repository"]["url"]
|
|
8
25
|
useRelease = connectConfig["Connect"]["useRelease"]
|
|
9
26
|
dependencyName = useRelease ? 'AcousticConnect' : 'AcousticConnectDebug'
|
package/android/build.gradle
CHANGED
|
@@ -188,6 +188,23 @@ dependencies {
|
|
|
188
188
|
//noinspection GradleDynamicVersion
|
|
189
189
|
implementation "io.github.go-acoustic:$acousticArtifact:$acousticVersion"
|
|
190
190
|
|
|
191
|
+
// Firebase Cloud Messaging — required by the push variant. The
|
|
192
|
+
// `connect-push-fcm` AAR calls `com.google.firebase.messaging.*`
|
|
193
|
+
// (its `FCMPushService` extends `FirebaseMessagingService`) but its
|
|
194
|
+
// published POM does NOT declare firebase-messaging, so the transitive
|
|
195
|
+
// never arrives. Without it the push classes fail to link at runtime and
|
|
196
|
+
// push silently stays inactive — the bridge logs
|
|
197
|
+
// `connect-push-fcm on classpath: false` and no FCM token is ever
|
|
198
|
+
// requested. Gated by the same `PushEnabled` flag so analytics-only
|
|
199
|
+
// builds pull zero Firebase. The host app still supplies its own
|
|
200
|
+
// `google-services.json` and applies the `com.google.gms.google-services`
|
|
201
|
+
// plugin (the bare-workflow demo does this conditionally). The BoM aligns
|
|
202
|
+
// messaging + its installations/datatransport transitives. See CA-144314.
|
|
203
|
+
if (acousticPushEnabled) {
|
|
204
|
+
implementation platform('com.google.firebase:firebase-bom:33.7.0')
|
|
205
|
+
implementation 'com.google.firebase:firebase-messaging'
|
|
206
|
+
}
|
|
207
|
+
|
|
191
208
|
// Version range enforced by the RN bridge. Lower bound prevents downgrades
|
|
192
209
|
// to releases that lack APIs this bridge calls; upper bound prevents a
|
|
193
210
|
// future 12.x major (with potentially breaking changes) from being picked
|
|
@@ -49,6 +49,7 @@ import com.acoustic.connect.android.connectmod.Connect.onResume
|
|
|
49
49
|
import com.acoustic.connect.android.connectmod.Connect.registerFormField
|
|
50
50
|
import com.acoustic.connect.android.connectmod.Connect.resumeConnect
|
|
51
51
|
import com.acoustic.connect.android.connectmod.push.PushPermissionState
|
|
52
|
+
import com.acoustic.connect.android.connectmod.push.core.MobileServiceType
|
|
52
53
|
import com.facebook.react.bridge.LifecycleEventListener
|
|
53
54
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
54
55
|
import com.facebook.react.uimanager.UIManagerHelper
|
|
@@ -156,9 +157,59 @@ class HybridAcousticConnectRN : HybridAcousticConnectRNSpec(),
|
|
|
156
157
|
Connect.init(app)
|
|
157
158
|
}
|
|
158
159
|
Connect.enable()
|
|
160
|
+
maybeEnablePushOnMain(app)
|
|
159
161
|
Log.i(TAG, "[bridge] SDK auto-initialised at bridge construction")
|
|
160
162
|
}
|
|
161
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Bootstraps the native Connect push transport when the push variant is
|
|
166
|
+
* present. This is REQUIRED — it is not automatic. The `connect` /
|
|
167
|
+
* `connect-push-fcm` AARs declare no ContentProvider or `Startup`
|
|
168
|
+
* initializer, so nothing self-bootstraps `ConnectPush`. Its
|
|
169
|
+
* `enable(...)` is the sole entry point that creates the FCM
|
|
170
|
+
* [com.acoustic.connect.android.connectmod.push.PushService] transport,
|
|
171
|
+
* sets `isInitialized = true`, registers the activity-lifecycle
|
|
172
|
+
* callbacks, and constructs the `TokenUpdaterReceiver` that turns the
|
|
173
|
+
* FCM `onNewToken` broadcast into a Connect PushRegistration. Without
|
|
174
|
+
* this call the token broadcast is dropped and `sendToken()` no-ops on
|
|
175
|
+
* `isInitialized == false`, so no registration ever reaches Connect.
|
|
176
|
+
*
|
|
177
|
+
* Gated by [isConnectPushFcmAvailable] so analytics-only
|
|
178
|
+
* (`PushEnabled=false`) builds — which bundle no Firebase — never touch
|
|
179
|
+
* the FCM transport classes. Idempotent: short-circuits once
|
|
180
|
+
* `Connect.push.isInitialized()` is true, so it is safe to call from
|
|
181
|
+
* every init path (construction auto-init, JS `enable()`, lifecycle
|
|
182
|
+
* resume). `MobileServiceType.FCM` is hard-coded: FCM is the only push
|
|
183
|
+
* provider on the JS surface (HMS was dropped — see deviation 4).
|
|
184
|
+
*
|
|
185
|
+
* MUST be called on the main looper, after `Connect.enable()`.
|
|
186
|
+
*/
|
|
187
|
+
private fun maybeEnablePushOnMain(application: Application) {
|
|
188
|
+
if (!isConnectPushFcmAvailable()) return
|
|
189
|
+
if (Connect.push.isInitialized()) return
|
|
190
|
+
val smallIconRes = resolvePushSmallIconRes(application)
|
|
191
|
+
Connect.push.enable(application, true, smallIconRes, MobileServiceType.FCM) { e ->
|
|
192
|
+
Log.w(TAG, "[bridge] push enable failed — ${e.message}")
|
|
193
|
+
}
|
|
194
|
+
Log.i(TAG, "[bridge] Connect push transport enabled (FCM)")
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Resolves the status-bar notification small-icon drawable for push.
|
|
199
|
+
* Looks up `ic_stat_push` (the demo's committed monochrome icon, also
|
|
200
|
+
* the `AndroidNotificationIconResName` convention) and falls back to the
|
|
201
|
+
* app's launcher icon when absent, so consumers that didn't add a
|
|
202
|
+
* dedicated push icon still get a valid resource rather than `0`.
|
|
203
|
+
*/
|
|
204
|
+
private fun resolvePushSmallIconRes(application: Application): Int {
|
|
205
|
+
val byName = application.resources.getIdentifier(
|
|
206
|
+
"ic_stat_push",
|
|
207
|
+
"drawable",
|
|
208
|
+
application.packageName,
|
|
209
|
+
)
|
|
210
|
+
return if (byName != 0) byName else application.applicationInfo.icon
|
|
211
|
+
}
|
|
212
|
+
|
|
162
213
|
/**
|
|
163
214
|
* Resolves the host app's `Application` from
|
|
164
215
|
* `NitroModules.applicationContext`. Returns `null` (with a logged
|
|
@@ -214,6 +265,7 @@ class HybridAcousticConnectRN : HybridAcousticConnectRNSpec(),
|
|
|
214
265
|
}
|
|
215
266
|
Connect.init(application)
|
|
216
267
|
Connect.enable()
|
|
268
|
+
maybeEnablePushOnMain(application)
|
|
217
269
|
Log.i(TAG, "[bridge] SDK initialised")
|
|
218
270
|
}
|
|
219
271
|
return true
|
|
@@ -235,31 +287,40 @@ class HybridAcousticConnectRN : HybridAcousticConnectRNSpec(),
|
|
|
235
287
|
|
|
236
288
|
// region Push (Android)
|
|
237
289
|
//
|
|
238
|
-
// The shared Nitro spec declares these push methods on both platforms.
|
|
239
|
-
//
|
|
240
|
-
//
|
|
241
|
-
//
|
|
242
|
-
//
|
|
243
|
-
//
|
|
244
|
-
//
|
|
290
|
+
// The shared Nitro spec declares these push methods on both platforms.
|
|
291
|
+
// Once the bridge bootstraps the native push transport via
|
|
292
|
+
// [maybeEnablePushOnMain] (`Connect.push.enable(..., MobileServiceType.FCM)`
|
|
293
|
+
// at SDK init), the native SDK owns the rest of the push lifecycle:
|
|
294
|
+
// Connect's own FirebaseMessagingService (shipped in connect-push-fcm)
|
|
295
|
+
// handles inbound delivery and PushReceived / PushAction logging, and the
|
|
296
|
+
// `TokenUpdaterReceiver` registered by `enable(...)` turns the FCM
|
|
297
|
+
// `onNewToken` broadcast into a Connect PushRegistration. That bootstrap
|
|
298
|
+
// is NOT automatic — the AARs declare no ContentProvider / Startup
|
|
299
|
+
// initializer, so without the `enable(...)` call no token ever registers.
|
|
300
|
+
//
|
|
301
|
+
// After bootstrap there is no manual JS-forwarding API on Android (unlike
|
|
302
|
+
// iOS), so every JS→native forwarder below is a no-op that reports
|
|
303
|
+
// "handled", kept only for cross-platform API symmetry:
|
|
245
304
|
// - pushDidReceiveNotification, pushDidReceiveResponse,
|
|
246
305
|
// pushDidRegisterWithToken, pushDidFailToRegister,
|
|
247
306
|
// pushDidReceiveAuthorization
|
|
248
307
|
//
|
|
249
|
-
// The only Android-relevant
|
|
308
|
+
// The only Android-relevant runtime interaction is permission wiring:
|
|
250
309
|
// - pushRequestPermission / pushGetPermissionState — POST_NOTIFICATIONS
|
|
251
310
|
//
|
|
252
311
|
// pushGetToken / pushGetTokenAsync are intentionally NOT on the surface —
|
|
253
|
-
// parked (the native
|
|
254
|
-
// no JS accessor is needed). None of these methods reject.
|
|
312
|
+
// parked (the native transport registers the token with Connect once
|
|
313
|
+
// enabled; no JS accessor is needed). None of these methods reject.
|
|
255
314
|
|
|
256
315
|
/**
|
|
257
|
-
* iOS-primary forwarder. On Android the FCM token is captured and
|
|
258
|
-
* with Connect
|
|
259
|
-
*
|
|
316
|
+
* iOS-primary forwarder. On Android the FCM token is captured and
|
|
317
|
+
* registered with Connect by the native transport once it is bootstrapped
|
|
318
|
+
* via [maybeEnablePushOnMain] (the `TokenUpdaterReceiver` set up by
|
|
319
|
+
* `Connect.push.enable(...)` consumes the `onNewToken` broadcast), so this
|
|
320
|
+
* JS forwarder is a no-op that reports "handled". Never rejects.
|
|
260
321
|
*/
|
|
261
322
|
override fun pushDidRegisterWithToken(deviceToken: ArrayBuffer): Promise<Boolean> {
|
|
262
|
-
Log.d(TAG, "[bridge] pushDidRegisterWithToken: no-op on Android (native
|
|
323
|
+
Log.d(TAG, "[bridge] pushDidRegisterWithToken: no-op on Android (native transport owns token registration once enabled)")
|
|
263
324
|
return Promise.resolved(true)
|
|
264
325
|
}
|
|
265
326
|
|
|
@@ -619,6 +680,52 @@ class HybridAcousticConnectRN : HybridAcousticConnectRNSpec(),
|
|
|
619
680
|
return result
|
|
620
681
|
}
|
|
621
682
|
|
|
683
|
+
/**
|
|
684
|
+
* Logs a user identity so device activity can be associated with a known
|
|
685
|
+
* Connect contact. Wraps [Connect.logIdentificationEvent].
|
|
686
|
+
*
|
|
687
|
+
* Returns a [Promise] to match the cross-platform spec — the iOS identity
|
|
688
|
+
* API is main-actor isolated and async. The native call is synchronous and
|
|
689
|
+
* returns false (emitting no signal) when either identifier is blank, so no
|
|
690
|
+
* extra guard is needed here.
|
|
691
|
+
*
|
|
692
|
+
* A `"url"` entry in [additionalParameters] is routed to the SDK's explicit
|
|
693
|
+
* `url` parameter so the JS surface matches iOS, where `url` rides inside the
|
|
694
|
+
* parameter map. When absent, the SDK's own default URL applies.
|
|
695
|
+
*
|
|
696
|
+
* @param identifierName Identifier name, e.g. "Email".
|
|
697
|
+
* @param identifierValue Identifier value, e.g. "user@example.com".
|
|
698
|
+
* @param signalType Optional signal type; defaults to "loggedIn" when omitted.
|
|
699
|
+
* @param additionalParameters Optional extra key/value pairs merged into the
|
|
700
|
+
* signal. Defaults to `{ "registrationMethod": "email" }` only when null
|
|
701
|
+
* (omitted); an explicit map — including an empty one — is used as-is.
|
|
702
|
+
* @return A promise resolving to true if the signal was queued, false otherwise.
|
|
703
|
+
*/
|
|
704
|
+
override fun logIdentity(
|
|
705
|
+
identifierName: String,
|
|
706
|
+
identifierValue: String,
|
|
707
|
+
signalType: String?,
|
|
708
|
+
additionalParameters: Map<String, String>?
|
|
709
|
+
): Promise<Boolean> {
|
|
710
|
+
val params = additionalParameters ?: mapOf("registrationMethod" to "email")
|
|
711
|
+
val resolvedSignalType = signalType ?: "loggedIn"
|
|
712
|
+
val result = params["url"]?.let { url ->
|
|
713
|
+
Connect.logIdentificationEvent(
|
|
714
|
+
identifierName,
|
|
715
|
+
identifierValue,
|
|
716
|
+
url,
|
|
717
|
+
resolvedSignalType,
|
|
718
|
+
params - "url"
|
|
719
|
+
)
|
|
720
|
+
} ?: Connect.logIdentificationEvent(
|
|
721
|
+
identifierName = identifierName,
|
|
722
|
+
identifierValue = identifierValue,
|
|
723
|
+
signalType = resolvedSignalType,
|
|
724
|
+
additionalParameters = params
|
|
725
|
+
)
|
|
726
|
+
return Promise.resolved(result)
|
|
727
|
+
}
|
|
728
|
+
|
|
622
729
|
/**
|
|
623
730
|
* Logs an exception event with the specified message and stack information.
|
|
624
731
|
*
|
|
@@ -1237,6 +1344,7 @@ class HybridAcousticConnectRN : HybridAcousticConnectRNSpec(),
|
|
|
1237
1344
|
// call the native SDK's `Connect.enable()` directly so the
|
|
1238
1345
|
// log line "called from JS" doesn't fire on lifecycle wake-ups.
|
|
1239
1346
|
Connect.enable()
|
|
1347
|
+
resolveApplication()?.let { maybeEnablePushOnMain(it) }
|
|
1240
1348
|
}
|
|
1241
1349
|
onResume(activity, null)
|
|
1242
1350
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Connect": {
|
|
3
|
-
"AndroidVersion": "11.0.12-beta",
|
|
4
3
|
"AppKey": "b6c3709b7a4c479bb4b5a9fb8fec324c",
|
|
5
4
|
"KillSwitchUrl": "https://lib-us-2.brilliantcollector.com/collector/switch/b6c3709b7a4c479bb4b5a9fb8fec324c",
|
|
6
5
|
"PostMessageUrl": "https://lib-us-2.brilliantcollector.com/collector/collectorPost",
|
|
6
|
+
"AndroidVersion": "",
|
|
7
7
|
"iOSVersion": "",
|
|
8
|
+
"PushEnabled": false,
|
|
9
|
+
"iOSPushMode": "automatic",
|
|
10
|
+
"iOSAppGroupIdentifier": null,
|
|
11
|
+
"AndroidNotificationIconResName": null,
|
|
8
12
|
"layoutConfigAndroid": {
|
|
9
13
|
"AppendMapIds": {
|
|
10
14
|
"[w,9290],[v,0]": {
|
|
@@ -575,7 +575,37 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
575
575
|
let result = ConnectCustomEvent().logSignal(convertToAnyDictionary(input: values), level: logLevel)
|
|
576
576
|
return result
|
|
577
577
|
}
|
|
578
|
-
|
|
578
|
+
|
|
579
|
+
/// Logs a user identity so device activity can be associated with a known
|
|
580
|
+
/// Connect contact. Wraps `ConnectSDK.shared.identity.log(...)`.
|
|
581
|
+
///
|
|
582
|
+
/// `ConnectSDK.shared` is `@MainActor`-isolated, so — unlike the synchronous
|
|
583
|
+
/// loggers above (which use the legacy non-actor `ConnectCustomEvent`) —
|
|
584
|
+
/// this hops to the main actor and resolves with the SDK's real return
|
|
585
|
+
/// value. The native API returns `false` (and emits no signal) when either
|
|
586
|
+
/// identifier is blank, satisfying the bridge's blank-input contract without
|
|
587
|
+
/// extra guards here. `url`, if supplied, rides inside `additionalParameters`
|
|
588
|
+
/// (the iOS convention).
|
|
589
|
+
/// - Parameters:
|
|
590
|
+
/// - identifierName: Identifier name, e.g. "Email".
|
|
591
|
+
/// - identifierValue: Identifier value, e.g. "user@example.com".
|
|
592
|
+
/// - signalType: Optional signal type; defaults to "loggedIn" when omitted.
|
|
593
|
+
/// - additionalParameters: Optional extra key/value pairs merged into the
|
|
594
|
+
/// signal. Defaults to `["registrationMethod": "email"]` only when `nil`
|
|
595
|
+
/// (omitted); an explicit map — including an empty one — is used as-is.
|
|
596
|
+
/// - Returns: A promise resolving to `true` if the signal was dispatched,
|
|
597
|
+
/// `false` otherwise. Never rejects.
|
|
598
|
+
func logIdentity(identifierName: String, identifierValue: String, signalType: String?, additionalParameters: [String: String]?) throws -> Promise<Bool> {
|
|
599
|
+
return Promise.async { @MainActor in
|
|
600
|
+
ConnectSDK.shared.identity.log(
|
|
601
|
+
identifierName: identifierName,
|
|
602
|
+
identifierValue: identifierValue,
|
|
603
|
+
signalType: signalType ?? "loggedIn",
|
|
604
|
+
additionalParameters: additionalParameters ?? ["registrationMethod": "email"]
|
|
605
|
+
)
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
579
609
|
/// Log exception.
|
|
580
610
|
/// - Parameters:
|
|
581
611
|
/// - message: the message of the error/exception to be logged this will appear in the posted json.
|
|
@@ -122,6 +122,46 @@ export interface AcousticConnectRN extends HybridObject<{
|
|
|
122
122
|
logDialogDismissEvent(dialogId: string, dismissReason: string): boolean;
|
|
123
123
|
logDialogButtonClickEvent(dialogId: string, buttonText: string, buttonIndex: number): boolean;
|
|
124
124
|
logDialogCustomEvent(dialogId: string, eventName: string, values: Record<string, string | number | boolean>): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Logs a user identity so the current device/session can be associated with
|
|
127
|
+
* a known Connect contact — the foundation for audience building and
|
|
128
|
+
* cross-channel engagement. Wraps the native identity loggers
|
|
129
|
+
* (`ConnectSDK.shared.identity.log` on iOS, `Connect.logIdentificationEvent`
|
|
130
|
+
* on Android).
|
|
131
|
+
*
|
|
132
|
+
* Unlike the synchronous analytics loggers above, this returns a `Promise`:
|
|
133
|
+
* `ConnectSDK.shared` (iOS) is `@MainActor`-isolated, so the bridge hops to the
|
|
134
|
+
* main actor and resolves with the *real* success/failure value rather than
|
|
135
|
+
* firing and forgetting.
|
|
136
|
+
*
|
|
137
|
+
* The native APIs return `false` — and emit no signal — when either
|
|
138
|
+
* `identifierName` or `identifierValue` is empty/blank after trimming.
|
|
139
|
+
*
|
|
140
|
+
* @param identifierName Identifier name, e.g. `'Email'`.
|
|
141
|
+
* @param identifierValue Identifier value, e.g. `'user@example.com'`.
|
|
142
|
+
* @param signalType Optional signal type; the bridge supplies
|
|
143
|
+
* `'loggedIn'` when omitted (identity logging typically marks a sign-in),
|
|
144
|
+
* overriding the native SDKs' own `'pageView'` default.
|
|
145
|
+
* @param additionalParameters Optional extra key/value pairs merged into the
|
|
146
|
+
* signal payload. Only when omitted (`undefined`) does the bridge supply
|
|
147
|
+
* the default `{ registrationMethod: 'email' }`; an explicitly-provided
|
|
148
|
+
* map is used as-is, so passing an empty `{}` sends no extra parameters
|
|
149
|
+
* (the default is not merged in). A `'url'` entry is honoured uniformly on
|
|
150
|
+
* both platforms: on Android it is routed to the SDK's explicit `url`
|
|
151
|
+
* parameter, on iOS it rides inside the parameter map (where the native
|
|
152
|
+
* API expects it).
|
|
153
|
+
* @returns A promise resolving to `true` if the identity signal was
|
|
154
|
+
* dispatched, `false` otherwise (including the blank-identifier case).
|
|
155
|
+
* Never rejects.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```ts
|
|
159
|
+
* import AcousticConnectRN from 'react-native-acoustic-connect-beta'
|
|
160
|
+
*
|
|
161
|
+
* await AcousticConnectRN.logIdentity('Email', 'user@example.com')
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
logIdentity(identifierName: string, identifierValue: string, signalType?: string, additionalParameters?: Record<string, string>): Promise<boolean>;
|
|
125
165
|
/**
|
|
126
166
|
* Forwards the raw APNs device token to the Connect SDK (manual mode).
|
|
127
167
|
*
|
|
@@ -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,4BAA4B,CAAA;AAG9D,MAAM,MAAM,cAAc,GAAG;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,QAAQ,GAAG,iBAAiB,GAAG,MAAM,CAAA;AAE9E;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC1B,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gFAAgF;IAChF,OAAO,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;GAQG;A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AE,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;
|
|
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,4BAA4B,CAAA;AAG9D,MAAM,MAAM,cAAc,GAAG;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,QAAQ,GAAG,iBAAiB,GAAG,MAAM,CAAA;AAE9E;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC1B,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gFAAgF;IAChF,OAAO,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACjC,gEAAgE;IAChE,OAAO,EAAE,OAAO,CAAA;IAChB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB;AAED,MAAM,WAAW,iBAAkB,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;IACxF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,MAAM,IAAI,O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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,WAAW,CACP,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,MAAM,EACvB,UAAU,CAAC,EAAE,MAAM,EACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9C,OAAO,CAAC,OAAO,CAAC,CAAA;IAUnB;;;;;;;;;;;OAWG;IACH,wBAAwB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAEpE;;;;;;OAMG;IACH,qBAAqB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAE7D;;;;;;;;;;;;;OAaG;IACH,0BAA0B,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAEjG;;;;;;;;;;;OAWG;IACH,sBAAsB,CAAC,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAIvH;;;;;;;;;;;;;OAaG;IACH,2BAA2B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,EAAE,KAAK,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAE7F;;;;;;;OAOG;IACH,qBAAqB,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAAA;IAEtD;;;;OAIG;IACH,sBAAsB,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;CACpD"}
|
|
@@ -201,6 +201,28 @@ namespace margelo::nitro::acousticconnectrn {
|
|
|
201
201
|
}());
|
|
202
202
|
return static_cast<bool>(__result);
|
|
203
203
|
}
|
|
204
|
+
std::shared_ptr<Promise<bool>> JHybridAcousticConnectRNSpec::logIdentity(const std::string& identifierName, const std::string& identifierValue, const std::optional<std::string>& signalType, const std::optional<std::unordered_map<std::string, std::string>>& additionalParameters) {
|
|
205
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* identifierName */, jni::alias_ref<jni::JString> /* identifierValue */, jni::alias_ref<jni::JString> /* signalType */, jni::alias_ref<jni::JMap<jni::JString, jni::JString>> /* additionalParameters */)>("logIdentity");
|
|
206
|
+
auto __result = method(_javaPart, jni::make_jstring(identifierName), jni::make_jstring(identifierValue), signalType.has_value() ? jni::make_jstring(signalType.value()) : nullptr, additionalParameters.has_value() ? [&]() -> jni::local_ref<jni::JMap<jni::JString, jni::JString>> {
|
|
207
|
+
auto __map = jni::JHashMap<jni::JString, jni::JString>::create(additionalParameters.value().size());
|
|
208
|
+
for (const auto& __entry : additionalParameters.value()) {
|
|
209
|
+
__map->put(jni::make_jstring(__entry.first), jni::make_jstring(__entry.second));
|
|
210
|
+
}
|
|
211
|
+
return __map;
|
|
212
|
+
}() : nullptr);
|
|
213
|
+
return [&]() {
|
|
214
|
+
auto __promise = Promise<bool>::create();
|
|
215
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
216
|
+
auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
|
|
217
|
+
__promise->resolve(static_cast<bool>(__result->value()));
|
|
218
|
+
});
|
|
219
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
220
|
+
jni::JniException __jniError(__throwable);
|
|
221
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
222
|
+
});
|
|
223
|
+
return __promise;
|
|
224
|
+
}();
|
|
225
|
+
}
|
|
204
226
|
std::shared_ptr<Promise<bool>> JHybridAcousticConnectRNSpec::pushDidRegisterWithToken(const std::shared_ptr<ArrayBuffer>& deviceToken) {
|
|
205
227
|
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<JArrayBuffer::javaobject> /* deviceToken */)>("pushDidRegisterWithToken");
|
|
206
228
|
auto __result = method(_javaPart, JArrayBuffer::wrap(deviceToken));
|
|
@@ -78,6 +78,7 @@ namespace margelo::nitro::acousticconnectrn {
|
|
|
78
78
|
bool logDialogDismissEvent(const std::string& dialogId, const std::string& dismissReason) override;
|
|
79
79
|
bool logDialogButtonClickEvent(const std::string& dialogId, const std::string& buttonText, double buttonIndex) override;
|
|
80
80
|
bool logDialogCustomEvent(const std::string& dialogId, const std::string& eventName, const std::unordered_map<std::string, std::variant<bool, std::string, double>>& values) override;
|
|
81
|
+
std::shared_ptr<Promise<bool>> logIdentity(const std::string& identifierName, const std::string& identifierValue, const std::optional<std::string>& signalType, const std::optional<std::unordered_map<std::string, std::string>>& additionalParameters) override;
|
|
81
82
|
std::shared_ptr<Promise<bool>> pushDidRegisterWithToken(const std::shared_ptr<ArrayBuffer>& deviceToken) override;
|
|
82
83
|
std::shared_ptr<Promise<bool>> pushDidFailToRegister(const PushErrorInfo& error) override;
|
|
83
84
|
std::shared_ptr<Promise<bool>> pushDidReceiveNotification(const std::unordered_map<std::string, std::variant<bool, std::string, double>>& userInfo) override;
|
|
@@ -127,6 +127,10 @@ abstract class HybridAcousticConnectRNSpec: HybridObject() {
|
|
|
127
127
|
@Keep
|
|
128
128
|
abstract fun logDialogCustomEvent(dialogId: String, eventName: String, values: Map<String, Variant_Boolean_String_Double>): Boolean
|
|
129
129
|
|
|
130
|
+
@DoNotStrip
|
|
131
|
+
@Keep
|
|
132
|
+
abstract fun logIdentity(identifierName: String, identifierValue: String, signalType: String?, additionalParameters: Map<String, String>?): Promise<Boolean>
|
|
133
|
+
|
|
130
134
|
@DoNotStrip
|
|
131
135
|
@Keep
|
|
132
136
|
abstract fun pushDidRegisterWithToken(deviceToken: ArrayBuffer): Promise<Boolean>
|
|
@@ -201,33 +201,73 @@ namespace margelo::nitro::acousticconnectrn::bridge::swift {
|
|
|
201
201
|
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
// pragma MARK: std::optional<
|
|
204
|
+
// pragma MARK: std::optional<std::string>
|
|
205
205
|
/**
|
|
206
|
-
* Specialized version of `std::optional<
|
|
206
|
+
* Specialized version of `std::optional<std::string>`.
|
|
207
207
|
*/
|
|
208
|
-
using
|
|
209
|
-
inline std::optional<
|
|
210
|
-
return std::optional<
|
|
208
|
+
using std__optional_std__string_ = std::optional<std::string>;
|
|
209
|
+
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
210
|
+
return std::optional<std::string>(value);
|
|
211
211
|
}
|
|
212
|
-
inline bool
|
|
212
|
+
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
213
213
|
return optional.has_value();
|
|
214
214
|
}
|
|
215
|
-
inline
|
|
215
|
+
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
216
216
|
return optional.value();
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
// pragma MARK: std::
|
|
219
|
+
// pragma MARK: std::unordered_map<std::string, std::string>
|
|
220
220
|
/**
|
|
221
|
-
* Specialized version of `std::
|
|
221
|
+
* Specialized version of `std::unordered_map<std::string, std::string>`.
|
|
222
222
|
*/
|
|
223
|
-
using
|
|
224
|
-
inline std::
|
|
225
|
-
|
|
223
|
+
using std__unordered_map_std__string__std__string_ = std::unordered_map<std::string, std::string>;
|
|
224
|
+
inline std::unordered_map<std::string, std::string> create_std__unordered_map_std__string__std__string_(size_t size) noexcept {
|
|
225
|
+
std::unordered_map<std::string, std::string> map;
|
|
226
|
+
map.reserve(size);
|
|
227
|
+
return map;
|
|
226
228
|
}
|
|
227
|
-
inline
|
|
229
|
+
inline std::vector<std::string> get_std__unordered_map_std__string__std__string__keys(const std__unordered_map_std__string__std__string_& map) noexcept {
|
|
230
|
+
std::vector<std::string> keys;
|
|
231
|
+
keys.reserve(map.size());
|
|
232
|
+
for (const auto& entry : map) {
|
|
233
|
+
keys.push_back(entry.first);
|
|
234
|
+
}
|
|
235
|
+
return keys;
|
|
236
|
+
}
|
|
237
|
+
inline std::string get_std__unordered_map_std__string__std__string__value(const std__unordered_map_std__string__std__string_& map, const std::string& key) noexcept {
|
|
238
|
+
return map.find(key)->second;
|
|
239
|
+
}
|
|
240
|
+
inline void emplace_std__unordered_map_std__string__std__string_(std__unordered_map_std__string__std__string_& map, const std::string& key, const std::string& value) noexcept {
|
|
241
|
+
map.emplace(key, value);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// pragma MARK: std::optional<std::unordered_map<std::string, std::string>>
|
|
245
|
+
/**
|
|
246
|
+
* Specialized version of `std::optional<std::unordered_map<std::string, std::string>>`.
|
|
247
|
+
*/
|
|
248
|
+
using std__optional_std__unordered_map_std__string__std__string__ = std::optional<std::unordered_map<std::string, std::string>>;
|
|
249
|
+
inline std::optional<std::unordered_map<std::string, std::string>> create_std__optional_std__unordered_map_std__string__std__string__(const std::unordered_map<std::string, std::string>& value) noexcept {
|
|
250
|
+
return std::optional<std::unordered_map<std::string, std::string>>(value);
|
|
251
|
+
}
|
|
252
|
+
inline bool has_value_std__optional_std__unordered_map_std__string__std__string__(const std::optional<std::unordered_map<std::string, std::string>>& optional) noexcept {
|
|
228
253
|
return optional.has_value();
|
|
229
254
|
}
|
|
230
|
-
inline std::string
|
|
255
|
+
inline std::unordered_map<std::string, std::string> get_std__optional_std__unordered_map_std__string__std__string__(const std::optional<std::unordered_map<std::string, std::string>>& optional) noexcept {
|
|
256
|
+
return optional.value();
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// pragma MARK: std::optional<double>
|
|
260
|
+
/**
|
|
261
|
+
* Specialized version of `std::optional<double>`.
|
|
262
|
+
*/
|
|
263
|
+
using std__optional_double_ = std::optional<double>;
|
|
264
|
+
inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
|
|
265
|
+
return std::optional<double>(value);
|
|
266
|
+
}
|
|
267
|
+
inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
268
|
+
return optional.has_value();
|
|
269
|
+
}
|
|
270
|
+
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
231
271
|
return optional.value();
|
|
232
272
|
}
|
|
233
273
|
|
|
@@ -272,6 +272,14 @@ namespace margelo::nitro::acousticconnectrn {
|
|
|
272
272
|
auto __value = std::move(__result.value());
|
|
273
273
|
return __value;
|
|
274
274
|
}
|
|
275
|
+
inline std::shared_ptr<Promise<bool>> logIdentity(const std::string& identifierName, const std::string& identifierValue, const std::optional<std::string>& signalType, const std::optional<std::unordered_map<std::string, std::string>>& additionalParameters) override {
|
|
276
|
+
auto __result = _swiftPart.logIdentity(identifierName, identifierValue, signalType, additionalParameters);
|
|
277
|
+
if (__result.hasError()) [[unlikely]] {
|
|
278
|
+
std::rethrow_exception(__result.error());
|
|
279
|
+
}
|
|
280
|
+
auto __value = std::move(__result.value());
|
|
281
|
+
return __value;
|
|
282
|
+
}
|
|
275
283
|
inline std::shared_ptr<Promise<bool>> pushDidRegisterWithToken(const std::shared_ptr<ArrayBuffer>& deviceToken) override {
|
|
276
284
|
auto __result = _swiftPart.pushDidRegisterWithToken(ArrayBufferHolder(deviceToken));
|
|
277
285
|
if (__result.hasError()) [[unlikely]] {
|
|
@@ -37,6 +37,7 @@ public protocol HybridAcousticConnectRNSpec_protocol: HybridObject {
|
|
|
37
37
|
func logDialogDismissEvent(dialogId: String, dismissReason: String) throws -> Bool
|
|
38
38
|
func logDialogButtonClickEvent(dialogId: String, buttonText: String, buttonIndex: Double) throws -> Bool
|
|
39
39
|
func logDialogCustomEvent(dialogId: String, eventName: String, values: Dictionary<String, Variant_Bool_String_Double>) throws -> Bool
|
|
40
|
+
func logIdentity(identifierName: String, identifierValue: String, signalType: String?, additionalParameters: Dictionary<String, String>?) throws -> Promise<Bool>
|
|
40
41
|
func pushDidRegisterWithToken(deviceToken: ArrayBuffer) throws -> Promise<Bool>
|
|
41
42
|
func pushDidFailToRegister(error: PushErrorInfo) throws -> Promise<Bool>
|
|
42
43
|
func pushDidReceiveNotification(userInfo: Dictionary<String, Variant_Bool_String_Double>) throws -> Promise<Bool>
|
|
@@ -604,6 +604,47 @@ open class HybridAcousticConnectRNSpec_cxx {
|
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
|
|
607
|
+
@inline(__always)
|
|
608
|
+
public final func logIdentity(identifierName: std.string, identifierValue: std.string, signalType: bridge.std__optional_std__string_, additionalParameters: bridge.std__optional_std__unordered_map_std__string__std__string__) -> bridge.Result_std__shared_ptr_Promise_bool___ {
|
|
609
|
+
do {
|
|
610
|
+
let __result = try self.__implementation.logIdentity(identifierName: String(identifierName), identifierValue: String(identifierValue), signalType: { () -> String? in
|
|
611
|
+
if bridge.has_value_std__optional_std__string_(signalType) {
|
|
612
|
+
let __unwrapped = bridge.get_std__optional_std__string_(signalType)
|
|
613
|
+
return String(__unwrapped)
|
|
614
|
+
} else {
|
|
615
|
+
return nil
|
|
616
|
+
}
|
|
617
|
+
}(), additionalParameters: { () -> Dictionary<String, String>? in
|
|
618
|
+
if bridge.has_value_std__optional_std__unordered_map_std__string__std__string__(additionalParameters) {
|
|
619
|
+
let __unwrapped = bridge.get_std__optional_std__unordered_map_std__string__std__string__(additionalParameters)
|
|
620
|
+
return { () -> Dictionary<String, String> in
|
|
621
|
+
var __dictionary = Dictionary<String, String>(minimumCapacity: __unwrapped.size())
|
|
622
|
+
let __keys = bridge.get_std__unordered_map_std__string__std__string__keys(__unwrapped)
|
|
623
|
+
for __key in __keys {
|
|
624
|
+
let __value = bridge.get_std__unordered_map_std__string__std__string__value(__unwrapped, __key)
|
|
625
|
+
__dictionary[String(__key)] = String(__value)
|
|
626
|
+
}
|
|
627
|
+
return __dictionary
|
|
628
|
+
}()
|
|
629
|
+
} else {
|
|
630
|
+
return nil
|
|
631
|
+
}
|
|
632
|
+
}())
|
|
633
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
|
|
634
|
+
let __promise = bridge.create_std__shared_ptr_Promise_bool__()
|
|
635
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
|
|
636
|
+
__result
|
|
637
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
638
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
639
|
+
return __promise
|
|
640
|
+
}()
|
|
641
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
|
|
642
|
+
} catch (let __error) {
|
|
643
|
+
let __exceptionPtr = __error.toCpp()
|
|
644
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
|
|
607
648
|
@inline(__always)
|
|
608
649
|
public final func pushDidRegisterWithToken(deviceToken: ArrayBuffer) -> bridge.Result_std__shared_ptr_Promise_bool___ {
|
|
609
650
|
do {
|
|
@@ -38,6 +38,7 @@ namespace margelo::nitro::acousticconnectrn {
|
|
|
38
38
|
prototype.registerHybridMethod("logDialogDismissEvent", &HybridAcousticConnectRNSpec::logDialogDismissEvent);
|
|
39
39
|
prototype.registerHybridMethod("logDialogButtonClickEvent", &HybridAcousticConnectRNSpec::logDialogButtonClickEvent);
|
|
40
40
|
prototype.registerHybridMethod("logDialogCustomEvent", &HybridAcousticConnectRNSpec::logDialogCustomEvent);
|
|
41
|
+
prototype.registerHybridMethod("logIdentity", &HybridAcousticConnectRNSpec::logIdentity);
|
|
41
42
|
prototype.registerHybridMethod("pushDidRegisterWithToken", &HybridAcousticConnectRNSpec::pushDidRegisterWithToken);
|
|
42
43
|
prototype.registerHybridMethod("pushDidFailToRegister", &HybridAcousticConnectRNSpec::pushDidFailToRegister);
|
|
43
44
|
prototype.registerHybridMethod("pushDidReceiveNotification", &HybridAcousticConnectRNSpec::pushDidReceiveNotification);
|
|
@@ -83,6 +83,7 @@ namespace margelo::nitro::acousticconnectrn {
|
|
|
83
83
|
virtual bool logDialogDismissEvent(const std::string& dialogId, const std::string& dismissReason) = 0;
|
|
84
84
|
virtual bool logDialogButtonClickEvent(const std::string& dialogId, const std::string& buttonText, double buttonIndex) = 0;
|
|
85
85
|
virtual bool logDialogCustomEvent(const std::string& dialogId, const std::string& eventName, const std::unordered_map<std::string, std::variant<bool, std::string, double>>& values) = 0;
|
|
86
|
+
virtual std::shared_ptr<Promise<bool>> logIdentity(const std::string& identifierName, const std::string& identifierValue, const std::optional<std::string>& signalType, const std::optional<std::unordered_map<std::string, std::string>>& additionalParameters) = 0;
|
|
86
87
|
virtual std::shared_ptr<Promise<bool>> pushDidRegisterWithToken(const std::shared_ptr<ArrayBuffer>& deviceToken) = 0;
|
|
87
88
|
virtual std::shared_ptr<Promise<bool>> pushDidFailToRegister(const PushErrorInfo& error) = 0;
|
|
88
89
|
virtual std::shared_ptr<Promise<bool>> pushDidReceiveNotification(const std::unordered_map<std::string, std::variant<bool, std::string, double>>& userInfo) = 0;
|
package/package.json
CHANGED
|
@@ -195,7 +195,7 @@
|
|
|
195
195
|
"source": "src/index",
|
|
196
196
|
"summary": "react-native ios android tealeaf connect cxa wxca er enhanced-replay",
|
|
197
197
|
"types": "./lib/typescript/src/index.d.ts",
|
|
198
|
-
"version": "18.0.
|
|
198
|
+
"version": "18.0.30",
|
|
199
199
|
"workspaces": [
|
|
200
200
|
"example",
|
|
201
201
|
"Examples/bare-workflow"
|
|
@@ -140,6 +140,52 @@ export interface AcousticConnectRN extends HybridObject<{ ios: 'swift', android:
|
|
|
140
140
|
logDialogButtonClickEvent(dialogId: string, buttonText: string, buttonIndex: number): boolean
|
|
141
141
|
logDialogCustomEvent(dialogId: string, eventName: string, values: Record<string, string | number | boolean>): boolean
|
|
142
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Logs a user identity so the current device/session can be associated with
|
|
145
|
+
* a known Connect contact — the foundation for audience building and
|
|
146
|
+
* cross-channel engagement. Wraps the native identity loggers
|
|
147
|
+
* (`ConnectSDK.shared.identity.log` on iOS, `Connect.logIdentificationEvent`
|
|
148
|
+
* on Android).
|
|
149
|
+
*
|
|
150
|
+
* Unlike the synchronous analytics loggers above, this returns a `Promise`:
|
|
151
|
+
* `ConnectSDK.shared` (iOS) is `@MainActor`-isolated, so the bridge hops to the
|
|
152
|
+
* main actor and resolves with the *real* success/failure value rather than
|
|
153
|
+
* firing and forgetting.
|
|
154
|
+
*
|
|
155
|
+
* The native APIs return `false` — and emit no signal — when either
|
|
156
|
+
* `identifierName` or `identifierValue` is empty/blank after trimming.
|
|
157
|
+
*
|
|
158
|
+
* @param identifierName Identifier name, e.g. `'Email'`.
|
|
159
|
+
* @param identifierValue Identifier value, e.g. `'user@example.com'`.
|
|
160
|
+
* @param signalType Optional signal type; the bridge supplies
|
|
161
|
+
* `'loggedIn'` when omitted (identity logging typically marks a sign-in),
|
|
162
|
+
* overriding the native SDKs' own `'pageView'` default.
|
|
163
|
+
* @param additionalParameters Optional extra key/value pairs merged into the
|
|
164
|
+
* signal payload. Only when omitted (`undefined`) does the bridge supply
|
|
165
|
+
* the default `{ registrationMethod: 'email' }`; an explicitly-provided
|
|
166
|
+
* map is used as-is, so passing an empty `{}` sends no extra parameters
|
|
167
|
+
* (the default is not merged in). A `'url'` entry is honoured uniformly on
|
|
168
|
+
* both platforms: on Android it is routed to the SDK's explicit `url`
|
|
169
|
+
* parameter, on iOS it rides inside the parameter map (where the native
|
|
170
|
+
* API expects it).
|
|
171
|
+
* @returns A promise resolving to `true` if the identity signal was
|
|
172
|
+
* dispatched, `false` otherwise (including the blank-identifier case).
|
|
173
|
+
* Never rejects.
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```ts
|
|
177
|
+
* import AcousticConnectRN from 'react-native-acoustic-connect-beta'
|
|
178
|
+
*
|
|
179
|
+
* await AcousticConnectRN.logIdentity('Email', 'user@example.com')
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
logIdentity(
|
|
183
|
+
identifierName: string,
|
|
184
|
+
identifierValue: string,
|
|
185
|
+
signalType?: string,
|
|
186
|
+
additionalParameters?: Record<string, string>
|
|
187
|
+
): Promise<boolean>
|
|
188
|
+
|
|
143
189
|
// ── Push: APNs lifecycle (iOS) ──────────────────────────────────────────
|
|
144
190
|
//
|
|
145
191
|
// Push mode (automatic / manual / off) is configured in `ConnectConfig.json`
|