revanced-manager/lib/ui/views/contributors/contributors_viewmodel.dart

25 lines
1.0 KiB
Dart
Raw Normal View History

2022-09-07 03:37:25 +02:00
import 'package:revanced_manager/app/app.locator.dart';
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>();
List<dynamic> patcherContributors = [];
List<dynamic> patchesContributors = [];
List<dynamic> integrationsContributors = [];
List<dynamic> cliContributors = [];
List<dynamic> managerContributors = [];
2022-08-12 20:07:16 +02:00
2022-08-18 16:33:33 +02:00
Future<void> getContributors() async {
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();
2022-08-12 20:07:16 +02:00
}
}