mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 20:57:36 +02:00
feat: Add ReVanced API and implement cache on it and on Github API
This commit is contained in:
@ -1,34 +1,24 @@
|
||||
import 'package:github/github.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/services/github_api.dart';
|
||||
import 'package:revanced_manager/services/manager_api.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class ContributorsViewModel extends BaseViewModel {
|
||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||
final GithubAPI _githubAPI = GithubAPI();
|
||||
List<Contributor> patcherContributors = [];
|
||||
List<Contributor> patchesContributors = [];
|
||||
List<Contributor> integrationsContributors = [];
|
||||
List<Contributor> cliContributors = [];
|
||||
List<Contributor> managerContributors = [];
|
||||
List<dynamic> patcherContributors = [];
|
||||
List<dynamic> patchesContributors = [];
|
||||
List<dynamic> integrationsContributors = [];
|
||||
List<dynamic> cliContributors = [];
|
||||
List<dynamic> managerContributors = [];
|
||||
|
||||
Future<void> getContributors() async {
|
||||
patcherContributors = await _githubAPI.getContributors(
|
||||
_managerAPI.getPatcherRepo(),
|
||||
);
|
||||
patchesContributors = await _githubAPI.getContributors(
|
||||
_managerAPI.getPatchesRepo(),
|
||||
);
|
||||
integrationsContributors = await _githubAPI.getContributors(
|
||||
_managerAPI.getIntegrationsRepo(),
|
||||
);
|
||||
cliContributors = await _githubAPI.getContributors(
|
||||
_managerAPI.getCliRepo(),
|
||||
);
|
||||
managerContributors = await _githubAPI.getContributors(
|
||||
_managerAPI.getManagerRepo(),
|
||||
);
|
||||
Map<String, List<dynamic>> contributors =
|
||||
await _managerAPI.getContributors();
|
||||
patcherContributors = contributors[_managerAPI.defaultPatcherRepo] ?? [];
|
||||
patchesContributors = contributors[_managerAPI.getPatchesRepo()] ?? [];
|
||||
integrationsContributors =
|
||||
contributors[_managerAPI.getIntegrationsRepo()] ?? [];
|
||||
cliContributors = contributors[_managerAPI.defaultCliRepo] ?? [];
|
||||
managerContributors = contributors[_managerAPI.defaultManagerRepo] ?? [];
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user