mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
106d77ea0c
* feat: "New dashboard UI". * fix: some improvenents * fix: fix inconsistencies and light theme. * fix: save patched and installed apps on prefs, improve installer log, improve dashboard with real data (wip) Co-authored-by: Aunali321 <aunvakil.aa@gmail.com> * feat: move chips to a separate widget. Co-authored-by: Alberto Ponces <ponces26@gmail.com>
29 lines
1.0 KiB
Dart
29 lines
1.0 KiB
Dart
import 'dart:convert';
|
|
import 'package:injectable/injectable.dart';
|
|
import 'package:revanced_manager/app/app.locator.dart';
|
|
import 'package:revanced_manager/models/patched_application.dart';
|
|
import 'package:revanced_manager/services/manager_api.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import 'package:stacked/stacked.dart';
|
|
|
|
@lazySingleton
|
|
class HomeViewModel extends BaseViewModel {
|
|
bool showUpdatableApps = true;
|
|
|
|
void toggleUpdatableApps(bool value) {
|
|
showUpdatableApps = value;
|
|
notifyListeners();
|
|
}
|
|
|
|
Future downloadPatches() => locator<ManagerAPI>().downloadPatches();
|
|
Future downloadIntegrations() => locator<ManagerAPI>().downloadIntegrations();
|
|
|
|
Future<List<PatchedApplication>> getPatchedApps(bool isUpdatable) async {
|
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
List<String> patchedApps = prefs.getStringList('patchedApps') ?? [];
|
|
return patchedApps
|
|
.map((app) => PatchedApplication.fromJson(json.decode(app)))
|
|
.toList();
|
|
}
|
|
}
|