Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ class _MyAppState extends State<MyApp> {
log("init SDK result is:$result");
}

Future<void> initClickstreamWithoutGlobalAttribute() async {
bool result = await analytics.init(
appId: "shopping",
endpoint: testEndpoint,
isLogEvents: true,
isTrackScreenViewEvents: true,
isCompressEvents: false,
sessionTimeoutDuration: 30000,
);
log("init SDK result is:$result");
}

@override
Widget build(BuildContext context) {
return MaterialApp(
Expand All @@ -75,6 +87,14 @@ class _MyAppState extends State<MyApp> {
},
minLeadingWidth: 0,
),
ListTile(
leading: const Icon(Icons.not_started_sharp),
title: const Text('initSDKWithoutGlobalAttribute'),
onTap: () async {
initClickstreamWithoutGlobalAttribute();
},
minLeadingWidth: 0,
),
ListTile(
leading: const Icon(Icons.circle),
title: const Text('recordEventWithName'),
Expand Down
3 changes: 1 addition & 2 deletions ios/Classes/ClickstreamFlutterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ public class ClickstreamFlutterPlugin: NSObject, FlutterPlugin {
.withSessionTimeoutDuration(arguments["sessionTimeoutDuration"] as! Int64)
.withCompressEvents(arguments["isCompressEvents"] as! Bool)
.withAuthCookie(arguments["authCookie"] as! String)
if arguments["globalAttributes"] != nil {
let attributes = arguments["globalAttributes"] as! [String: Any]
if let attributes = arguments["globalAttributes"] as? [String: Any] {
if attributes.count > 0 {
let globalAttributes = getClickstreamAttributes(attributes)
_ = configuration.withInitialGlobalAttributes(globalAttributes)
Expand Down