feat: add alot

This commit is contained in:
2026-10-08 04:12:36 +02:00
parent ccf5165417
commit fc607cb7bd
99 changed files with 4981 additions and 3655 deletions
+11 -11
View File
@@ -24,12 +24,12 @@ class UpdateInfo {
factory UpdateInfo.fromJson(Map<String, dynamic> json) {
return UpdateInfo(
update: json["update"] ?? false,
version: json["version"] ?? "",
notes: json["notes"] ?? "",
mandatory: json["mandatory"] ?? false,
sha256: json["sha256"] ?? "",
download: json["download"] ?? "",
update: json['update'] ?? false,
version: json['version'] ?? '',
notes: json['notes'] ?? '',
mandatory: json['mandatory'] ?? false,
sha256: json['sha256'] ?? '',
download: json['download'] ?? '',
);
}
@@ -56,26 +56,26 @@ class AppUpdateUtil {
Future<String> currentVersion() async {
final info = await PackageInfo.fromPlatform();
debugPrint("Current app version: ${info.version}");
debugPrint('Current app version: ${info.version}');
return info.version;
}
Future<UpdateInfo?> checkForUpdate() async {
final version = await currentVersion();
final url = Uri.parse("$serverUrl/api/update?version=$version");
final url = Uri.parse('$serverUrl/api/update?version=$version');
final response = await http.get(url);
debugPrint("Response from update server: ${response.body}");
debugPrint('Response from update server: ${response.body}');
if (response.statusCode != 200) {
throw Exception("Update server unavailable");
throw Exception('Update server unavailable');
}
final data = jsonDecode(response.body);
if (data["update"] != true) {
if (data['update'] != true) {
return null;
}