mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-05-05 08:14:25 +02:00
feat: fully complete manager api.
This commit is contained in:
parent
729ad82f77
commit
5542e9b943
@ -5,6 +5,8 @@ import 'package:revanced_manager_flutter/constants.dart';
|
|||||||
import 'github_api.dart';
|
import 'github_api.dart';
|
||||||
|
|
||||||
// use path_provider to get the path of the storage directory
|
// use path_provider to get the path of the storage directory
|
||||||
|
|
||||||
|
class ManagerAPI {
|
||||||
Dio dio = Dio();
|
Dio dio = Dio();
|
||||||
GithubAPI githubAPI = GithubAPI();
|
GithubAPI githubAPI = GithubAPI();
|
||||||
|
|
||||||
@ -19,8 +21,9 @@ Future<File?> downloadAssets(String repo) async {
|
|||||||
try {
|
try {
|
||||||
final workDir = await getPath();
|
final workDir = await getPath();
|
||||||
final dlUrl = await githubAPI.latestRelease(ghOrg, repo);
|
final dlUrl = await githubAPI.latestRelease(ghOrg, repo);
|
||||||
final name =
|
final name = dlUrl
|
||||||
dlUrl?.split('/').lastWhere((element) => element.contains('revanced'));
|
?.split('/')
|
||||||
|
.lastWhere((element) => element.contains('revanced'));
|
||||||
print(name);
|
print(name);
|
||||||
final assetFile = File('$workDir/$name');
|
final assetFile = File('$workDir/$name');
|
||||||
final response = await dio.get(
|
final response = await dio.get(
|
||||||
@ -43,3 +46,12 @@ Future<File?> downloadAssets(String repo) async {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> downloadPatches() async {
|
||||||
|
await downloadAssets(patchesRepo);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> downloadIntegrations() async {
|
||||||
|
await downloadAssets(integrationsRepo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user