Skip to content

Add DeferredPurchasesListener via EventChannel bridge#436

Open
NickSxti wants to merge 2 commits intodevelopfrom
feature/deferred-purchases-listener
Open

Add DeferredPurchasesListener via EventChannel bridge#436
NickSxti wants to merge 2 commits intodevelopfrom
feature/deferred-purchases-listener

Conversation

@NickSxti
Copy link

Summary

  • Add deferredPurchaseStream to public Qonversion API as Stream<QDeferredTransaction>
  • Create QDeferredTransaction Dart model with fromJson factory
  • Wire native qonversionDidCompleteDeferredPurchase / onDeferredPurchaseCompleted events through qonversion_flutter_deferred_purchase EventChannel
  • iOS, macOS, and Android native bridges updated

Dependencies

Test plan

  • Flutter analyze passes
  • iOS example app builds
  • Android example app builds
  • Verify deferred purchase stream emits events

Fixes DEV-674

Generated with Claude Code

SpertsyanKM and others added 2 commits February 24, 2026 16:25
Add deferredPurchaseStream to Qonversion API, exposing deferred
purchase completions as a Stream<QDeferredTransaction>.

- Create QDeferredTransaction Dart model with fromJson factory
- Add qonversion_flutter_deferred_purchase EventChannel
- iOS/macOS: forward qonversionDidCompleteDeferredPurchase to EventChannel
- Android: forward onDeferredPurchaseCompleted to EventChannel

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@NickSxti NickSxti requested a review from SpertsyanKM March 18, 2026 12:12
Copy link
Author

@NickSxti NickSxti left a comment

Choose a reason for hiding this comment

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

Self-review notes:

Follows existing EventChannel pattern exactly - the implementation mirrors updatedEntitlementsStream at every layer:

  • Dart: new EventChannel('qonversion_flutter_deferred_purchase') with .receiveBroadcastStream().cast<String>().map() to QDeferredTransaction.fromJson()
  • iOS: FlutterListenerWrapper registered with postfix "deferred_purchase", event forwarded via eventSink on main thread
  • macOS: same as iOS
  • Android: BaseListenerWrapper with EVENT_CHANNEL_DEFERRED_PURCHASE, Gson serialization to eventSink

QDeferredTransaction model - uses fromJson factory with safe null-coalescing (as String? ?? ''), handles num to double conversion for value field. Keys match the Sandwich SDK mapper output (productId, transactionId, originalTransactionId, type, value, currency).

Cleanup - Android tearDown() properly nullifies deferredPurchaseStreamHandler.

Not verified locally - Flutter/Dart not installed. Code follows established patterns 1:1.

Depends on: Sandwich SDK PR qonversion/sandwich-sdk#302

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants