mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
perf: Load patched apps as soon as possible
This commit is contained in:
parent
85c8006977
commit
c94eb7a48e
@ -632,7 +632,7 @@ class ManagerAPI {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> reAssessSavedApps() async {
|
Future<void> rePatchedSavedApps() async {
|
||||||
final List<PatchedApplication> patchedApps = getPatchedApps();
|
final List<PatchedApplication> patchedApps = getPatchedApps();
|
||||||
|
|
||||||
// Remove apps that are not installed anymore.
|
// Remove apps that are not installed anymore.
|
||||||
|
@ -38,11 +38,16 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
File? downloadedApk;
|
File? downloadedApk;
|
||||||
|
|
||||||
Future<void> initialize(BuildContext context) async {
|
Future<void> initialize(BuildContext context) async {
|
||||||
_latestManagerVersion = await _managerAPI.getLatestManagerVersion();
|
_managerAPI.rePatchedSavedApps().then((_) => _getPatchedApps());
|
||||||
|
|
||||||
if (!_managerAPI.getPatchesConsent()) {
|
if (!_managerAPI.getPatchesConsent()) {
|
||||||
await showPatchesConsent(context);
|
await showPatchesConsent(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_latestManagerVersion = await _managerAPI.getLatestManagerVersion();
|
||||||
|
|
||||||
await _patcherAPI.initialize();
|
await _patcherAPI.initialize();
|
||||||
|
|
||||||
await flutterLocalNotificationsPlugin.initialize(
|
await flutterLocalNotificationsPlugin.initialize(
|
||||||
const InitializationSettings(
|
const InitializationSettings(
|
||||||
android: AndroidInitializationSettings('ic_notification'),
|
android: AndroidInitializationSettings('ic_notification'),
|
||||||
@ -63,11 +68,13 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
.resolvePlatformSpecificImplementation<
|
.resolvePlatformSpecificImplementation<
|
||||||
AndroidFlutterLocalNotificationsPlugin>()
|
AndroidFlutterLocalNotificationsPlugin>()
|
||||||
?.requestNotificationsPermission();
|
?.requestNotificationsPermission();
|
||||||
|
|
||||||
final bool isConnected =
|
final bool isConnected =
|
||||||
await Connectivity().checkConnectivity() != ConnectivityResult.none;
|
await Connectivity().checkConnectivity() != ConnectivityResult.none;
|
||||||
if (!isConnected) {
|
if (!isConnected) {
|
||||||
_toast.showBottom('homeView.noConnection');
|
_toast.showBottom('homeView.noConnection');
|
||||||
}
|
}
|
||||||
|
|
||||||
final NotificationAppLaunchDetails? notificationAppLaunchDetails =
|
final NotificationAppLaunchDetails? notificationAppLaunchDetails =
|
||||||
await flutterLocalNotificationsPlugin.getNotificationAppLaunchDetails();
|
await flutterLocalNotificationsPlugin.getNotificationAppLaunchDetails();
|
||||||
if (notificationAppLaunchDetails?.didNotificationLaunchApp ?? false) {
|
if (notificationAppLaunchDetails?.didNotificationLaunchApp ?? false) {
|
||||||
@ -79,8 +86,6 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
_toast.showBottom('homeView.errorDownloadMessage');
|
_toast.showBottom('homeView.errorDownloadMessage');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_managerAPI.reAssessSavedApps().then((_) => _getPatchedApps());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void navigateToAppInfo(PatchedApplication app) {
|
void navigateToAppInfo(PatchedApplication app) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user