mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 20:57:36 +02:00
refactor: apply suggestions from analyser
Signed-off-by: validcube <pun.butrach@gmail.com>
This commit is contained in:
@ -40,8 +40,8 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
||||
),
|
||||
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<AppSelectorView> {
|
||||
),
|
||||
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<AppSelectorView> {
|
||||
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<AppSelectorView> {
|
||||
packageName: app,
|
||||
),
|
||||
),
|
||||
)
|
||||
,
|
||||
),
|
||||
const SizedBox(height: 70.0),
|
||||
],
|
||||
),
|
||||
|
@ -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'),
|
||||
),
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -180,11 +180,16 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
||||
),
|
||||
],
|
||||
),
|
||||
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<PatchesSelectorView> {
|
||||
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();
|
||||
|
Reference in New Issue
Block a user