2022-08-12 20:07:16 +02:00
|
|
|
import 'package:github/github.dart';
|
2022-09-07 03:37:25 +02:00
|
|
|
import 'package:revanced_manager/app/app.locator.dart';
|
2022-08-12 20:07:16 +02:00
|
|
|
import 'package:revanced_manager/services/github_api.dart';
|
2022-09-07 03:37:25 +02:00
|
|
|
import 'package:revanced_manager/services/manager_api.dart';
|
2022-08-12 20:07:16 +02:00
|
|
|
import 'package:stacked/stacked.dart';
|
|
|
|
|
|
|
|
class ContributorsViewModel extends BaseViewModel {
|
2022-09-07 03:37:25 +02:00
|
|
|
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
2022-08-18 16:33:33 +02:00
|
|
|
final GithubAPI _githubAPI = GithubAPI();
|
2022-09-07 03:37:25 +02:00
|
|
|
List<Contributor> patcherContributors = [];
|
2022-08-12 20:07:16 +02:00
|
|
|
List<Contributor> patchesContributors = [];
|
|
|
|
List<Contributor> integrationsContributors = [];
|
|
|
|
List<Contributor> cliContributors = [];
|
|
|
|
List<Contributor> managerContributors = [];
|
|
|
|
|
2022-08-18 16:33:33 +02:00
|
|
|
Future<void> getContributors() async {
|
2022-09-07 03:37:25 +02:00
|
|
|
patcherContributors = await _githubAPI.getContributors(
|
|
|
|
_managerAPI.getPatcherRepo(),
|
|
|
|
);
|
2022-08-18 16:33:33 +02:00
|
|
|
patchesContributors = await _githubAPI.getContributors(
|
2022-09-07 03:37:25 +02:00
|
|
|
_managerAPI.getPatchesRepo(),
|
2022-08-18 16:33:33 +02:00
|
|
|
);
|
|
|
|
integrationsContributors = await _githubAPI.getContributors(
|
2022-09-07 03:37:25 +02:00
|
|
|
_managerAPI.getIntegrationsRepo(),
|
2022-08-18 16:33:33 +02:00
|
|
|
);
|
|
|
|
cliContributors = await _githubAPI.getContributors(
|
2022-09-07 03:37:25 +02:00
|
|
|
_managerAPI.getCliRepo(),
|
2022-08-18 16:33:33 +02:00
|
|
|
);
|
|
|
|
managerContributors = await _githubAPI.getContributors(
|
2022-09-07 03:37:25 +02:00
|
|
|
_managerAPI.getManagerRepo(),
|
2022-08-18 16:33:33 +02:00
|
|
|
);
|
2022-08-26 03:01:53 +02:00
|
|
|
notifyListeners();
|
2022-08-12 20:07:16 +02:00
|
|
|
}
|
|
|
|
}
|