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

feat(sensors_plus)!: Add support for platform timestamp in event #2506

Merged
merged 5 commits into from
Jul 26, 2024

Conversation

Ortes
Copy link
Contributor

@Ortes Ortes commented Jan 4, 2024

Description

Add timestamp to events from plateform instead of using DateTime.now() at event arrival that can suffer from jitter.
This can be useful to make fft or signal analysis.

I would start this PR as a discussion about the usefulness of this feature or how to implement it

I will provide the iOS implementation in the next few days

Related Issues

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I titled the PR using Conventional Commits.
  • I did not modify the CHANGELOG.md nor the plugin version in pubspec.yaml files.
  • All existing and new tests are passing.
  • The analyzer (flutter analyze) does not report any problems on my PR.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate that with a ! in the title as explained in Conventional Commits).
  • No, this is not a breaking change.
  • The API change but most sensor streams users won't need to change anything (if you don't create events like UserAccelerometerEvent)

@Ortes Ortes changed the title Add support for timestamp in event Android feat(sensors_plus): Add support for timestamp in event Android Jan 4, 2024
@Ortes Ortes marked this pull request as draft January 4, 2024 15:02
@Ortes Ortes changed the title feat(sensors_plus): Add support for timestamp in event Android feat(sensors_plus): Add support for platform timestamp in event Jan 9, 2024
@Ortes Ortes force-pushed the main branch 2 times, most recently from 49f5dfd to ddc9a3c Compare January 9, 2024 22:41
@Ortes Ortes marked this pull request as ready for review January 9, 2024 22:47
@github-actions github-actions bot added the Stale label Jul 8, 2024
@miquelbeltran miquelbeltran self-assigned this Jul 13, 2024
@miquelbeltran
Copy link
Member

I know this has been opened since January, I will see if I can get it merged.

BREAKING CHANGE: Now all events have a `DateTime` property `timestamp` as constructor 4th constructor parameter
@Ortes
Copy link
Contributor Author

Ortes commented Jul 17, 2024

I carefully rebased on main but not test it

@miquelbeltran miquelbeltran changed the title feat(sensors_plus): Add support for platform timestamp in event feat!(sensors_plus): Add support for platform timestamp in event Jul 26, 2024
@miquelbeltran miquelbeltran changed the title feat!(sensors_plus): Add support for platform timestamp in event feat(sensors_plus)!: Add support for platform timestamp in event Jul 26, 2024
@miquelbeltran
Copy link
Member

I've added the timestamp value to the Barometer events. As well, updated the example project to use the provided timestamp to calculate the refresh interval.

I did change the swift code, but I was on Linux so it is probably wrong, need to fix on my Mac.

Overall, the feature looks good to me. I still want to test on iOS when possible.

@miquelbeltran
Copy link
Member

Ok, so my iPhone 12 Mini doesn't have a barometer sensor, but compilation works, so.... 🤷 let's go!

@miquelbeltran miquelbeltran merged commit 8b3df17 into fluttercommunity:main Jul 26, 2024
13 of 14 checks passed
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.

Consider adding timestamps to sensor events
2 participants