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

Fix crash related to Amazon AppStore SDK #1621

Merged
merged 2 commits into from
Aug 10, 2022
Merged

Fix crash related to Amazon AppStore SDK #1621

merged 2 commits into from
Aug 10, 2022

Conversation

nan-li
Copy link
Contributor

@nan-li nan-li commented Aug 10, 2022

Description

One Line Summary

Fix crash for users of Amazon AppStore SDK v3.x.

Details

Motivation

Other Changes

  • Remove dependency in-app-purchasing-2.0.1.jar which is from 2015, and instead compile against its replacement amazon-appstore-sdk v3.x. This change currently makes no difference at compile time, as this crash was only encountered at runtime, but still good to update this dependency to what users are more likely to be currently using.

Scope

Only affects users of Amazon's AppStore SDK v3.x, for whom the OneSignal SDK was not working in the first place. So even though there is a danger zone to calling this method on the main thread, it is still preferable.

Note that onAppLostFocus() can trigger PurchasingService.registerListener() in certain cases. See here. We will need to monitor or make changes.

^ ⚠️ I am concerned if this will pose a significant issue.

Testing

Unit testing

There are no existing unit tests for Amazon purchases. No new tests are added.

Note: Unrelated, but test testNotificationProcessingAndForegroundHandler_displayCalled_noMutateId is failing. Looks like due to changes in #1597

Manual testing

Environment: Android Studio 2020.3.1.
Device: Pixel 3a emulator - API 30
App: OneSignal demo app in the SDK

First, reproduced the crash by using amazon appstore v3.0.1 and v3.0.3 (the latest version at time of writing).
Then, confirm IAP SDK works the same as before by using in-app-purchasing-2.0.1.jar (these are not available on Maven).

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes
  • Integration with other SDKs
  • In-App Purchases

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

This change is Reviewable

register listener on main thread for appstore sdk v3.x
* Amazon IAP SDK v2.x is deprecated and developers are encouraged to use AppStore SDK v3.x. Users were getting a crash on initialization.
* To support the AppStore SDK, `PurchasingService.registerListener()` must run on the main thread.
* Note: We do still support the existing implementation for IAP SDK v2.x, and we won't register on the main thread.
* Remove dependency `in-app-purchasing-2.0.1.jar` which is from 2015, and instead compile against its replacement `amazon-appstore-sdk` v3.x. This change currently makes no difference at compile time, as this crash was only encountered at runtime, but still good to update this dependency to what users are more likely to be currently using.
@nan-li nan-li requested a review from a team August 10, 2022 01:12
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.

None yet

2 participants