mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-05-11 18:34:25 +02:00
feat: output suggested version into patch log (#1557)
Signed-off-by: validcube <pun.butrach@gmail.com>
This commit is contained in:
parent
d9a316abbb
commit
637641cf54
@ -183,13 +183,15 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
final lineCount = logLines.where((line) => line.endsWith(keyword)).length;
|
final lineCount = logLines.where((line) => line.endsWith(keyword)).length;
|
||||||
final index = logLines.indexWhere((line) => line.endsWith(keyword));
|
final index = logLines.indexWhere((line) => line.endsWith(keyword));
|
||||||
if (newString != null && lineCount > 0) {
|
if (newString != null && lineCount > 0) {
|
||||||
logLines.insert(index, newString.replaceAll('{lineCount}', lineCount.toString()));
|
logLines.insert(
|
||||||
|
index, newString.replaceAll('{lineCount}', lineCount.toString()));
|
||||||
}
|
}
|
||||||
logLines.removeWhere((lines) => lines.endsWith(keyword));
|
logLines.removeWhere((lines) => lines.endsWith(keyword));
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic _getPatchOptionValue(String patchName, Option option) {
|
dynamic _getPatchOptionValue(String patchName, Option option) {
|
||||||
final Option? savedOption = _managerAPI.getPatchOption(_app.packageName, patchName, option.key);
|
final Option? savedOption =
|
||||||
|
_managerAPI.getPatchOption(_app.packageName, patchName, option.key);
|
||||||
if (savedOption != null) {
|
if (savedOption != null) {
|
||||||
return savedOption.value;
|
return savedOption.value;
|
||||||
} else {
|
} else {
|
||||||
@ -201,7 +203,24 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
if (patches.isEmpty) {
|
if (patches.isEmpty) {
|
||||||
return 'None';
|
return 'None';
|
||||||
}
|
}
|
||||||
return patches.map((p) => p.name + (p.options.isEmpty ? '' : ' [${p.options.map((o) => '${o.title}: ${_getPatchOptionValue(p.name, o)}').join(", ")}]')).toList().join(', ');
|
return patches
|
||||||
|
.map((p) =>
|
||||||
|
p.name +
|
||||||
|
(p.options.isEmpty
|
||||||
|
? ''
|
||||||
|
: ' [${p.options.map((o) => '${o.title}: ${_getPatchOptionValue(p.name, o)}').join(", ")}]'))
|
||||||
|
.toList()
|
||||||
|
.join(', ');
|
||||||
|
}
|
||||||
|
|
||||||
|
String _getSuggestedVersion(String packageName) {
|
||||||
|
String suggestedVersion = _patcherAPI.getSuggestedVersion(_app.packageName);
|
||||||
|
if (suggestedVersion.isEmpty) {
|
||||||
|
suggestedVersion = 'Any';
|
||||||
|
} else {
|
||||||
|
suggestedVersion = 'v$suggestedVersion';
|
||||||
|
}
|
||||||
|
return suggestedVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> copyLogs() async {
|
Future<void> copyLogs() async {
|
||||||
@ -213,12 +232,21 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
_trimLogs(logsTrimmed, '.dex', 'Compiled {lineCount} dex files');
|
_trimLogs(logsTrimmed, '.dex', 'Compiled {lineCount} dex files');
|
||||||
|
|
||||||
// Get patches added / removed
|
// Get patches added / removed
|
||||||
final defaultPatches = _patcherAPI.getFilteredPatches(_app.packageName).where((p) => !p.excluded).toList();
|
final defaultPatches = _patcherAPI
|
||||||
final patchesAdded = _patches.where((p) => !defaultPatches.contains(p)).toList();
|
.getFilteredPatches(_app.packageName)
|
||||||
final patchesRemoved = defaultPatches.where((p) => !_patches.contains(p)).toList();
|
.where((p) => !p.excluded)
|
||||||
|
.toList();
|
||||||
|
final patchesAdded =
|
||||||
|
_patches.where((p) => !defaultPatches.contains(p)).toList();
|
||||||
|
final patchesRemoved =
|
||||||
|
defaultPatches.where((p) => !_patches.contains(p)).toList();
|
||||||
|
|
||||||
// Options changed
|
// Options changed
|
||||||
final patchesChanged = defaultPatches.where((p) => _patches.contains(p) && p.options.any((o) => _getPatchOptionValue(p.name, o) != o.value)).toList();
|
final patchesChanged = defaultPatches
|
||||||
|
.where((p) =>
|
||||||
|
_patches.contains(p) &&
|
||||||
|
p.options.any((o) => _getPatchOptionValue(p.name, o) != o.value))
|
||||||
|
.toList();
|
||||||
|
|
||||||
// Add Info
|
// Add Info
|
||||||
final formattedLogs = [
|
final formattedLogs = [
|
||||||
@ -228,22 +256,22 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
'Model: ${info['model']}',
|
'Model: ${info['model']}',
|
||||||
'Android version: ${info['androidVersion']}',
|
'Android version: ${info['androidVersion']}',
|
||||||
'Supported architectures: ${info['supportedArch'].join(", ")}',
|
'Supported architectures: ${info['supportedArch'].join(", ")}',
|
||||||
'Root permissions: ${isRooted ? 'Yes' : 'No'}',
|
'Root permissions: ${isRooted ? 'Yes' : 'No'}', //
|
||||||
|
|
||||||
'\n- Patch Info',
|
'\n- Patch Info',
|
||||||
'App: ${_app.packageName} v${_app.version}',
|
'App: ${_app.packageName} v${_app.version} (Suggested: ${_getSuggestedVersion(_app.packageName)})',
|
||||||
'Patches version: ${_managerAPI.patchesVersion}',
|
'Patches version: ${_managerAPI.patchesVersion}',
|
||||||
'Patches added: ${_formatPatches(patchesAdded)}',
|
'Patches added: ${_formatPatches(patchesAdded)}',
|
||||||
'Patches removed: ${_formatPatches(patchesRemoved)}',
|
'Patches removed: ${_formatPatches(patchesRemoved)}',
|
||||||
'Options changed: ${_formatPatches(patchesChanged)}',
|
'Options changed: ${_formatPatches(patchesChanged)}', //
|
||||||
|
|
||||||
'\n- Settings',
|
'\n- Settings',
|
||||||
'Allow changing patch selection: ${_managerAPI.isPatchesChangeEnabled()}',
|
'Allow changing patch selection: ${_managerAPI.isPatchesChangeEnabled()}',
|
||||||
'Version compatibility check: ${_managerAPI.isVersionCompatibilityCheckEnabled()}',
|
'Version compatibility check: ${_managerAPI.isVersionCompatibilityCheckEnabled()}',
|
||||||
'Show universal patches: ${_managerAPI.areUniversalPatchesEnabled()}',
|
'Show universal patches: ${_managerAPI.areUniversalPatchesEnabled()}',
|
||||||
'Patches source: ${_managerAPI.getPatchesRepo()}',
|
'Patches source: ${_managerAPI.getPatchesRepo()}',
|
||||||
'Integration source: ${_managerAPI.getIntegrationsRepo()}',
|
'Integration source: ${_managerAPI.getIntegrationsRepo()}', //
|
||||||
|
|
||||||
'\n- Logs',
|
'\n- Logs',
|
||||||
logsTrimmed.join('\n'),
|
logsTrimmed.join('\n'),
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user