Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[in_app_purchase] Fix crash when retrieveReceiptWithError gives an error. #4138

Merged
merged 7 commits into from
Jul 8, 2021

Conversation

renefloor
Copy link
Contributor

It seems like the app is crashing because it can't send receiptError.userInfo over the methodchannel in a FlutterError. This PR uses the existing error mapper to parse the error to something that can be send over the methodchannel.

Fixes flutter/flutter#85943
Fixes flutter/flutter#85960

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Note that unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@vladb99
Copy link
Contributor

vladb99 commented Jul 6, 2021

I tested and in my case it doesn't crash anymore.
Awesome, thanks for the quick fix!

Copy link
Contributor

@mvanbeusekom mvanbeusekom left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM

@stefanschaller
Copy link

@cyanglaz @LHLL @stuartmorgan Do you guys have in mind when this PR got merged and a new version is published?

I need this fix ASAP and if this needs some more time, I need to add the source branch directly into my pubspec.yaml to fix this issue

@stuartmorgan-g stuartmorgan-g added the waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. label Jul 8, 2021
@stuartmorgan-g
Copy link
Contributor

It should land shortly.

@nino-finch
Copy link

Thanks so much for fixing this! Just to quickly check, how can I know if the changes has landed?

fluttergithubbot pushed a commit to flutter/flutter that referenced this pull request Jul 8, 2021
@inshaf
Copy link

inshaf commented Jul 9, 2021

I'm using "in_app_purchases" package and having the same issue. But seems the solution would be use the "in_app_purchases_ios". Do I have to use both packages? Why can't we have the fix on "in_app_purchase" package it self ?

@mvanbeusekom mvanbeusekom deleted the issue/85943 branch July 9, 2021 13:19
@mvanbeusekom
Copy link
Contributor

Hi @inshaf,

No it is not necessary to depend on both packages. The "in_app_purchase" package depends on the "in_app_purchase_ios" package using the Caret syntax (like so: in_app_purchase_ios: ^0.1.1). Meaning it will pick the latest version in the range of 0.1.1 to 0.2.0 (excluding 0.2.0). So if you would run flutter pub upgrade it will automatically pull in the latest published version of the "in_app_purchase_ios" plugin (being version 0.1.2+2 containing the fix).

@mvanbeusekom
Copy link
Contributor

Thanks so much for fixing this! Just to quickly check, how can I know if the changes has landed?

Once merged plugins will be published automatically to pub.dev if the submit queue is green. This is done by the "release" workflow that can be monitored here.

@renefloor
Copy link
Contributor Author

Want to add to @mvanbeusekom that is indeed already published, as you can see on pub.dev: https://pub.dev/packages/in_app_purchase_ios/changelog#0122

amantoux pushed a commit to amantoux/plugins that referenced this pull request Jul 10, 2021
Ralph-Li added a commit to Insight-Timer/plugins that referenced this pull request Jul 15, 2021
* upstream_master: (40 commits)
  [image_picker] Image picker fix camera device (flutter#3898)
  [flutter_plugin_tools] Improve license-check output (flutter#4154)
  [webview_flutter] Fix broken keyboard issue link (flutter#3266)
  [flutter_plugin_tools] Support format on Windows (flutter#4150)
  [flutter_plugin_tools] Make unit tests pass on Windows (flutter#4149)
  [image_picker_for_web] Migrate image_picker to package:cross_file (flutter#4083)
  [various] Prepare plugin repo for binding API improvements (flutter#4148)
  [quick_actions] Add const constructor (flutter#4131)
  [in_app_purchase] Add iOS currency symbol to ProductDetails (flutter#4144)
  [in_app_purchase] Added priceCurrencySymbol to SkuDetailsWrapper (flutter#4114)
  [image_picker_platform_interface] Add methods that return package:cross_file (flutter#4072)
  [flutter_plugin_tools] Improve and test 'format' (flutter#4145)
  [flutter_plugin_tools] Only check target packages in analyze (flutter#4146)
  [in_app_purchase] Fix crash when retrieveReceiptWithError gives an error. (flutter#4138)
  [video_player] Pause video when it completes (flutter#3727)
  [in_app_purchase] Add currencySymbol to ProductDetails (flutter#4115)
  [in_app_purchase] Add documentation for price change confirmations (flutter#4092)
  [camera] android-rework part 8: Supporting modules for final implementation (flutter#4054)
  [plugin_platform_interface] Fix README broken link (flutter#4143)
  [various] Prepare plugin repo for binding API improvements (flutter#4137)
  ...
@AlexanderThiele
Copy link

Many thanks @renefloor this really solved my issue!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes p: in_app_purchase platform-ios waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[in app purchase] App Crashes when buying Consumable [in_app_purchase] App crashes on buyNonConsumable
9 participants