Skip to content

Commit

Permalink
changed in app update logic, and updated version number to new format
Browse files Browse the repository at this point in the history
  • Loading branch information
hjiangsu committed Jun 22, 2023
1 parent 781045c commit 92a8f10
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/core/update/check_github_update.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import 'package:thunder/core/models/version.dart';
Future<String?> getCurrentVersion() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
String version = packageInfo.version;
String build = packageInfo.buildNumber;

return 'v$version';
return 'v$version+$build';
}

Future<Version> fetchVersion() async {
Expand All @@ -24,10 +25,9 @@ Future<Version> fetchVersion() async {
final release = json.decode(response.body);
String latestVersion = release['tag_name'];

// Ignore the alpha version since ios only allows numeric values
String latestVersionBuild = latestVersion.replaceAll('-alpha', '');
print('$currentVersion, $latestVersion');

if (currentVersion != null && currentVersion.compareTo(latestVersionBuild) < 0) {
if (currentVersion != null && currentVersion.compareTo(latestVersion) < 0) {
return Version(version: currentVersion, latestVersion: latestVersion, hasUpdate: true);
} else {
return Version(version: 'N/A', latestVersion: latestVersion, hasUpdate: false);
Expand Down
2 changes: 1 addition & 1 deletion lib/thunder/pages/thunder_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class _ThunderState extends State<Thunder> {
Card(
child: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
padding: const EdgeInsets.only(left: 16.0, right: 16.0, top: 0, bottom: 8.0),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: thunder
description: An open-source cross-platform Lemmy client for iOS and Android built with Flutter
publish_to: "none"
version: 0.2.1-alpha+4
version: 0.2.1+5

environment:
sdk: ">=3.1.0-116.0.dev <4.0.0"
Expand Down

0 comments on commit 92a8f10

Please sign in to comment.