Skip to content

Commit

Permalink
profile attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Shahroz16 committed Nov 7, 2024
1 parent 1c7d096 commit 04b15ed
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,9 @@ class CustomerIoPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
}

private fun setProfileAttributes(params: Map<String, Any>) {
// TODO: Fix setProfileAttributes implementation
/*
val attributes = params.getProperty<Map<String, Any>>(Keys.Tracking.ATTRIBUTES) ?: return
val attributes = params.getAsTypeOrNull<Map<String, Any>>(Keys.Tracking.TRAITS) ?: return

CustomerIO.instance().profileAttributes = attributes
*/
}

private fun screen(params: Map<String, Any>) {
Expand Down
11 changes: 3 additions & 8 deletions ios/Classes/SwiftCustomerIoPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,9 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin {
}

private func setProfileAttributes(params : Dictionary<String, AnyHashable>){
// TODO: Fix setProfileAttributes implementation
/*
guard let attributes = params[Keys.Tracking.attributes] as? Dictionary<String, AnyHashable>
else {
return
}
CustomerIO.shared.profileAttributes = attributes
*/
guard let attributes = params[Keys.Tracking.traits] as? Dictionary<String, AnyHashable>
else { return }
CustomerIO.shared.profileAttributes = attributes
}

private func registerDeviceToken(params : Dictionary<String, AnyHashable>){
Expand Down
3 changes: 2 additions & 1 deletion lib/customer_io_const.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class MethodConsts {
}

class TrackingConsts {
static const String identifier = "identifier";
static const String userId = "userId";
static const String traits = "traits";
static const String attributes = "attributes";
static const String eventName = "eventName";
static const String token = "token";
Expand Down
2 changes: 1 addition & 1 deletion lib/customer_io_method_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class CustomerIOMethodChannel extends CustomerIOPlatform {
@override
void setProfileAttributes({required Map<String, dynamic> attributes}) {
try {
final payload = {TrackingConsts.attributes: attributes};
final payload = {TrackingConsts.traits: attributes};
methodChannel.invokeMethod(MethodConsts.setProfileAttributes, payload);
} on PlatformException catch (exception) {
handleException(exception);
Expand Down

0 comments on commit 04b15ed

Please sign in to comment.