revanced-manager/lib/ui/views/contributors/contributors_viewmodel.dart
aAbed f89c742c90
feat: Add a toggle for alternative sources (#1686)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2024-02-19 20:26:42 +05:45

25 lines
1.0 KiB
Dart

import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:stacked/stacked.dart';
class ContributorsViewModel extends BaseViewModel {
final ManagerAPI _managerAPI = locator<ManagerAPI>();
List<dynamic> patcherContributors = [];
List<dynamic> patchesContributors = [];
List<dynamic> integrationsContributors = [];
List<dynamic> cliContributors = [];
List<dynamic> managerContributors = [];
Future<void> getContributors() async {
final Map<String, List<dynamic>> contributors =
await _managerAPI.getContributors();
patcherContributors = contributors[_managerAPI.defaultPatcherRepo] ?? [];
patchesContributors = contributors[_managerAPI.defaultPatchesRepo] ?? [];
integrationsContributors =
contributors[_managerAPI.defaultIntegrationsRepo] ?? [];
cliContributors = contributors[_managerAPI.defaultCliRepo] ?? [];
managerContributors = contributors[_managerAPI.defaultManagerRepo] ?? [];
notifyListeners();
}
}