Make all SuperwallDelegate methods optional#138
Open
Conversation
Give all abstract methods default empty implementations so users only need to override the callbacks they care about. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add TestModeBehavior enum and testModeBehavior option to SuperwallOptions - Add 6 new SuperwallEvent types: stripeCheckoutStart/Submit/Complete/Fail (iOS), testModeModalOpen/Close (both) - Opt example app out of Flutter UIScene auto-migration Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Additional Comments (1)
|
Co-Authored-By: Claude Opus 4.6 <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.
Summary
SuperwallDelegatemethods default empty implementations so users only need to override the callbacks they care about4.13.0→4.14.0, Android2.7.1→2.7.4TestModeBehaviorenum andtestModeBehaviorproperty toSuperwallOptionsSuperwallEventtypes:stripeCheckoutStart,stripeCheckoutSubmit,stripeCheckoutComplete,stripeCheckoutFail(iOS),testModeModalOpen,testModeModalClose(both)Test plan
Greptile Summary
This PR successfully makes all
SuperwallDelegatemethods optional by providing default empty implementations, significantly improving the developer experience. Previously, developers had to implement 10 abstract methods even if they didn't need them; now they can create a delegate with zero overrides and only implement the callbacks they care about.The PR also updates the native SDKs (iOS 4.13.0 → 4.14.0, Android 2.7.1 → 2.7.4) and adds support for test mode behavior configuration and 6 new event types:
TestModeBehaviorenum with four options (automatic, whenEnabledForUser, never, always) properly mapped across all platformsThe implementation is thorough with proper enum mappings across Dart, iOS (Swift), and Android (Kotlin). The Pigeon-generated code has been regenerated correctly (v26.1.10). All changes are backward compatible - existing delegate implementations continue to work without modification.
Confidence Score: 5/5
toJson()extension method missing the new field, but this doesn't affect functionality since the actual conversion uses Pigeon's type system directly.Important Files Changed
TestModeBehaviorenum andtestModeBehaviorproperty;toJson()missing new field but appears unused_convertTestModeBehavior()helper method with proper enum conversiontestModeBehaviorto iOS SDK enum values correctlytestModeBehaviorto Android SDK enum with proper default handlingFlowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Flutter App] --> B[SuperwallDelegate] B --> C{Optional Methods} C -->|Before| D[Required: 10 abstract methods] C -->|After| E[Optional: 15 methods with defaults] A --> F[SuperwallOptions] F --> G[testModeBehavior] G --> H[iOS 4.14.0] G --> I[Android 2.7.4] A --> J[SuperwallEventInfo] J --> K[6 New Event Types] K --> L[Stripe iOS Only] K --> M[Test Mode Both Platforms] style E fill:#90EE90 style D fill:#FFB6C6Last reviewed commit: 5373050