Skip to content

Commit

Permalink
Fixed parsing of localVersion from packageInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Maurizio Pinotti committed Jan 24, 2022
1 parent a1289d6 commit dedea9d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/new_version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ class NewVersion {
}
}

String _getLocalVersion(packageInfo) =>
RegExp(r'\d+\.\d+\.\d+').stringMatch(packageInfo.version) ?? '0.0.0';

/// iOS info is fetched by using the iTunes lookup API, which returns a
/// JSON document.
Future<VersionStatus?> _getiOSStoreVersion(PackageInfo packageInfo) async {
Expand All @@ -133,7 +136,7 @@ class NewVersion {
return null;
}
return VersionStatus._(
localVersion: packageInfo.version,
localVersion: _getLocalVersion(packageInfo),
storeVersion: forceAppVersion ?? jsonObj['results'][0]['version'],
appStoreLink: jsonObj['results'][0]['trackViewUrl'],
releaseNotes: jsonObj['results'][0]['releaseNotes'],
Expand Down Expand Up @@ -169,7 +172,7 @@ class NewVersion {
?.text;

return VersionStatus._(
localVersion: packageInfo.version,
localVersion: _getLocalVersion(packageInfo),
storeVersion: forceAppVersion ?? storeVersion,
appStoreLink: uri.toString(),
releaseNotes: releaseNotes,
Expand Down

0 comments on commit dedea9d

Please sign in to comment.