Skip to content

Commit

Permalink
bloomee updated fix [win support]
Browse files Browse the repository at this point in the history
  • Loading branch information
HemantKArya committed Jul 7, 2024
1 parent 7a724b2 commit d6cb840
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/services/bloomeeUpdaterTools.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:convert';
import 'dart:developer';
import 'dart:io';
import 'package:http/http.dart' as http;
import 'package:package_info_plus/package_info_plus.dart';

Expand All @@ -19,7 +20,7 @@ Future<Map<String, dynamic>> getLatestVersion() async {
"currBuild": packageInfo.buildNumber,
"currVer": packageInfo.version,
"newVer": data["tag_name"].toString().split("+")[0].replaceFirst("v", ''),
"download_url": data["assets"][0]["browser_download_url"],
"download_url": extractUpUrl(data),
};
} else {
log('Failed to load latest version!', name: 'UpdaterTools');
Expand All @@ -28,3 +29,23 @@ Future<Map<String, dynamic>> getLatestVersion() async {
};
}
}

String? extractUpUrl(Map<String, dynamic> data) {
// List<String> urls = [];

for (var element in (data["assets"] as List)) {
// urls.add(element["browser_download_url"]);
if (element["browser_download_url"].toString().contains("windows")) {
if (Platform.isWindows) {
return element["browser_download_url"].toString();
}
} else if (element["browser_download_url"].toString().contains("android")) {
if (Platform.isAndroid) {
return element["browser_download_url"].toString();
}
} else {
continue;
}
}
return null;
}

0 comments on commit d6cb840

Please sign in to comment.