Fix SuperwallEventInfo.EventType never matching the enum, and add the missing EventType members - #7
Merged
Conversation
…atform
`serializeEventInfo` on iOS sent `String(describing: info.event)`. On SuperwallKit
versions where `SuperwallEvent` is not CustomStringConvertible that is Swift's
default description, which for a case with associated values is the whole
payload:
transactionComplete(transaction: Optional(SuperwallKit.StoreTransaction), ...)
Android sends `SuperwallEvent.rawName`, which is snake_case
(`transaction_complete`, `freeTrial_start`). Neither shape matches the
PascalCase `EventType` members, `Enum.TryParse` failed, and `EventType` stayed
at its default (`FirstSeen`) with no log line. Every `switch` on it in consumer
code was dead, on both platforms.
iOS now keeps only the leading identifier of the description, which yields the
case name on older SuperwallKit and the snake_case placement name on newer ones.
The C# side normalises both by retrying the parse with underscores stripped, and
logs a warning when a name still does not match instead of silently defaulting.
Found on device: `begin_checkout`-style handlers keyed on
`EventType.TransactionStart` never fired on iOS, and no transaction id was ever
captured from `TransactionComplete`.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Compared every name the two bridges can send - Android's `SuperwallEvent.rawName` values and iOS's `SuperwallEventObjc.description` strings - against the C# `EventType` enum. Twelve native events had no member (`paywall_page_view` fires on every paywall page and was warning several times per session), and two placement names are spelled differently from the member chosen for them (`deepLink_open` vs `DeepLink`, `paywallWebviewLoad_processTerminated` vs `PaywallWebviewProcessTerminated`), so they never matched either. New members are appended, never reordered. The two spelling mismatches are mapped explicitly in `ParseEventType` rather than by renaming the members, which would break consumers switching on them. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
SuperwallEventInfo.EventTypenever matched on either platform, so everyswitchon it in consumer codewas dead:
serializeEventInfosentString(describing: info.event). WhereSuperwallEventis notCustomStringConvertiblethat is Swift's default description, which for a case with associated values isthe whole payload:
transactionComplete(transaction: Optional(SuperwallKit.StoreTransaction), ...).SuperwallEvent.rawName, which is snake_case (transaction_complete,freeTrial_start).Neither shape matches the PascalCase C# members,
Enum.TryParsefailed silently, andEventTypestayedat its default (
FirstSeen).Separately, twelve names the native SDKs emit had no C# member at all (
paywall_page_viewwarned severaltimes per session), and two placement names are spelled differently from the member chosen for them
(
deepLink_openvsDeepLink,paywallWebviewLoad_processTerminatedvsPaywallWebviewProcessTerminated).Fix
snake_case placement name on newer ones.
name still does not match instead of defaulting silently.
EventTypemembers are appended, never reordered. The two spelling mismatches are mapped explicitlyin
ParseEventTyperather than by renaming members, which would break consumers switching on them.Verification
On device (Android and iOS):
TransactionStart/TransactionCompletehandlers fire, transaction ids arecaptured, and no
Unrecognised eventTypewarning remains in a full purchase session.Checked against SuperwallKit 4.16.3 and superwall-android 2.7.23.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LTHPGB4qyAwDVYmQHW87ex