-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: update screen tracking parameters #167
Changes from all commits
3db634f
5bdecac
a661d96
6833e12
566b4bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,15 +108,6 @@ extension AmiAppStringExtensions on String { | |
} | ||
} | ||
|
||
extension AmiAppIntExtensions on int { | ||
String? toTrimmedString() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we now use Int for flush properties, we no longer need this extension |
||
if (this % 1.0 != 0.0) { | ||
return toString(); | ||
} | ||
return toStringAsFixed(0); | ||
} | ||
} | ||
|
||
extension LocationExtensions on GoRouter { | ||
// Get location of current route | ||
// This is a workaround to get the current location as location property | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ import 'customer_io_config.dart'; | |
import 'customer_io_enums.dart'; | ||
import 'customer_io_inapp.dart'; | ||
import 'customer_io_platform_interface.dart'; | ||
import 'extensions/map_extensions.dart'; | ||
import 'messaging_in_app/platform_interface.dart'; | ||
import 'messaging_push/platform_interface.dart'; | ||
|
||
|
@@ -88,9 +89,9 @@ class CustomerIO { | |
/// @param userId unique identifier for a profile | ||
/// @param traits (Optional) params to set profile attributes | ||
void identify( | ||
{required String userId, | ||
Map<String, dynamic> traits = const {}}) { | ||
return _platform.identify(userId: userId, traits: traits); | ||
{required String userId, Map<String, dynamic> traits = const {}}) { | ||
return _platform.identify( | ||
userId: userId, traits: traits.excludeNullValues()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Excluded |
||
} | ||
|
||
/// Call this function to stop identifying a person. | ||
|
@@ -108,7 +109,8 @@ class CustomerIO { | |
/// @param properties (Optional) params to be sent with event | ||
void track( | ||
{required String name, Map<String, dynamic> properties = const {}}) { | ||
return _platform.track(name: name, properties: properties); | ||
return _platform.track( | ||
name: name, properties: properties.excludeNullValues()); | ||
} | ||
|
||
/// Track a push metric | ||
|
@@ -131,8 +133,9 @@ class CustomerIO { | |
/// @param name name of the screen user visited | ||
/// @param attributes (Optional) params to be sent with event | ||
void screen( | ||
{required String name, Map<String, dynamic> attributes = const {}}) { | ||
return _platform.screen(name: name, attributes: attributes); | ||
{required String title, Map<String, dynamic> properties = const {}}) { | ||
return _platform.screen( | ||
title: title, properties: properties.excludeNullValues()); | ||
} | ||
|
||
/// Use this function to send custom device attributes | ||
|
@@ -148,7 +151,8 @@ class CustomerIO { | |
/// | ||
/// @param attributes additional attributes for a user profile | ||
void setProfileAttributes({required Map<String, dynamic> attributes}) { | ||
return _platform.setProfileAttributes(traits: attributes); | ||
return _platform.setProfileAttributes( | ||
traits: attributes.excludeNullValues()); | ||
} | ||
|
||
/// Subscribes to an in-app event listener. | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,7 @@ | ||||||
/// Extensions for [Map] class that provide additional functionality and convenience methods. | ||||||
extension CustomerIOMapExtension on Map<String, dynamic> { | ||||||
/// Returns a new map with entries that have non-null values, excluding null values. | ||||||
Map<String, dynamic> excludeNullValues() { | ||||||
return Map.fromEntries(entries.where((entry) => entry.value != null)); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
not this exact place but dart provides this utility method There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It definitely sounds good, but I deliberately avoided modifying the same map because removing items directly could unintentionally alter customer provided map, which might cause issues in their app. So I created a new map instance to avoid any potential side effects. |
||||||
} | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because these are only app settings, I updated them to non-nullable