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 for 316 #360

Merged
merged 4 commits into from
Apr 1, 2024
Merged

Fix for 316 #360

merged 4 commits into from
Apr 1, 2024

Conversation

mulvad
Copy link
Contributor

@mulvad mulvad commented Nov 29, 2023

In cases where the app isn't listed on the App Store yet, there aren't any results in the response.

@@ -365,7 +365,7 @@ class Upgrader with WidgetsBindingObserver {
final response = await (iTunes
.lookupByBundleId(_packageInfo!.packageName, country: country));

if (response != null) {
if (response != null && response['resultCount'] > 0) {
Copy link
Owner

@larryaasen larryaasen Dec 1, 2023

Choose a reason for hiding this comment

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

I like this fix, thanks. However, there is more to this change than this. First, each place in the code where response is used is wrapped with try/catch, and in this case it was not. Secondly, the unit test mock response does not have resultCount so it would fail and should be updated.

Copy link
Owner

Choose a reason for hiding this comment

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

Another small note. The upgrader class does not know the internal details of the response. It just passes that to the ITunesSearchAPI class, so it would not be a good idea to access the internals of response inside _updateVersionInfo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for the long turn-around time. I took another look and have submitted a different way of solving the issue. In _decodeResults in ITunesSearchAPI the response may not contain any results. So instead of having other classes know about the internal, it seems like this is equivalent to returning null. This also works well since there are checks for whether the response is null or not.

@larryaasen larryaasen added enhancement New feature or request iOS labels Dec 1, 2023
@larryaasen larryaasen added the need more information Further information is requested label Dec 29, 2023
@mulvad mulvad requested a review from larryaasen March 26, 2024 16:19
Copy link

codecov bot commented Mar 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.38%. Comparing base (8e830d2) to head (370cbd8).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #360   +/-   ##
=======================================
  Coverage   90.38%   90.38%           
=======================================
  Files          13       13           
  Lines        1207     1207           
=======================================
  Hits         1091     1091           
  Misses        116      116           

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

@larryaasen
Copy link
Owner

@mulvad Thanks for this PR and the simple fix with the unit test update. I will merge this.

@larryaasen larryaasen merged commit b7a0db5 into larryaasen:master Apr 1, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request iOS need more information Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants