fix: minor improvements

This commit is contained in:
Alberto Ponces 2022-08-15 10:55:17 +01:00
parent 5c71930ec1
commit 384d593024
3 changed files with 19 additions and 7 deletions

View File

@ -62,7 +62,7 @@ class InstallerViewModel extends BaseViewModel {
locator<PatchesSelectorViewModel>().selectedPatches;
if (selectedPatches.isNotEmpty) {
addLog('Initializing installer...');
if (selectedApp.isRooted) {
if (selectedApp.isRooted && !selectedApp.isFromStorage) {
addLog('Checking if an old patched version exists...');
bool oldExists =
await locator<PatcherAPI>().checkOldPatch(selectedApp);

View File

@ -45,7 +45,7 @@ class AppSelectorCard extends StatelessWidget {
const SizedBox(height: 10),
locator<AppSelectorViewModel>().selectedApp != null
? Text(
locator<AppSelectorViewModel>().selectedApp!.name,
_getAppSelection(),
style: robotoTextStyle,
)
: I18nText(
@ -60,4 +60,10 @@ class AppSelectorCard extends StatelessWidget {
),
);
}
String _getAppSelection() {
String name = locator<AppSelectorViewModel>().selectedApp!.name;
String version = locator<AppSelectorViewModel>().selectedApp!.version;
return '$name (v$version)';
}
}

View File

@ -3,6 +3,7 @@ import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/constants.dart';
import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/ui/views/app_selector/app_selector_viewmodel.dart';
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart';
@ -58,15 +59,20 @@ class PatchSelectorCard extends StatelessWidget {
),
)
: Text(
locator<PatchesSelectorViewModel>()
.selectedPatches
.map((e) => e.simpleName)
.toList()
.join('\n'),
_getPatchesSelection(),
style: robotoTextStyle,
),
],
),
),
);
}
String _getPatchesSelection() {
String text = '';
for (Patch p in locator<PatchesSelectorViewModel>().selectedPatches) {
text += '${p.simpleName} (v${p.version})\n';
}
return text.substring(0, text.length - 1);
}
}