Skip to content

Fix SuperwallEventInfo.EventType never matching the enum, and add the missing EventType members - #7

Merged
ianrumac merged 2 commits into
superwall:mainfrom
bilck:fix/event-type-name
Sep 9, 2026
Merged

ianrumac merged 2 commits into
superwall:mainfrom
bilck:fix/event-type-name

Conversation

@bilck

@bilck bilck commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Problem

SuperwallEventInfo.EventType never matched on either platform, so every switch on it in consumer code
was dead:

  • iOS serializeEventInfo sent String(describing: info.event). 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 sent SuperwallEvent.rawName, which is snake_case (transaction_complete, freeTrial_start).

Neither shape matches the PascalCase C# members, Enum.TryParse failed silently, and EventType stayed
at its default (FirstSeen).

Separately, twelve names the native SDKs emit had no C# member at all (paywall_page_view warned 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).

Fix

  • iOS keeps only the leading identifier of the description: the case name on older SuperwallKit, the
    snake_case placement name on newer ones.
  • C# normalises both shapes by retrying the parse with underscores stripped, and logs a warning when a
    name still does not match instead of defaulting silently.
  • New EventType members are appended, never reordered. The two spelling mismatches are mapped explicitly
    in ParseEventType rather than by renaming members, which would break consumers switching on them.

Verification

On device (Android and iOS): TransactionStart / TransactionComplete handlers fire, transaction ids are
captured, and no Unrecognised eventType warning 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

bilck and others added 2 commits September 3, 2026 22:17
…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>
@ianrumac
ianrumac merged commit d97d250 into superwall:main Sep 9, 2026
3 checks passed
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