Skip to content

Fix runtime crash when using amazon and targetting android 14#1622

Merged
tonidero merged 2 commits into
mainfrom
fix-compilation-android-14-amazon
Feb 21, 2024
Merged

Fix runtime crash when using amazon and targetting android 14#1622
tonidero merged 2 commits into
mainfrom
fix-compilation-android-14-amazon

Conversation

@tonidero

Copy link
Copy Markdown
Contributor

Description

As reported in #1621, the app crashed when using amazon and targetting android 14 in an android 14 device and starting a purchase. This fixes the issue.

@tonidero tonidero added the pr:fix A bug fix label Feb 21, 2024
@tonidero tonidero requested a review from a team February 21, 2024 11:46
Comment thread gradle/libs.versions.toml
appcompat = "1.4.1"
dokka = "1.8.10"
androidxCore = "1.8.0"
androidxCore = "1.12.0"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Didn't see anything concerning in these and allows us to use the new ContextCompat.registerReceiver

internal var broadcastReceiver: ProxyAmazonBillingActivityBroadcastReceiver? = null
private val filter = ProxyAmazonBillingActivityBroadcastReceiver.newPurchaseFinishedIntentFilter()

@SuppressLint("WrongConstant")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was very weird... The linter was complaining that we were passing the wrong type when passing ContextCompat.RECEIVER_EXPORTED even though it's the expected type...

}

@VisibleForTesting(otherwise = PRIVATE)
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This broke compilation after the update for some reason... In any case, this is how we do it everywhere else.

@codecov

codecov Bot commented Feb 21, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fc862f0) 83.67% compared to head (a5d830f) 83.67%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1622   +/-   ##
=======================================
  Coverage   83.67%   83.67%           
=======================================
  Files         219      219           
  Lines        7343     7343           
  Branches     1023     1023           
=======================================
  Hits         6144     6144           
  Misses        799      799           
  Partials      400      400           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tonidero tonidero merged commit 5e451b7 into main Feb 21, 2024
@tonidero tonidero deleted the fix-compilation-android-14-amazon branch February 21, 2024 12:27
tonidero pushed a commit that referenced this pull request Feb 22, 2024
**This is an automatic release.**

### New Features
* Add setDisplayDismissButton to PaywallView (#1608) via Cesar de la
Vega (@vegaro)
### Bugfixes
* Fix runtime crash when using amazon and targetting android 14 (#1622)
via Toni Rico (@tonidero)
* Paywalls: No-op on all view model methods in the Loading paywall
screen (#1617) via Toni Rico (@tonidero)
* Fix safe insets on full screen (#1613) via Cesar de la Vega (@vegaro)
### Other Changes
* Change default paywall background with a lower quality image (#1623)
via Toni Rico (@tonidero)
* Fix load shedder integration tests (#1618) via Cesar de la Vega
(@vegaro)
* Refactor `presentedOfferingIdentifier` into `presentedOfferingContext`
object (#1612) via Toni Rico (@tonidero)
* [External] Update russian and kazakh translations (#1577 by @janbolat)
(#1616) via Toni Rico (@tonidero)

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
tonidero added a commit that referenced this pull request Mar 13, 2024
### Description
In #1622, we updated to androidx core 1.12.0 which increased the target
version to 34. This however, brought some problems in some of the
hybrids: RevenueCat/purchases-capacitor#211.

This update was to access some optional method that we can easily
implement ourselves, so we are reverting that update and implementing
the fallback for registering the receiver ourselves.

We will add additional checks to avoid inadvertently upgrading the
target version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants