refactor: change name from "recommendedVersion" to "suggestedVersion"

This commit is contained in:
EvadeMaster 2023-04-29 20:00:00 +07:00 committed by Palm
parent e2ed296dc7
commit 941263102d
8 changed files with 26 additions and 26 deletions

View file

@ -57,7 +57,7 @@
"widgetSubtitle": "No application selected", "widgetSubtitle": "No application selected",
"noAppsLabel": "No applications found", "noAppsLabel": "No applications found",
"currentVersion": "Current", "currentVersion": "Current",
"recommendedVersion": "Suggested", "suggestedVersion": "Suggested",
"anyVersion": "any" "anyVersion": "any"
}, },
"patchSelectorCard": { "patchSelectorCard": {
@ -91,7 +91,7 @@
"loadPatchesSelection": "Load patches selection", "loadPatchesSelection": "Load patches selection",
"noSavedPatches": "No saved patches for the selected app.\nPress Done to save current selection.", "noSavedPatches": "No saved patches for the selected app.\nPress Done to save current selection.",
"noPatchesFound": "No patches found for the selected app", "noPatchesFound": "No patches found for the selected app",
"selectAllPatchesWarningContent": "You are about to select all patches, that includes unrecommended patches and can cause unwanted behavior." "selectAllPatchesWarningContent": "You are about to select all patches, that includes non-suggested patches and can cause unwanted behavior."
}, },
"patchItem": { "patchItem": {
"unsupportedDialogText": "Selecting this patch may result in patching errors.\n\nApp version: {packageVersion}\nSupported versions:\n{supportedVersions}", "unsupportedDialogText": "Selecting this patch may result in patching errors.\n\nApp version: {packageVersion}\nSupported versions:\n{supportedVersions}",

View file

@ -310,7 +310,7 @@ class PatcherAPI {
ShareExtend.share(log.path, 'file'); ShareExtend.share(log.path, 'file');
} }
String getRecommendedVersion(String packageName) { String getSuggestedVersion(String packageName) {
final Map<String, int> versions = {}; final Map<String, int> versions = {};
for (final Patch patch in _patches) { for (final Patch patch in _patches) {
final Package? package = patch.compatiblePackages.firstWhereOrNull( final Package? package = patch.compatiblePackages.firstWhereOrNull(

View file

@ -104,8 +104,8 @@ class _AppSelectorViewState extends State<AppSelectorView> {
icon: app.icon, icon: app.icon,
patchesCount: patchesCount:
model.patchesCount(app.packageName), model.patchesCount(app.packageName),
recommendedVersion: suggestedVersion:
model.getRecommendedVersion( model.getSuggestedVersion(
app.packageName, app.packageName,
), ),
onTap: () { onTap: () {
@ -127,8 +127,8 @@ class _AppSelectorViewState extends State<AppSelectorView> {
(app) => NotInstalledAppItem( (app) => NotInstalledAppItem(
name: app, name: app,
patchesCount: model.patchesCount(app), patchesCount: model.patchesCount(app),
recommendedVersion: suggestedVersion:
model.getRecommendedVersion(app), model.getSuggestedVersion(app),
onTap: () { onTap: () {
model.showDownloadToast(); model.showDownloadToast();
}, },

View file

@ -61,8 +61,8 @@ class AppSelectorViewModel extends BaseViewModel {
return allApps; return allApps;
} }
String getRecommendedVersion(String packageName) { String getSuggestedVersion(String packageName) {
return _patcherAPI.getRecommendedVersion(packageName); return _patcherAPI.getSuggestedVersion(packageName);
} }
Future<void> selectApp(ApplicationWithIcon application) async { Future<void> selectApp(ApplicationWithIcon application) async {

View file

@ -130,24 +130,24 @@ class PatcherViewModel extends BaseViewModel {
return text; return text;
} }
String getRecommendedVersionString(BuildContext context) { String getSuggestedVersionString(BuildContext context) {
String recommendedVersion = String suggestedVersion =
_patcherAPI.getRecommendedVersion(selectedApp!.packageName); _patcherAPI.getSuggestedVersion(selectedApp!.packageName);
if (recommendedVersion.isEmpty) { if (suggestedVersion.isEmpty) {
recommendedVersion = FlutterI18n.translate( suggestedVersion = FlutterI18n.translate(
context, context,
'appSelectorCard.anyVersion', 'appSelectorCard.anyVersion',
); );
} else { } else {
recommendedVersion = 'v$recommendedVersion'; suggestedVersion = 'v$suggestedVersion';
} }
return '${FlutterI18n.translate( return '${FlutterI18n.translate(
context, context,
'appSelectorCard.currentVersion', 'appSelectorCard.currentVersion',
)}: v${selectedApp!.version}\n${FlutterI18n.translate( )}: v${selectedApp!.version}\n${FlutterI18n.translate(
context, context,
'appSelectorCard.recommendedVersion', 'appSelectorCard.suggestedVersion',
)}: $recommendedVersion'; )}: $suggestedVersion';
} }
Future<void> loadLastSelectedPatches() async { Future<void> loadLastSelectedPatches() async {

View file

@ -9,14 +9,14 @@ class InstalledAppItem extends StatefulWidget {
required this.pkgName, required this.pkgName,
required this.icon, required this.icon,
required this.patchesCount, required this.patchesCount,
required this.recommendedVersion, required this.suggestedVersion,
this.onTap, this.onTap,
}) : super(key: key); }) : super(key: key);
final String name; final String name;
final String pkgName; final String pkgName;
final Uint8List icon; final Uint8List icon;
final int patchesCount; final int patchesCount;
final String recommendedVersion; final String suggestedVersion;
final Function()? onTap; final Function()? onTap;
@override @override
@ -62,9 +62,9 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
Row( Row(
children: [ children: [
Text( Text(
widget.recommendedVersion.isEmpty widget.suggestedVersion.isEmpty
? 'All versions' ? 'All versions'
: widget.recommendedVersion, : widget.suggestedVersion,
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
Text( Text(

View file

@ -6,12 +6,12 @@ class NotInstalledAppItem extends StatefulWidget {
Key? key, Key? key,
required this.name, required this.name,
required this.patchesCount, required this.patchesCount,
required this.recommendedVersion, required this.suggestedVersion,
this.onTap, this.onTap,
}) : super(key: key); }) : super(key: key);
final String name; final String name;
final int patchesCount; final int patchesCount;
final String recommendedVersion; final String suggestedVersion;
final Function()? onTap; final Function()? onTap;
@override @override
@ -59,9 +59,9 @@ class _NotInstalledAppItem extends State<NotInstalledAppItem> {
Row( Row(
children: [ children: [
Text( Text(
widget.recommendedVersion.isEmpty widget.suggestedVersion.isEmpty
? 'All versions' ? 'All versions'
: widget.recommendedVersion, : widget.suggestedVersion,
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
Text( Text(

View file

@ -63,7 +63,7 @@ class AppSelectorCard extends StatelessWidget {
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
locator<PatcherViewModel>() locator<PatcherViewModel>()
.getRecommendedVersionString(context), .getSuggestedVersionString(context),
), ),
], ],
), ),