You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add SetDefaultEventParameters and ClearDefaultEventParameters to Analytics
This change introduces two new C++ Analytics SDK functions:
- `SetDefaultEventParameters(const std::map<std::string, firebase::Variant>& params)`:
Allows setting default parameters (string, int64, double, bool, null)
that will be included in all subsequent `LogEvent` calls.
If a `firebase::Variant::Null()` is provided for a key, that specific
default parameter will be cleared. Aggregate types (maps, vectors) are not
supported and will be skipped with an error logged.
- `ClearDefaultEventParameters()`: Clears all currently set default event
parameters.
Platform implementations:
- iOS: Uses `[FIRAnalytics setDefaultEventParameters:]`. `firebase::Variant::Null()`
maps to `[NSNull null]`. Unsupported types are skipped.
- Android: Uses `FirebaseAnalytics.setDefaultEventParameters(Bundle)`.
`firebase::Variant::Null()` results in `Bundle.putString(key, null)`.
Unsupported types are skipped. `AddVariantToBundle` is used for efficiency
with scalar types.
- Stub: Implemented as no-ops.
Unit tests and integration tests have been reviewed and updated to cover these
functionalities and type constraints.
// AddVariantToBundle handles these types and their JNI conversions.
648
+
// It also logs if an individual AddToBundle within it fails or if a type is unsupported by it.
649
+
if (!AddVariantToBundle(env, bundle, key_cstr, value)) {
650
+
// This specific log gives context that the failure happened during SetDefaultEventParameters
651
+
// for a type that was expected to be supported by AddVariantToBundle.
652
+
LogError("SetDefaultEventParameters: Failed to add parameter for key '%s' with supported type '%s'. This might indicate a JNI issue during conversion.",
LogError("SetDefaultEventParameters: Value for key '%s' has type '%s' which is not supported for default event parameters. Only string, int64, double, bool, and null are supported. Skipping.",
LogError("SetDefaultEventParameters: Value for key '%s' has type '%s' which is not supported for default event parameters. Only string, int64, double, bool, and null are supported. Skipping.",
0 commit comments