Skip to content
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: add identify and base event #166

Merged
merged 4 commits into from
Feb 12, 2024
Merged

Conversation

Mercy811
Copy link
Contributor

@Mercy811 Mercy811 commented Feb 7, 2024

Description

  • Add Identify and BaseEvent
  • The old /lib/identify.dart is still there for dev reference, I will remove it after updating the main Amplitude interfaces like amplitude.identify().

User interfaces

final identify = Identify()
    ..set(property: "color", value: "green")
    ..setOnce(property: "property", value: "value")
    ..add(property: "property", value: "value");

// Event type is required
final event1 = BaseEvent(eventType: "button clicked");
// Can also pass other fields when creating a base event
final event2 = BaseEvent(eventType: "button clicked", eventProperties: {"button color": "green"});

Tests

image

identify

Some logs in identify are not covered. Didn't find an easy way to intercept logging stream or mock and replace the logger.
image

lib/constants.dart Show resolved Hide resolved
lib/events/base_event.dart Show resolved Hide resolved
lib/events/base_event.dart Outdated Show resolved Hide resolved
lib/events/base_event.dart Outdated Show resolved Hide resolved
lib/events/identify.dart Show resolved Hide resolved
@Mercy811 Mercy811 merged commit 6b291d8 into v4.x Feb 12, 2024
2 checks passed
@Mercy811 Mercy811 deleted the AMP-89311-update-interfaces-event branch February 12, 2024 17:49
@yuhao900914
Copy link
Contributor

@Mercy811
Maybe we can skip the log?
https://stackoverflow.com/a/23264375

@Mercy811
Copy link
Contributor Author

Thanks @yuhao900914 I will add it in the next PR.

@Mercy811
Copy link
Contributor Author

It's for C++ and doesn't work in Dart 😔

@yuhao900914
Copy link
Contributor

Good to know. Thanks Xinyi.

Copy link

🎉 This PR is included in version 4.0.0-beta.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants