diff --git a/lib/services/patcher_api.dart b/lib/services/patcher_api.dart index cf6e6b975d..bd7597a69f 100644 --- a/lib/services/patcher_api.dart +++ b/lib/services/patcher_api.dart @@ -1,12 +1,12 @@ import 'dart:io'; -import 'package:app_installer/app_installer.dart'; import 'package:collection/collection.dart'; import 'package:cr_file_saver/file_saver.dart'; import 'package:device_apps/device_apps.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import 'package:injectable/injectable.dart'; +import 'package:install_plugin/install_plugin.dart'; import 'package:path_provider/path_provider.dart'; import 'package:revanced_manager/app/app.locator.dart'; import 'package:revanced_manager/models/patch.dart'; @@ -232,10 +232,8 @@ class PatcherAPI { ); } } else { - await AppInstaller.installApk(_outFile!.path); - return await DeviceApps.isAppInstalled( - patchedApp.packageName, - ); + final install = await InstallPlugin.installApk(_outFile!.path); + return install['isSuccess']; } } on Exception catch (e) { if (kDebugMode) { diff --git a/lib/ui/views/home/home_viewmodel.dart b/lib/ui/views/home/home_viewmodel.dart index 4ffdd86bc4..f67125abdb 100644 --- a/lib/ui/views/home/home_viewmodel.dart +++ b/lib/ui/views/home/home_viewmodel.dart @@ -1,13 +1,13 @@ // ignore_for_file: use_build_context_synchronously import 'dart:async'; import 'dart:io'; -import 'package:app_installer/app_installer.dart'; import 'package:cross_connectivity/cross_connectivity.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_i18n/flutter_i18n.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:injectable/injectable.dart'; +import 'package:install_plugin/install_plugin.dart'; import 'package:path_provider/path_provider.dart'; import 'package:revanced_manager/app/app.locator.dart'; import 'package:revanced_manager/app/app.router.dart'; @@ -51,7 +51,7 @@ class HomeViewModel extends BaseViewModel { _toast.showBottom('homeView.installingMessage'); final File? managerApk = await _managerAPI.downloadManager(); if (managerApk != null) { - await AppInstaller.installApk(managerApk.path); + await InstallPlugin.installApk(managerApk.path); } else { _toast.showBottom('homeView.errorDownloadMessage'); } @@ -72,7 +72,7 @@ class HomeViewModel extends BaseViewModel { _toast.showBottom('homeView.installingMessage'); final File? managerApk = await _managerAPI.downloadManager(); if (managerApk != null) { - await AppInstaller.installApk(managerApk.path); + await InstallPlugin.installApk(managerApk.path); } else { _toast.showBottom('homeView.errorDownloadMessage'); } @@ -272,7 +272,7 @@ class HomeViewModel extends BaseViewModel { child: CustomMaterialButton( label: I18nText('updateButton'), onPressed: () async { - await AppInstaller.installApk( + await InstallPlugin.installApk( downloadedApk!.path, ); }, @@ -318,7 +318,7 @@ class HomeViewModel extends BaseViewModel { // UILocalNotificationDateInterpretation.absoluteTime, // ); _toast.showBottom('homeView.installingMessage'); - await AppInstaller.installApk(managerApk.path); + await InstallPlugin.installApk(managerApk.path); } else { _toast.showBottom('homeView.errorDownloadMessage'); } diff --git a/pubspec.yaml b/pubspec.yaml index 4b52fd1237..196aff34da 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,6 @@ environment: dependencies: animations: ^2.0.7 - app_installer: ^1.1.0 collection: ^1.17.0 cross_connectivity: ^3.0.5 cr_file_saver: @@ -75,6 +74,7 @@ dependencies: flutter_dotenv: ^5.0.2 flutter_markdown: ^0.6.14 dio_cache_interceptor: ^3.4.0 + install_plugin: ^2.1.0 dev_dependencies: json_serializable: ^6.6.1