Skip to content

Update SDK & Add custom callbacks#160

Merged
ianrumac merged 4 commits intomainfrom
ir/feat/callbacks-android
Feb 6, 2026
Merged

Update SDK & Add custom callbacks#160
ianrumac merged 4 commits intomainfrom
ir/feat/callbacks-android

Conversation

@ianrumac
Copy link
Contributor

@ianrumac ianrumac commented Feb 6, 2026

Greptile Overview

Greptile Summary

  • Bumps native SDK dependencies (Android Superwall SDK 2.7.0, iOS SuperwallKit 4.12.10).
  • Adds paywall state to PaywallInfo JSON serialization on both platforms and propagates it to TS/compat types.
  • Introduces a new cross-platform onCustomCallback event emitted from native paywalls and a didHandleCustomCallback JS→native response path.
  • Wires custom-callback handling into both hooks-based (useSuperwallEvents/usePlacement) and compat (src/compat/index.ts) APIs.

Confidence Score: 2/5

  • This PR has correctness risks around custom-callback routing and potential native hangs/leaks, so it should not be merged until those are addressed.
  • Custom callbacks can be answered by the wrong JS listener (unscoped useSuperwallEvents), causing incorrect failures; additionally, both iOS and Android native implementations can await indefinitely if JS never replies, retaining futures/continuations. These issues affect runtime behavior in common app setups (global listeners + placements).
  • src/useSuperwallEvents.ts, android/src/main/java/expo/modules/superwallexpo/SuperwallExpoModule.kt, ios/SuperwallExpoModule.swift

Important Files Changed

Filename Overview
.changeset/lemon-beans-wear.md Adds a changeset noting SDK bumps and custom callbacks.
android/build.gradle Bumps Superwall Android SDK dependency from 2.6.8 to 2.7.0.
android/src/main/java/expo/modules/superwallexpo/SuperwallExpoModule.kt Adds onCustomCallback event plumbing and didHandleCustomCallback bridge; introduces risk of hanging callbacks and thread-safety issues with shared mutable future map.
android/src/main/java/expo/modules/superwallexpo/json/PaywallInfo.kt Adds PaywallInfo.state serialization into JSON map.
ios/Json/PaywallInfo+Json.swift Adds PaywallInfo.state serialization into JSON map.
ios/SuperwallExpo.podspec Bumps SuperwallKit dependency from 4.12.9 to 4.12.10.
ios/SuperwallExpoModule.swift Adds onCustomCallback async handler and didHandleCustomCallback bridge; introduces risk of leaked continuations/hanging callbacks due to unbounded continuation storage.
src/SuperwallExpoModule.ts Extends native module interface with didHandleCustomCallback method signature.
src/SuperwallExpoModule.types.ts Adds PaywallInfo.state, plus CustomCallback and CustomCallbackResult types and onCustomCallback event typing.
src/compat/index.ts Adds compat-layer listener for onCustomCallback and forwards results back to native via didHandleCustomCallback; error handling covers missing handler.
src/compat/lib/PaywallInfo.ts Adds state field to compat PaywallInfo and populates it from JSON.
src/compat/lib/PaywallPresentationHandler.ts Adds onCustomCallback handler support to compat PaywallPresentationHandler.
src/usePlacement.ts Adds onCustomCallback to usePlacement callbacks and passes through to useSuperwallEvents.
src/useSuperwallEvents.ts Adds onCustomCallback callback and listener that filters by handlerId; current filter logic can cause unscoped listeners to respond and incorrectly fail callbacks.

Sequence Diagram

sequenceDiagram
    autonumber
    participant Paywall as Superwall SDK (native)
    participant Native as Expo Superwall Module (iOS/Android)
    participant JS as JS listener (hooks/compat)

    Paywall->>Native: onCustomCallback(callback)
    Native->>Native: create callbackId + store future/continuation
    Native-->>JS: emit onCustomCallback({callbackId,name,variables,handlerId})

    alt JS handler matches handlerId
        JS->>JS: user onCustomCallback executes
        JS-->>Native: didHandleCustomCallback(callbackId,status,data)
        Native->>Native: resolve future/continuation
        Native-->>Paywall: return CustomCallbackResult
    else no JS handler / wrong listener responds
        JS-->>Native: didHandleCustomCallback(callbackId,"failure")
        Native-->>Paywall: failure branch
    end

    Note over JS,Native: If no didHandleCustomCallback is sent,
    Note over Native: future/continuation remains stored and native awaits indefinitely.
Loading

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 6, 2026

Open in StackBlitz

npm i https://pkg.pr.new/superwall/expo-superwall@160

commit: 6932ad0

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

14 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

@ianrumac ianrumac force-pushed the ir/feat/callbacks-android branch from b350d3c to aa03f4e Compare February 6, 2026 17:34
@ianrumac ianrumac changed the title Ir/feat/callbacks android Update SDK & Add custom callbacks Feb 6, 2026
@ianrumac ianrumac merged commit d3b0f33 into main Feb 6, 2026
7 checks passed
@ianrumac ianrumac deleted the ir/feat/callbacks-android branch February 6, 2026 18:20
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.

1 participant