2022-08-02 00:35:11 +05:30
|
|
|
import 'dart:io';
|
2022-08-18 17:32:58 +01:00
|
|
|
import 'package:package_info_plus/package_info_plus.dart';
|
2022-08-06 22:35:35 +01:00
|
|
|
import 'package:revanced_manager/constants.dart';
|
2022-08-09 00:01:06 +01:00
|
|
|
import 'package:revanced_manager/services/github_api.dart';
|
2022-08-01 01:16:27 +05:30
|
|
|
|
2022-08-02 13:36:35 +05:30
|
|
|
class ManagerAPI {
|
2022-08-18 15:33:33 +01:00
|
|
|
final GithubAPI _githubAPI = GithubAPI();
|
2022-08-02 13:36:35 +05:30
|
|
|
|
2022-08-19 19:13:43 +01:00
|
|
|
Future<File?> downloadPatches(String extension) async {
|
|
|
|
return await _githubAPI.latestReleaseFile(extension, ghOrg, patchesRepo);
|
2022-08-02 13:36:35 +05:30
|
|
|
}
|
|
|
|
|
2022-08-19 19:13:43 +01:00
|
|
|
Future<File?> downloadIntegrations(String extension) async {
|
2022-08-18 17:32:58 +01:00
|
|
|
return await _githubAPI.latestReleaseFile(
|
2022-08-19 19:13:43 +01:00
|
|
|
extension,
|
|
|
|
ghOrg,
|
|
|
|
integrationsRepo,
|
2022-08-18 17:32:58 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-08-19 19:13:43 +01:00
|
|
|
Future<File?> downloadManager(String extension) async {
|
|
|
|
return await _githubAPI.latestReleaseFile(extension, ghOrg, managerRepo);
|
|
|
|
}
|
|
|
|
|
2022-08-18 17:32:58 +01:00
|
|
|
Future<String?> getLatestPatchesVersion() async {
|
|
|
|
return await _githubAPI.latestReleaseVersion(ghOrg, patchesRepo);
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<String?> getLatestManagerVersion() async {
|
2022-08-19 19:13:43 +01:00
|
|
|
return await _githubAPI.latestReleaseVersion(ghOrg, managerRepo);
|
2022-08-18 17:32:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Future<String> getCurrentManagerVersion() async {
|
|
|
|
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
|
|
|
return packageInfo.version;
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<bool> hasAppUpdates(String packageName) async {
|
|
|
|
// TODO: get status based on last update time on the folder of this app?
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<String> getAppChangelog(String packageName) async {
|
|
|
|
// TODO: get changelog based on last commits on the folder of this app?
|
|
|
|
return 'to be implemented';
|
2022-08-02 13:25:01 +05:30
|
|
|
}
|
2022-08-02 00:35:11 +05:30
|
|
|
}
|