Skip to content

Add DeferredPurchasesListener bridge (iOS + Android)#302

Open
NickSxti wants to merge 13 commits intomainfrom
feature/deferred-purchases-listener
Open

Add DeferredPurchasesListener bridge (iOS + Android)#302
NickSxti wants to merge 13 commits intomainfrom
feature/deferred-purchases-listener

Conversation

@NickSxti
Copy link
Copy Markdown

Summary

  • Bridge the new DeferredPurchasesListener from native SDKs (iOS #648, Android #785) through the Sandwich SDK layer
  • iOS: implement Qonversion.DeferredPurchasesListener on QonversionSandwich, add toMap() mapper for DeferredTransaction, register listener during init and async events
  • Android: add setDeferredPurchasesListener() builder extension, add QDeferredTransaction.toMap() mapper, wire through QonversionEventsListener

Test plan

  • iOS build verified locally (xcodebuild)
  • Android build (requires Java 11+, not available locally)
  • Verify deferred purchase callback reaches cross-platform layer on iOS
  • Verify deferred purchase callback reaches cross-platform layer on Android

Fixes DEV-672

Generated with Claude Code

Bridge the new DeferredPurchasesListener from native SDKs through the
Sandwich layer for cross-platform SDK consumption.

iOS: implement Qonversion.DeferredPurchasesListener, add toMap() mapper
for DeferredTransaction, register listener in config and async events.

Android: add setDeferredPurchasesListener() builder extension, add
QDeferredTransaction.toMap() mapper, wire through QonversionEventsListener.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
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:

Podspec/Podfile changes - The QonversionSandwich.podspec was changed from "6.6.1" to "~> 6.6" and ios/Podfile was updated to point to the iOS SDK feature branch. These are development-only changes and should be reverted before merge - the podspec version should point to the new iOS SDK release version once DEV-664 is merged and released.

Code changes look correct - both iOS and Android follow the exact same pattern as the existing EntitlementsUpdateListener bridge:

  • iOS: QonversionSandwich conforms to Qonversion.DeferredPurchasesListener, serializes DeferredTransaction via .toMap().clearEmptyValues(), and forwards to qonversionEventListener
  • Android: private QonversionConfig.Builder.setDeferredPurchasesListener() extension creates anonymous QDeferredPurchasesListener, serializes via .toMap(), and forwards to qonversionEventsListener
  • Mapper keys (productId, transactionId, originalTransactionId, type, value, currency) are consistent across iOS and Android

iOS build verified locally (xcodebuild succeeded). Android build not verifiable locally (Java 8, needs 11+).

NickSxti and others added 3 commits March 24, 2026 18:35
pod lib lint can't resolve unpublished Qonversion types
(DeferredTransaction, DeferredPurchasesListener) since they only
exist in the iOS SDK development branch. Use workspace build with
the Podfile that points to the dev branch instead.

TODO: revert to `pod lib lint --allow-warnings` after Qonversion
6.7.0 is published to CocoaPods.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…er review

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…redTransaction

iOS SDK PR #648 removed QONDeferredTransaction and changed
DeferredPurchasesListener to receive QONPurchaseResult instead.
This updates the Sandwich iOS bridge to match:

- Remove DeferredTransaction and DeferredTransactionType mappers
  (the types no longer exist in the iOS SDK)
- Update deferredPurchaseCompleted to receive PurchaseResult and
  use its existing toMap(), matching Android Sandwich behavior

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@NickSxti
Copy link
Copy Markdown
Author

iOS bridge updated to match iOS SDK changes

iOS SDK PR qonversion/qonversion-ios-sdk#648 removed QONDeferredTransaction model and changed DeferredPurchasesListener to receive QONPurchaseResult instead. The Sandwich iOS bridge was referencing the deleted type, which would fail to compile.

Changes (a7914d1):

  • Removed DeferredTransaction and DeferredTransactionType mappers from Mappers.swift - these types no longer exist in the iOS SDK
  • Updated deferredPurchaseCompleted in QonversionSandwich.swift to receive Qonversion.PurchaseResult and use its existing toMap() method

This aligns iOS with Android, which already sends purchaseResult.toMap() through the bridge.

Note for Flutter/RN PRs

Both Flutter (#436) and React Native (#423) currently define a DeferredTransaction model that expects a flat structure (productId, transactionId, etc.). However, both iOS and Android Sandwich now emit a PurchaseResult map (with nested storeTransaction, entitlements, status, etc.). The Flutter/RN PRs need to parse this PurchaseResult shape instead.

NickSxti and others added 6 commits March 26, 2026 18:39
…ency

Keep ~> 6.6 constraint since this branch depends on iOS SDK changes
from the deferred-purchase-listener branch (not yet released).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The lockfile was pinned to 647989e which still had the deleted
QONDeferredTransaction type. Update to 371a5a8 which has the
PurchaseResult-based DeferredPurchasesListener protocol.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Manually editing the lockfile commit hash broke pod install because
SPEC CHECKSUMS didn't match. Regenerated via pod install to get
correct checksums. Build verified locally.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolve version conflict in QonversionSandwich.podspec - keep 6.9.0 from main.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tibility

The CI uses the iOS SDK dev branch (feature/deferred-purchase-listener) which
doesn't match the exact 6.9.0 version. Use ~> 6.6 to allow the dev branch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@qonversion qonversion deleted a comment from NickSxti Apr 1, 2026
Comment on lines +18 to +22
# TODO: revert to `pod lib lint --allow-warnings` after Qonversion 6.7.0 is published to CocoaPods
# Pre-release: pod lib lint can't resolve unpublished Qonversion types (DeferredTransaction etc.)
# Using workspace build instead - the Podfile points to the iOS SDK development branch
cd ios && pod install && cd ..
xcodebuild build -workspace ios/QonversionSandwich.xcworkspace -scheme Pods-Sample -destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' -quiet
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Revert this

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Reverted.

ios/Podfile Outdated

target 'Sample' do
pod 'QonversionSandwich', :path => '../'
pod 'Qonversion', :git => 'https://github.com/qonversion/qonversion-ios-sdk.git', :branch => 'feature/deferred-purchase-listener'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Revert this

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Reverted.

}
s.source_files = 'ios/sandwich/**/*.{h,m,swift}'
s.dependency "Qonversion", "6.9.0"
s.dependency "Qonversion", "~> 6.6"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why not the latest version?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Tightened to ~> 6.8. Can't pin to exactly 6.9.0 because the iOS SDK feature branch (feature/deferred-purchase-listener) reports as version 6.8.0 in its podspec - pod install would fail on the version constraint. Will pin to the exact release version once the iOS SDK publishes the DeferredPurchasesListener.

NickSxti and others added 2 commits April 1, 2026 19:45
Can't pin to exactly 6.9.0 because the iOS SDK feature branch
(feature/deferred-purchase-listener) reports as 6.8.0, which would
cause pod install to fail. Tightened from ~> 6.6 to ~> 6.8.
Will be pinned to the exact release version once the iOS SDK
publishes the DeferredPurchasesListener feature.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reverted CI workflow back to pod lib lint and removed the
Qonversion git branch override from Podfile. Regenerated
Podfile.lock with Qonversion 6.9.0 from CocoaPods.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@NickSxti
Copy link
Copy Markdown
Author

NickSxti commented Apr 1, 2026

@SpertsyanKM CI fails after reverting checks.yml - pod lib lint can't resolve DeferredPurchasesListener since it's not in the published Qonversion SDK yet (only on the feature branch). Should we wait for the iOS SDK release (qonversion/qonversion-ios-sdk#648) before merging this, or keep the workspace build workaround in CI until then?

DeferredPurchasesListener requires 6.9.0 (no 6.8.x releases exist).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@SpertsyanKM SpertsyanKM left a comment

Choose a reason for hiding this comment

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

Yes, we should wait. We can't merge to dev the code that expects unreleased native SDK version. After it's released, just restart checks and then merge.

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