From 2834e8b3483273ebaf6efe7bb7b01bd890dc64d0 Mon Sep 17 00:00:00 2001 From: Aabed Khan <39409020+TheAabedKhan@users.noreply.github.com> Date: Tue, 11 Jul 2023 15:56:45 +0545 Subject: [PATCH 1/9] fix: patchable apps not showing if none of them is installed (#1009) --- lib/ui/views/app_selector/app_selector_view.dart | 2 +- lib/ui/views/app_selector/app_selector_viewmodel.dart | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/ui/views/app_selector/app_selector_view.dart b/lib/ui/views/app_selector/app_selector_view.dart index e3ab0c41..6368df61 100644 --- a/lib/ui/views/app_selector/app_selector_view.dart +++ b/lib/ui/views/app_selector/app_selector_view.dart @@ -88,7 +88,7 @@ class _AppSelectorViewState extends State { ), ), ) - : model.apps.isEmpty + : model.allApps.isEmpty ? const AppSkeletonLoader() : Padding( padding: const EdgeInsets.symmetric(horizontal: 12.0) diff --git a/lib/ui/views/app_selector/app_selector_viewmodel.dart b/lib/ui/views/app_selector/app_selector_viewmodel.dart index 9eacb93c..e0784abd 100644 --- a/lib/ui/views/app_selector/app_selector_viewmodel.dart +++ b/lib/ui/views/app_selector/app_selector_viewmodel.dart @@ -45,9 +45,7 @@ class AppSelectorViewModel extends BaseViewModel { .length .compareTo(_patcherAPI.getFilteredPatches(a.packageName).length), ); - noApps = apps.isEmpty; getAllApps(); - notifyListeners(); } @@ -57,7 +55,7 @@ class AppSelectorViewModel extends BaseViewModel { .toSet() .where((name) => !apps.any((app) => app.packageName == name)) .toList(); - + noApps = allApps.isEmpty; return allApps; } From b784482788fcf646e3cf523e0458973b31acfdb3 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Tue, 11 Jul 2023 19:28:59 +0700 Subject: [PATCH 2/9] chore: update libsu to 5.1.0 This should fixes some issues with root --- pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 3a99a5ba..4b52fd12 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -59,8 +59,8 @@ dependencies: pull_to_refresh: ^2.0.0 root: git: - url: https://github.com/gokul1630/root - ref: main + url: https://github.com/EvadeMaster/root + ref: 9bcf0dc06b8e2e3ccd5fbd16bc849938e817b36b share_extend: ^2.0.0 shared_preferences: ^2.1.0 skeletons: ^0.0.3 From e64318c94700fa7a156287f0b82c4f95112b5f74 Mon Sep 17 00:00:00 2001 From: Aabed Khan Date: Thu, 13 Jul 2023 00:14:47 +0545 Subject: [PATCH 3/9] fix(app-selector): fix text overflow on small screen --- .../appSelectorView/installed_app_item.dart | 16 ++++++++++------ .../appSelectorView/not_installed_app_item.dart | 16 ++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/lib/ui/widgets/appSelectorView/installed_app_item.dart b/lib/ui/widgets/appSelectorView/installed_app_item.dart index 70a49a1a..69b08371 100644 --- a/lib/ui/widgets/appSelectorView/installed_app_item.dart +++ b/lib/ui/widgets/appSelectorView/installed_app_item.dart @@ -84,12 +84,16 @@ class _InstalledAppItemState extends State { }, ), const SizedBox(width: 4), - Text( - widget.patchesCount == 1 - ? '• ${widget.patchesCount} patch' - : '• ${widget.patchesCount} patches', - style: TextStyle( - color: Theme.of(context).colorScheme.secondary, + Flexible( + child: Text( + widget.patchesCount == 1 + ? '• ${widget.patchesCount} patch' + : '• ${widget.patchesCount} patches', + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Theme.of(context).colorScheme.secondary, + ), ), ), ], diff --git a/lib/ui/widgets/appSelectorView/not_installed_app_item.dart b/lib/ui/widgets/appSelectorView/not_installed_app_item.dart index e932908b..ee40b8c1 100644 --- a/lib/ui/widgets/appSelectorView/not_installed_app_item.dart +++ b/lib/ui/widgets/appSelectorView/not_installed_app_item.dart @@ -78,12 +78,16 @@ class _NotInstalledAppItem extends State { }, ), const SizedBox(width: 4), - Text( - widget.patchesCount == 1 - ? '• ${widget.patchesCount} patch' - : '• ${widget.patchesCount} patches', - style: TextStyle( - color: Theme.of(context).colorScheme.secondary, + Flexible( + child: Text( + widget.patchesCount == 1 + ? '• ${widget.patchesCount} patch' + : '• ${widget.patchesCount} patches', + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Theme.of(context).colorScheme.secondary, + ), ), ), ], From c5b06213235db6b96ba980bcc8164503cf18dbd6 Mon Sep 17 00:00:00 2001 From: Aabed Khan <39409020+TheAabedKhan@users.noreply.github.com> Date: Thu, 13 Jul 2023 19:25:48 +0545 Subject: [PATCH 4/9] fix(navigation-view): back button closing the app from any page (#1019) --- lib/ui/views/navigation/navigation_view.dart | 108 ++++++++++--------- 1 file changed, 59 insertions(+), 49 deletions(-) diff --git a/lib/ui/views/navigation/navigation_view.dart b/lib/ui/views/navigation/navigation_view.dart index d8fdd5c6..be5250c5 100644 --- a/lib/ui/views/navigation/navigation_view.dart +++ b/lib/ui/views/navigation/navigation_view.dart @@ -13,58 +13,68 @@ class NavigationView extends StatelessWidget { return ViewModelBuilder.reactive( onViewModelReady: (model) => model.initialize(context), viewModelBuilder: () => locator(), - builder: (context, model, child) => Scaffold( - body: PageTransitionSwitcher( - duration: const Duration(milliseconds: 400), - transitionBuilder: ( - Widget child, - Animation animation, - Animation secondaryAnimation, - ) { - return FadeThroughTransition( - animation: animation, - secondaryAnimation: secondaryAnimation, - fillColor: Theme.of(context).colorScheme.surface, - child: child, - ); - }, - child: model.getViewForIndex(model.currentIndex), - ), - bottomNavigationBar: NavigationBar( - onDestinationSelected: model.setIndex, - selectedIndex: model.currentIndex, - destinations: [ - NavigationDestination( - icon: model.isIndexSelected(0) - ? const Icon(Icons.dashboard) - : const Icon(Icons.dashboard_outlined), - label: FlutterI18n.translate( - context, - 'navigationView.dashboardTab', + builder: (context, model, child) => WillPopScope( + onWillPop: ()async{ + if(model.currentIndex == 0){ + return true; + }else{ + model.setIndex(0); + return false; + } + }, + child: Scaffold( + body: PageTransitionSwitcher( + duration: const Duration(milliseconds: 400), + transitionBuilder: ( + Widget child, + Animation animation, + Animation secondaryAnimation, + ) { + return FadeThroughTransition( + animation: animation, + secondaryAnimation: secondaryAnimation, + fillColor: Theme.of(context).colorScheme.surface, + child: child, + ); + }, + child: model.getViewForIndex(model.currentIndex), + ), + bottomNavigationBar: NavigationBar( + onDestinationSelected: model.setIndex, + selectedIndex: model.currentIndex, + destinations: [ + NavigationDestination( + icon: model.isIndexSelected(0) + ? const Icon(Icons.dashboard) + : const Icon(Icons.dashboard_outlined), + label: FlutterI18n.translate( + context, + 'navigationView.dashboardTab', + ), + tooltip: '', ), - tooltip: '', - ), - NavigationDestination( - icon: model.isIndexSelected(1) - ? const Icon(Icons.build) - : const Icon(Icons.build_outlined), - label: FlutterI18n.translate( - context, - 'navigationView.patcherTab', + NavigationDestination( + icon: model.isIndexSelected(1) + ? const Icon(Icons.build) + : const Icon(Icons.build_outlined), + label: FlutterI18n.translate( + context, + 'navigationView.patcherTab', + ), + tooltip: '', ), - tooltip: '', - ), - NavigationDestination( - icon: model.isIndexSelected(2) - ? const Icon(Icons.settings) - : const Icon(Icons.settings_outlined), - label: FlutterI18n.translate( - context, - 'navigationView.settingsTab', + NavigationDestination( + icon: model.isIndexSelected(2) + ? const Icon(Icons.settings) + : const Icon(Icons.settings_outlined), + label: FlutterI18n.translate( + context, + 'navigationView.settingsTab', + ), + tooltip: '', ), - tooltip: '', - ), - ], + ], + ), ), ), ); From a879ac30fbf6f367d829b897dd3cd6ab27d68681 Mon Sep 17 00:00:00 2001 From: ponces Date: Fri, 14 Jul 2023 11:55:04 +0100 Subject: [PATCH 5/9] fix: prevent `unsupported operation` exception (#1018) --- lib/services/root_api.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/root_api.dart b/lib/services/root_api.dart index af1276c4..1a77c644 100644 --- a/lib/services/root_api.dart +++ b/lib/services/root_api.dart @@ -73,7 +73,7 @@ class RootAPI { } Future> getInstalledApps() async { - final List apps = List.empty(); + final List apps = List.empty(growable: true); try { String? res = await Root.exec( cmd: 'ls "$_revancedDirPath"', From eb584752598d117ceeff914e92f3d3bf94c8a0f4 Mon Sep 17 00:00:00 2001 From: Aabed Khan <39409020+TheAabedKhan@users.noreply.github.com> Date: Sat, 15 Jul 2023 06:55:36 +0545 Subject: [PATCH 6/9] fix: showing `Installed` when it's actually not (#1021) --- lib/services/patcher_api.dart | 8 +++----- lib/ui/views/home/home_viewmodel.dart | 10 +++++----- pubspec.yaml | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/services/patcher_api.dart b/lib/services/patcher_api.dart index cf6e6b97..bd7597a6 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 4ffdd86b..f67125ab 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 4b52fd12..196aff34 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 From 79116f9e67942702e7f28c3095ee6253ddbe1463 Mon Sep 17 00:00:00 2001 From: Aabed Khan <39409020+TheAabedKhan@users.noreply.github.com> Date: Sat, 15 Jul 2023 06:56:51 +0545 Subject: [PATCH 7/9] fix(patched-applications): non-patched app showing on `Installed` section (#1022) --- .../widgets/homeView/installed_apps_card.dart | 41 +++++++++++++++++-- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/lib/ui/widgets/homeView/installed_apps_card.dart b/lib/ui/widgets/homeView/installed_apps_card.dart index 2eb1119c..234ae3bd 100644 --- a/lib/ui/widgets/homeView/installed_apps_card.dart +++ b/lib/ui/widgets/homeView/installed_apps_card.dart @@ -1,16 +1,49 @@ +import 'package:device_apps/device_apps.dart'; import 'package:flutter/material.dart'; import 'package:flutter_i18n/flutter_i18n.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:revanced_manager/ui/views/home/home_viewmodel.dart'; import 'package:revanced_manager/ui/widgets/shared/application_item.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; -class InstalledAppsCard extends StatelessWidget { - InstalledAppsCard({Key? key}) : super(key: key); +class InstalledAppsCard extends StatefulWidget { + const InstalledAppsCard({Key? key}) : super(key: key); - final List apps = - locator().patchedInstalledApps; + @override + State createState() => _InstalledAppsCardState(); +} + +class _InstalledAppsCardState extends State { + List apps = locator().patchedInstalledApps; + final ManagerAPI _managerAPI = locator(); + List patchedApps = []; + + @override + void initState() { + super.initState(); + _getApps(); + } + + Future _getApps() async { + if (apps.isNotEmpty) { + patchedApps = [...apps]; + for (final element in apps) { + await DeviceApps.getApp(element.packageName).then((value) { + if (element.version != value?.versionName) { + patchedApps.remove(element); + } + }); + } + if (apps.length != patchedApps.length) { + await _managerAPI.setPatchedApps(patchedApps); + apps.clear(); + apps = [...patchedApps]; + } + setState(() {}); + } + } @override Widget build(BuildContext context) { From 630b22e193783e68718a27635462dafbe0f17369 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Sat, 15 Jul 2023 12:41:03 +0700 Subject: [PATCH 8/9] refactor: applies changes from formatter & linter --- lib/ui/views/home/home_view.dart | 2 +- lib/ui/views/navigation/navigation_view.dart | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ui/views/home/home_view.dart b/lib/ui/views/home/home_view.dart index 07ff7dad..d3e4153d 100644 --- a/lib/ui/views/home/home_view.dart +++ b/lib/ui/views/home/home_view.dart @@ -128,7 +128,7 @@ class HomeView extends StatelessWidget { }, child: model.showUpdatableApps ? AvailableUpdatesCard() - : InstalledAppsCard(), + : const InstalledAppsCard(), ), ], ), diff --git a/lib/ui/views/navigation/navigation_view.dart b/lib/ui/views/navigation/navigation_view.dart index be5250c5..7089d069 100644 --- a/lib/ui/views/navigation/navigation_view.dart +++ b/lib/ui/views/navigation/navigation_view.dart @@ -14,10 +14,10 @@ class NavigationView extends StatelessWidget { onViewModelReady: (model) => model.initialize(context), viewModelBuilder: () => locator(), builder: (context, model, child) => WillPopScope( - onWillPop: ()async{ - if(model.currentIndex == 0){ + onWillPop: () async { + if (model.currentIndex == 0) { return true; - }else{ + } else { model.setIndex(0); return false; } From 29323d4e20012a2575297ad86f72bb5e5cec8642 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Sat, 15 Jul 2023 12:55:59 +0700 Subject: [PATCH 9/9] build: update app version to `v1.4.1` --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 196aff34..52ecea22 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ homepage: https://github.com/revanced/revanced-manager publish_to: 'none' -version: 1.4.0+100400000 +version: 1.4.1+100400001 environment: sdk: '>=3.0.0 <4.0.0'