mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
fix version check
This commit is contained in:
@@ -85,8 +85,8 @@ class _AboutSettingsState extends State<AboutSettings> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> checkUpdate() async {
|
Future<bool> checkUpdate() async {
|
||||||
var res = await AppDio().get(
|
var res = await AppDio()
|
||||||
"https://cdn.jsdelivr.net/gh/venera-app/venera@latest/pubspec.yaml");
|
.get("https://cdn.jsdelivr.net/gh/venera-app/venera@master/pubspec.yaml");
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
var data = loadYaml(res.data);
|
var data = loadYaml(res.data);
|
||||||
if (data["version"] != null) {
|
if (data["version"] != null) {
|
||||||
@@ -108,7 +108,7 @@ Future<void> checkUpdateUi([bool showMessageIfNoUpdate = true]) async {
|
|||||||
content: Text(
|
content: Text(
|
||||||
"A new version is available. Do you want to update now?"
|
"A new version is available. Do you want to update now?"
|
||||||
.tl)
|
.tl)
|
||||||
.paddingHorizontal(8),
|
.paddingHorizontal(16),
|
||||||
actions: [
|
actions: [
|
||||||
Button.text(
|
Button.text(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@@ -137,6 +137,9 @@ bool _compareVersion(String version1, String version2) {
|
|||||||
if (int.parse(v1[i]) > int.parse(v2[i])) {
|
if (int.parse(v1[i]) > int.parse(v2[i])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (int.parse(v1[i]) < int.parse(v2[i])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user