Skip to content

Commit e2b5547

Browse files
committed
fix(in-app-updates): Fixed updates not working.
1 parent 6311bf4 commit e2b5547

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

lib/blocs/update/app_version.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class AppVersion extends Comparable<AppVersion> with Compared<AppVersion> {
99

1010
/// Parse [v] to a [Version], supports [OldVersion]...
1111
static Version parseWithOld(String v) {
12+
if (v.startsWith('v')) v = v.substring(1);
1213
try {
1314
return Version.parse(v);
1415
} catch (e) {
@@ -30,7 +31,9 @@ class AppVersion extends Comparable<AppVersion> with Compared<AppVersion> {
3031
}
3132

3233
AppVersion.fromJson(Map<String, dynamic> json) {
34+
print(json["tag_name"]);
3335
version = parseWithOld(json["tag_name"]);
36+
print(version);
3437
releaseNotes = json["body"];
3538
downloadUrl = json["assets"][0]["browser_download_url"];
3639
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1515
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
1616
# Read more about iOS versioning at
1717
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18-
version: 0.8.0-b+12
18+
version: 0.8.0-b+13
1919

2020
environment:
2121
sdk: ">=2.15.0 <3.0.0"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import 'package:flutter_test/flutter_test.dart';
2+
import 'package:pub_semver/pub_semver.dart';
3+
import 'package:weizmann_theory_app_test/blocs/update/app_version.dart';
4+
5+
main() {
6+
test('parseWithOld()', () {
7+
expect(_parse('v0.8.0-b+12'), Version(0, 8, 0, pre: 'b', build: '12'));
8+
});
9+
}
10+
11+
_parse(String v) => AppVersion.parseWithOld(v);

0 commit comments

Comments
 (0)