Skip to content

Commit

Permalink
fix: fixed update popups on alpha and beta
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanYuuki committed Dec 6, 2024
1 parent 4f2ce24 commit fd6d03f
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions lib/utils/update_notifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,22 @@ Future<void> checkForUpdate(context) async {
}

bool _isNewerVersion(String currentVersion, String latestVersion) {
currentVersion = currentVersion.replaceFirst('v', '');
latestVersion = latestVersion.replaceFirst('v', '');
if (latestVersion.split('-').last == "alpha" ||
latestVersion.split('-').last == "beta") {
return false;
} else {
currentVersion = currentVersion.replaceFirst('v', '');
latestVersion = latestVersion.replaceFirst('v', '');

currentVersion = currentVersion.replaceAll(RegExp(r'-.*'), '');
latestVersion = latestVersion.replaceAll(RegExp(r'-.*'), '');
currentVersion = currentVersion.replaceAll(RegExp(r'-.*'), '');
latestVersion = latestVersion.replaceAll(RegExp(r'-.*'), '');

List<int> current = currentVersion.split('.').map(int.parse).toList();
List<int> latest = latestVersion.split('.').map(int.parse).toList();
List<int> current = currentVersion.split('.').map(int.parse).toList();
List<int> latest = latestVersion.split('.').map(int.parse).toList();

for (int i = 0; i < current.length; i++) {
if (latest[i] > current[i]) return true;
for (int i = 0; i < current.length; i++) {
if (latest[i] > current[i]) return true;
}
}

return false;
Expand Down

0 comments on commit fd6d03f

Please sign in to comment.