mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 20:57:36 +02:00
fix: improve installed apps check
This commit is contained in:
@ -19,7 +19,7 @@ import 'package:stacked/stacked.dart';
|
||||
|
||||
@lazySingleton
|
||||
class HomeViewModel extends BaseViewModel {
|
||||
final ManagerAPI _managerAPI = ManagerAPI();
|
||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
|
||||
FlutterLocalNotificationsPlugin();
|
||||
@ -49,11 +49,10 @@ class HomeViewModel extends BaseViewModel {
|
||||
}
|
||||
|
||||
Future<List<PatchedApplication>> getPatchedApps(bool isUpdatable) async {
|
||||
await _managerAPI.reAssessSavedApps();
|
||||
List<PatchedApplication> list = [];
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
List<String> patchedApps = prefs.getStringList('patchedApps') ?? [];
|
||||
for (String str in patchedApps) {
|
||||
PatchedApplication app = PatchedApplication.fromJson(json.decode(str));
|
||||
List<PatchedApplication> patchedApps = _managerAPI.getPatchedApps();
|
||||
for (PatchedApplication app in patchedApps) {
|
||||
bool hasUpdates = await _managerAPI.hasAppUpdates(app.packageName);
|
||||
if (hasUpdates == isUpdatable) {
|
||||
list.add(app);
|
||||
|
Reference in New Issue
Block a user