Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed crash on async SK1 cancelled purchase #1869

Merged
merged 1 commit into from
Aug 29, 2022
Merged

Commits on Aug 29, 2022

  1. Fixed crash on async SK1 cancelled purchase

    Fixes #1868.
    See #1868 (comment) for a summary of the changes in #1841.
    
    ### Before #1841:
    - SK1 / completion-block: no `CustomerInfo` + cancelled + `ErrorCode.purchaseCancelledError`
    - SK1 / `async`: thrown `ErrorCode.purchaseCancelledError`
    - SK2 / completion-block: `CustomerInfo` + cancelled + no error
    - SK2 / `async`: `CustomerInfo` + cancelled (not error)
    
    ### After #1841:
    - SK1 / completion-block:  no `CustomerInfo` + cancelled + `ErrorCode.purchaseCancelledError`
    - SK1 / `async`: no `CustomerInfo` + ignored error -> crash! 🚨
    - SK2 / completion-block: `CustomerInfo` + cancelled + `ErrorCode.purchaseCancelledError`
    - SK2 / `async`: `CustomerInfo` + cancelled (not error)
    
    ### After this PR:
    - SK1 / completion-block:  no `CustomerInfo` + cancelled + `ErrorCode.purchaseCancelledError`
    - **SK1 / `async`: thrown `ErrorCode.purchaseCancelledError`** ⚠️
    - SK2 / completion-block: `CustomerInfo` + cancelled + `ErrorCode.purchaseCancelledError`
    - SK2 / `async`: `CustomerInfo` + cancelled (not error)
    
    The change in #1841 was slightly incorrect. The `ignoreIfPurchaseCancelled` didn't make a lot of sense because `Result(value:error:)` already ignored the error if the value wasn't `nil`.
    
    This change still doesn't get us to a fully consistent behavior across SK1 and SK2 but it adds coverage for this crash and temporarily fixes it.
    NachoSoto committed Aug 29, 2022
    Configuration menu
    Copy the full SHA
    8b82758 View commit details
    Browse the repository at this point in the history