diff --git a/lib/models/patch.dart b/lib/models/patch.dart index ebcebf59..1b86ba5b 100644 --- a/lib/models/patch.dart +++ b/lib/models/patch.dart @@ -75,9 +75,8 @@ class Option { if (json['valueType'] == null) { final type = json['optionClassType']; if (type is String) { - json['valueType'] = type - .replaceAll('PatchOption', '') - .replaceAll('List', 'Array'); + json['valueType'] = + type.replaceAll('PatchOption', '').replaceAll('List', 'Array'); json['optionClassType'] = null; } diff --git a/lib/services/download_manager.dart b/lib/services/download_manager.dart index 1aa9fc2b..caa705d7 100644 --- a/lib/services/download_manager.dart +++ b/lib/services/download_manager.dart @@ -19,7 +19,8 @@ class DownloadManager { ); Future initialize() async { - _userAgent = 'ReVanced-Manager/${await _managerAPI.getCurrentManagerVersion()}'; + _userAgent = + 'ReVanced-Manager/${await _managerAPI.getCurrentManagerVersion()}'; } Dio initDio(String url) { diff --git a/lib/services/patcher_api.dart b/lib/services/patcher_api.dart index fda603d9..8efd18b0 100644 --- a/lib/services/patcher_api.dart +++ b/lib/services/patcher_api.dart @@ -14,7 +14,6 @@ import 'package:revanced_manager/models/patch.dart'; import 'package:revanced_manager/models/patched_application.dart'; import 'package:revanced_manager/services/manager_api.dart'; import 'package:revanced_manager/services/root_api.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; import 'package:share_plus/share_plus.dart'; @lazySingleton diff --git a/lib/services/root_api.dart b/lib/services/root_api.dart index 2b3f4cf2..41691d30 100644 --- a/lib/services/root_api.dart +++ b/lib/services/root_api.dart @@ -93,7 +93,8 @@ class RootAPI { Future unmount(String packageName) async { await Root.exec( - cmd: 'grep $packageName /proc/mounts | while read -r line; do echo \$line | cut -d " " -f 2 | sed "s/apk.*/apk/" | xargs -r umount -l; done', + cmd: + 'grep $packageName /proc/mounts | while read -r line; do echo \$line | cut -d " " -f 2 | sed "s/apk.*/apk/" | xargs -r umount -l; done', ); await Root.exec( cmd: 'rm -rf "$_revancedDirPath/$packageName"', @@ -188,12 +189,15 @@ class RootAPI { ); } - Future mountApk(String packageName,) async { + Future mountApk( + String packageName, + ) async { await Root.exec( cmd: ''' grep $packageName /proc/mounts | while read -r line; do echo \$line | cut -d " " -f 2 | sed "s/apk.*/apk/" | xargs -r umount -l; done .$_serviceDDirPath/$packageName.sh - '''.trim(), + ''' + .trim(), ); } diff --git a/lib/ui/theme/dynamic_theme_builder.dart b/lib/ui/theme/dynamic_theme_builder.dart index 8f9fc98b..9ec2d1bd 100644 --- a/lib/ui/theme/dynamic_theme_builder.dart +++ b/lib/ui/theme/dynamic_theme_builder.dart @@ -25,7 +25,8 @@ class DynamicThemeBuilder extends StatefulWidget { State createState() => _DynamicThemeBuilderState(); } -class _DynamicThemeBuilderState extends State with WidgetsBindingObserver { +class _DynamicThemeBuilderState extends State + with WidgetsBindingObserver { Brightness brightness = PlatformDispatcher.instance.platformBrightness; final ManagerAPI _managerAPI = locator(); @@ -43,8 +44,9 @@ class _DynamicThemeBuilderState extends State with WidgetsB if (_managerAPI.getThemeMode() < 2) { SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle( - systemNavigationBarIconBrightness: - brightness == Brightness.light ? Brightness.dark : Brightness.light, + systemNavigationBarIconBrightness: brightness == Brightness.light + ? Brightness.dark + : Brightness.light, ), ); } @@ -83,24 +85,31 @@ class _DynamicThemeBuilderState extends State with WidgetsB return DynamicTheme( themeCollection: ThemeCollection( themes: { - 0: brightness == Brightness.light ? lightCustomTheme : darkCustomTheme, - 1: brightness == Brightness.light ? lightDynamicTheme : darkDynamicTheme, + 0: brightness == Brightness.light + ? lightCustomTheme + : darkCustomTheme, + 1: brightness == Brightness.light + ? lightDynamicTheme + : darkDynamicTheme, 2: lightCustomTheme, 3: lightDynamicTheme, 4: darkCustomTheme, 5: darkDynamicTheme, }, - fallbackTheme: PlatformDispatcher.instance.platformBrightness == Brightness.light ? lightCustomTheme : darkCustomTheme, + fallbackTheme: PlatformDispatcher.instance.platformBrightness == + Brightness.light + ? lightCustomTheme + : darkCustomTheme, ), builder: (context, theme) => MaterialApp( - debugShowCheckedModeBanner: false, - title: widget.title, - navigatorKey: StackedService.navigatorKey, - onGenerateRoute: StackedRouter().onGenerateRoute, - theme: theme, - home: widget.home, - localizationsDelegates: widget.localizationsDelegates, - ), + debugShowCheckedModeBanner: false, + title: widget.title, + navigatorKey: StackedService.navigatorKey, + onGenerateRoute: StackedRouter().onGenerateRoute, + theme: theme, + home: widget.home, + localizationsDelegates: widget.localizationsDelegates, + ), ); }, ); diff --git a/lib/ui/views/app_selector/app_selector_view.dart b/lib/ui/views/app_selector/app_selector_view.dart index 09f6dacc..a4c60149 100644 --- a/lib/ui/views/app_selector/app_selector_view.dart +++ b/lib/ui/views/app_selector/app_selector_view.dart @@ -40,8 +40,8 @@ class _AppSelectorViewState extends State { ), titleTextStyle: TextStyle( fontSize: 22.0, - color: Theme.of(context).textTheme.titleLarge!.color, - ), + color: Theme.of(context).textTheme.titleLarge!.color, + ), leading: IconButton( icon: Icon( Icons.arrow_back, @@ -94,9 +94,7 @@ class _AppSelectorViewState extends State { ), child: Column( children: [ - ...model - .getFilteredApps(_query) - .map( + ...model.getFilteredApps(_query).map( (app) => InstalledAppItem( name: app.appName, pkgName: app.packageName, @@ -117,11 +115,8 @@ class _AppSelectorViewState extends State { packageName: app.packageName, ), ), - ) - , - ...model - .getFilteredAppsNames(_query) - .map( + ), + ...model.getFilteredAppsNames(_query).map( (app) => NotInstalledAppItem( name: app, patchesCount: model.patchesCount(app), @@ -135,8 +130,7 @@ class _AppSelectorViewState extends State { packageName: app, ), ), - ) - , + ), const SizedBox(height: 70.0), ], ), diff --git a/lib/ui/views/home/home_viewmodel.dart b/lib/ui/views/home/home_viewmodel.dart index a93fb16f..c9356a56 100644 --- a/lib/ui/views/home/home_viewmodel.dart +++ b/lib/ui/views/home/home_viewmodel.dart @@ -83,7 +83,6 @@ class HomeViewModel extends BaseViewModel { _managerAPI.reAssessSavedApps().then((_) => _getPatchedApps()); } - void navigateToAppInfo(PatchedApplication app) { _navigationService.navigateTo( Routes.appInfoView, @@ -366,7 +365,10 @@ class HomeViewModel extends BaseViewModel { alignment: Alignment.centerRight, child: FilledButton( onPressed: () async { - await _patcherAPI.installApk(context, downloadedApk!.path); + await _patcherAPI.installApk( + context, + downloadedApk!.path, + ); }, child: I18nText('updateButton'), ), diff --git a/lib/ui/views/installer/installer_viewmodel.dart b/lib/ui/views/installer/installer_viewmodel.dart index 039af2b4..4985159b 100644 --- a/lib/ui/views/installer/installer_viewmodel.dart +++ b/lib/ui/views/installer/installer_viewmodel.dart @@ -183,7 +183,9 @@ class InstallerViewModel extends BaseViewModel { final index = logLines.indexWhere((line) => line.endsWith(keyword)); if (newString != null && lineCount > 0) { logLines.insert( - index, newString.replaceAll('{lineCount}', lineCount.toString())); + index, + newString.replaceAll('{lineCount}', lineCount.toString()), + ); } logLines.removeWhere((lines) => lines.endsWith(keyword)); } @@ -203,11 +205,13 @@ class InstallerViewModel extends BaseViewModel { return 'None'; } return patches - .map((p) => - p.name + - (p.options.isEmpty - ? '' - : ' [${p.options.map((o) => '${o.title}: ${_getPatchOptionValue(p.name, o)}').join(", ")}]')) + .map( + (p) => + p.name + + (p.options.isEmpty + ? '' + : ' [${p.options.map((o) => '${o.title}: ${_getPatchOptionValue(p.name, o)}').join(", ")}]'), + ) .toList() .join(', '); } @@ -242,9 +246,11 @@ class InstallerViewModel extends BaseViewModel { // Options changed final patchesChanged = defaultPatches - .where((p) => - _patches.contains(p) && - p.options.any((o) => _getPatchOptionValue(p.name, o) != o.value)) + .where( + (p) => + _patches.contains(p) && + p.options.any((o) => _getPatchOptionValue(p.name, o) != o.value), + ) .toList(); // Add Info @@ -453,9 +459,7 @@ class InstallerViewModel extends BaseViewModel { update( 1.0, 'Installing...', - _app.isRooted - ? 'Mounting patched app' - : 'Installing patched app', + _app.isRooted ? 'Mounting patched app' : 'Installing patched app', ); } final int response = await _patcherAPI.installPatchedFile(context, _app); diff --git a/lib/ui/views/patcher/patcher_view.dart b/lib/ui/views/patcher/patcher_view.dart index 0921bb1d..9def6c05 100644 --- a/lib/ui/views/patcher/patcher_view.dart +++ b/lib/ui/views/patcher/patcher_view.dart @@ -22,7 +22,7 @@ class PatcherView extends StatelessWidget { child: FloatingActionButton.extended( label: I18nText('patcherView.patchButton'), icon: const Icon(Icons.build), - onPressed: () async{ + onPressed: () async { if (model.checkRequiredPatchOption(context)) { final bool proceed = model.showRemovedPatchesDialog(context); if (proceed && context.mounted) { diff --git a/lib/ui/views/patches_selector/patches_selector_view.dart b/lib/ui/views/patches_selector/patches_selector_view.dart index 29489078..71e90d79 100644 --- a/lib/ui/views/patches_selector/patches_selector_view.dart +++ b/lib/ui/views/patches_selector/patches_selector_view.dart @@ -180,11 +180,16 @@ class _PatchesSelectorViewState extends State { ), ], ), - if (model.getQueriedPatches(_query).any((patch) => model.isPatchNew(patch))) + if (model + .getQueriedPatches(_query) + .any((patch) => model.isPatchNew(patch))) Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - model.getPatchCategory(context, 'patchesSelectorView.newPatches'), + model.getPatchCategory( + context, + 'patchesSelectorView.newPatches', + ), ...model.getQueriedPatches(_query).map((patch) { if (model.isPatchNew(patch)) { return model.getPatchItem(context, patch); @@ -192,26 +197,40 @@ class _PatchesSelectorViewState extends State { return Container(); } }), - if (model.getQueriedPatches(_query).any((patch) => !model.isPatchNew(patch) && patch.compatiblePackages.isNotEmpty)) - model.getPatchCategory(context, 'patchesSelectorView.patches'), + if (model.getQueriedPatches(_query).any( + (patch) => + !model.isPatchNew(patch) && + patch.compatiblePackages.isNotEmpty, + )) + model.getPatchCategory( + context, + 'patchesSelectorView.patches', + ), ], ), ...model.getQueriedPatches(_query).map( (patch) { - if (patch.compatiblePackages.isNotEmpty && !model.isPatchNew(patch)) { + if (patch.compatiblePackages.isNotEmpty && + !model.isPatchNew(patch)) { return model.getPatchItem(context, patch); } else { return Container(); } }, ), - if (model.getQueriedPatches(_query).any((patch) => patch.compatiblePackages.isEmpty)) + if (model + .getQueriedPatches(_query) + .any((patch) => patch.compatiblePackages.isEmpty)) Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - model.getPatchCategory(context, 'patchesSelectorView.universalPatches'), + model.getPatchCategory( + context, + 'patchesSelectorView.universalPatches', + ), ...model.getQueriedPatches(_query).map((patch) { - if (patch.compatiblePackages.isEmpty && !model.isPatchNew(patch)) { + if (patch.compatiblePackages.isEmpty && + !model.isPatchNew(patch)) { return model.getPatchItem(context, patch); } else { return Container(); diff --git a/lib/ui/widgets/patcherView/patch_selector_card.dart b/lib/ui/widgets/patcherView/patch_selector_card.dart index ceea41c9..9dd48686 100644 --- a/lib/ui/widgets/patcherView/patch_selector_card.dart +++ b/lib/ui/widgets/patcherView/patch_selector_card.dart @@ -58,7 +58,8 @@ class PatchSelectorCard extends StatelessWidget { String _getPatchesSelection() { String text = ''; - final List selectedPatches = locator().selectedPatches; + final List selectedPatches = + locator().selectedPatches; selectedPatches.sort((a, b) => a.name.compareTo(b.name)); for (final Patch p in selectedPatches) { text += '• ${p.getSimpleName()}\n'; diff --git a/lib/ui/widgets/patchesSelectorView/patch_options_fields.dart b/lib/ui/widgets/patchesSelectorView/patch_options_fields.dart index ae026cb7..2d5d2dfd 100644 --- a/lib/ui/widgets/patchesSelectorView/patch_options_fields.dart +++ b/lib/ui/widgets/patchesSelectorView/patch_options_fields.dart @@ -400,7 +400,9 @@ class _TextFieldForPatchOptionState extends State { final bool isStringOption = widget.optionType.contains('String'); final bool isArrayOption = widget.optionType.contains('Array'); selectedKey ??= widget.selectedKey; - controller.text = !isStringOption && isArrayOption && selectedKey == '' && + controller.text = !isStringOption && + isArrayOption && + selectedKey == '' && (widget.value != null && widget.value.toString().startsWith('[')) ? '' : widget.value ?? ''; @@ -519,7 +521,8 @@ class _TextFieldForPatchOptionState extends State { } break; case 'patchOptionsView.selectFolder': - final DirectoryLocation? result = await FlutterFileDialog.pickDirectory(); + final DirectoryLocation? result = + await FlutterFileDialog.pickDirectory(); if (result != null) { controller.text = result.toString(); widget.onChanged(controller.text); diff --git a/lib/ui/widgets/settingsView/settings_advanced_section.dart b/lib/ui/widgets/settingsView/settings_advanced_section.dart index 53b3cadf..4182b7a0 100644 --- a/lib/ui/widgets/settingsView/settings_advanced_section.dart +++ b/lib/ui/widgets/settingsView/settings_advanced_section.dart @@ -10,7 +10,6 @@ import 'package:revanced_manager/ui/widgets/settingsView/settings_section.dart'; import 'package:revanced_manager/ui/widgets/settingsView/settings_universal_patches.dart'; import 'package:revanced_manager/ui/widgets/settingsView/settings_version_compatibility_check.dart'; - class SAdvancedSection extends StatelessWidget { const SAdvancedSection({super.key}); diff --git a/lib/ui/widgets/settingsView/settings_enable_patches_selection.dart b/lib/ui/widgets/settingsView/settings_enable_patches_selection.dart index a0c5b463..a2fcc86b 100644 --- a/lib/ui/widgets/settingsView/settings_enable_patches_selection.dart +++ b/lib/ui/widgets/settingsView/settings_enable_patches_selection.dart @@ -6,7 +6,8 @@ class SEnablePatchesSelection extends StatefulWidget { const SEnablePatchesSelection({super.key}); @override - State createState() => _SEnablePatchesSelectionState(); + State createState() => + _SEnablePatchesSelectionState(); } final _settingsViewModel = SettingsViewModel(); diff --git a/lib/ui/widgets/settingsView/settings_require_suggested_app_version.dart b/lib/ui/widgets/settingsView/settings_require_suggested_app_version.dart index 1d431e60..da583a97 100644 --- a/lib/ui/widgets/settingsView/settings_require_suggested_app_version.dart +++ b/lib/ui/widgets/settingsView/settings_require_suggested_app_version.dart @@ -6,12 +6,14 @@ class SRequireSuggestedAppVersion extends StatefulWidget { const SRequireSuggestedAppVersion({super.key}); @override - State createState() => _SRequireSuggestedAppVersionState(); + State createState() => + _SRequireSuggestedAppVersionState(); } final _settingsViewModel = SettingsViewModel(); -class _SRequireSuggestedAppVersionState extends State { +class _SRequireSuggestedAppVersionState + extends State { @override Widget build(BuildContext context) { return SwitchListTile( @@ -29,8 +31,11 @@ class _SRequireSuggestedAppVersionState extends State createState() => - _SUniversalPatchesState(); + State createState() => _SUniversalPatchesState(); } final _settingsViewModel = SettingsViewModel(); final _patchesSelectorViewModel = PatchesSelectorViewModel(); final _patcherViewModel = PatcherViewModel(); -class _SUniversalPatchesState - extends State { +class _SUniversalPatchesState extends State { @override Widget build(BuildContext context) { return SwitchListTile( diff --git a/lib/ui/widgets/settingsView/settings_version_compatibility_check.dart b/lib/ui/widgets/settingsView/settings_version_compatibility_check.dart index ead3b070..a17fcb3b 100644 --- a/lib/ui/widgets/settingsView/settings_version_compatibility_check.dart +++ b/lib/ui/widgets/settingsView/settings_version_compatibility_check.dart @@ -9,14 +9,16 @@ class SVersionCompatibilityCheck extends StatefulWidget { const SVersionCompatibilityCheck({super.key}); @override - State createState() => _SVersionCompatibilityCheckState(); + State createState() => + _SVersionCompatibilityCheckState(); } final _settingsViewModel = SettingsViewModel(); final _patchesSelectorViewModel = PatchesSelectorViewModel(); final _patcherViewModel = PatcherViewModel(); -class _SVersionCompatibilityCheckState extends State { +class _SVersionCompatibilityCheckState + extends State { @override Widget build(BuildContext context) { return SwitchListTile( diff --git a/lib/utils/check_for_supported_patch.dart b/lib/utils/check_for_supported_patch.dart index 19bd30c1..5cb311c6 100644 --- a/lib/utils/check_for_supported_patch.dart +++ b/lib/utils/check_for_supported_patch.dart @@ -27,12 +27,12 @@ bool hasUnsupportedRequiredOption(List