Skip to content

Commit

Permalink
profile attributs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Shahroz16 committed Nov 7, 2024
1 parent 8bd4da7 commit 3e925d6
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/customer_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class CustomerIO {
///
/// @param attributes additional attributes for a user profile
void setProfileAttributes({required Map<String, dynamic> attributes}) {
return _platform.setProfileAttributes(attributes: attributes);
return _platform.setProfileAttributes(traits: attributes);
}

/// Subscribes to an in-app event listener.
Expand Down
4 changes: 2 additions & 2 deletions lib/customer_io_method_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ class CustomerIOMethodChannel extends CustomerIOPlatform {
/// Set custom user profile information such as user preference, specific
/// user actions etc
@override
void setProfileAttributes({required Map<String, dynamic> attributes}) {
void setProfileAttributes({required Map<String, dynamic> traits}) {
try {
final payload = {TrackingConsts.traits: attributes};
final payload = {TrackingConsts.traits: traits};
methodChannel.invokeMethod(MethodConsts.setProfileAttributes, payload);
} on PlatformException catch (exception) {
handleException(exception);
Expand Down
2 changes: 1 addition & 1 deletion lib/customer_io_platform_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ abstract class CustomerIOPlatform extends PlatformInterface {
throw UnimplementedError('setDeviceAttributes() has not been implemented.');
}

void setProfileAttributes({required Map<String, dynamic> attributes}) {
void setProfileAttributes({required Map<String, dynamic> traits}) {
throw UnimplementedError(
'setProfileAttributes() has not been implemented.');
}
Expand Down
4 changes: 2 additions & 2 deletions test/customer_io_method_channel_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ void main() {
'setProfileAttributes() should call platform method with correct arguments',
() async {
final Map<String, dynamic> args = {
'attributes': {'age': 1}
'traits': {'age': 1}
};

final customerIO = CustomerIOMethodChannel();
customerIO.setProfileAttributes(attributes: args['attributes']);
customerIO.setProfileAttributes(traits: args['traits']);

expectMethodInvocationArguments('setProfileAttributes', args);
});
Expand Down
2 changes: 1 addition & 1 deletion test/customer_io_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void main() {
CustomerIO.instance.setProfileAttributes(attributes: givenAttributes);
expect(
verify(mockPlatform.setProfileAttributes(
attributes: captureAnyNamed("attributes"),
traits: captureAnyNamed("traits"),
)).captured.first,
givenAttributes,
);
Expand Down
4 changes: 2 additions & 2 deletions test/customer_io_test.mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ class MockTestCustomerIoPlatform extends _i1.Mock
returnValueForMissingStub: null,
);
@override
void setProfileAttributes({required Map<String, dynamic>? attributes}) =>
void setProfileAttributes({required Map<String, dynamic>? traits}) =>
super.noSuchMethod(
Invocation.method(
#setProfileAttributes,
[],
{#attributes: attributes},
{#traits: traits},
),
returnValueForMissingStub: null,
);
Expand Down

0 comments on commit 3e925d6

Please sign in to comment.