-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
Fix for 316 #360
Conversation
…t any results in the response.
lib/src/upgrader.dart
Outdated
@@ -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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
…now about the internals of response.
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
@mulvad Thanks for this PR and the simple fix with the unit test update. I will merge this. |
In cases where the app isn't listed on the App Store yet, there aren't any results in the response.