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

Fix incomplete onEvent payload on iOS #328

Merged
merged 3 commits into from
Nov 24, 2023

Conversation

rolandkakonyi
Copy link
Contributor

@rolandkakonyi rolandkakonyi commented Nov 23, 2023

Description

onEvent listener receives only name and timestamp properties as its payload, regardless of the actual event.

Changes

The problem is that functions declared in extensions in Swift don't support runtime polymorphism, therefore when calling event.toJSON() when event has type Event, it will invoke the one from extension Event, not the actual type's implementation.

To address this I made the JSON serialization protocol-based, thus enabling runtime dynamic dispatch for method calls, resulting in runtime polymorphism.

At I implemented the same approach as we have for Android, with JSONConverter, but that way we would lose the ability to detect missing event serialization during compilation when new events are introduced.

Checklist

  • 🗒 CHANGELOG entry

@rolandkakonyi rolandkakonyi self-assigned this Nov 23, 2023
@rolandkakonyi rolandkakonyi force-pushed the fix-onEvent-payload-on-iOS branch from e67d250 to ac4b48d Compare November 23, 2023 21:16
@rolandkakonyi rolandkakonyi marked this pull request as ready for review November 23, 2023 21:18
@rolandkakonyi rolandkakonyi changed the title Fix reduced onEvent payload on iOS Fix incomplete onEvent payload on iOS Nov 24, 2023
@rolandkakonyi rolandkakonyi requested a review from hawk23 November 24, 2023 09:26
Copy link
Contributor

@hawk23 hawk23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉 🌮

CHANGELOG.md Outdated Show resolved Hide resolved
@rolandkakonyi rolandkakonyi merged commit f3d6f7f into development Nov 24, 2023
8 checks passed
@rolandkakonyi rolandkakonyi deleted the fix-onEvent-payload-on-iOS branch November 24, 2023 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants