-
-
Notifications
You must be signed in to change notification settings - Fork 779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: output suggested version into patch log #1557
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -183,13 +183,15 @@ class InstallerViewModel extends BaseViewModel { | |||||
final lineCount = logLines.where((line) => line.endsWith(keyword)).length; | ||||||
final index = logLines.indexWhere((line) => line.endsWith(keyword)); | ||||||
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)); | ||||||
} | ||||||
|
||||||
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) { | ||||||
return savedOption.value; | ||||||
} else { | ||||||
|
@@ -201,7 +203,24 @@ class InstallerViewModel extends BaseViewModel { | |||||
if (patches.isEmpty) { | ||||||
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 { | ||||||
|
@@ -213,12 +232,21 @@ class InstallerViewModel extends BaseViewModel { | |||||
_trimLogs(logsTrimmed, '.dex', 'Compiled {lineCount} dex files'); | ||||||
|
||||||
// Get patches added / removed | ||||||
final defaultPatches = _patcherAPI.getFilteredPatches(_app.packageName).where((p) => !p.excluded).toList(); | ||||||
final patchesAdded = _patches.where((p) => !defaultPatches.contains(p)).toList(); | ||||||
final patchesRemoved = defaultPatches.where((p) => !_patches.contains(p)).toList(); | ||||||
final defaultPatches = _patcherAPI | ||||||
.getFilteredPatches(_app.packageName) | ||||||
.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 | ||||||
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 | ||||||
final formattedLogs = [ | ||||||
|
@@ -228,22 +256,22 @@ class InstallerViewModel extends BaseViewModel { | |||||
'Model: ${info['model']}', | ||||||
'Android version: ${info['androidVersion']}', | ||||||
'Supported architectures: ${info['supportedArch'].join(", ")}', | ||||||
'Root permissions: ${isRooted ? 'Yes' : 'No'}', | ||||||
'Root permissions: ${isRooted ? 'Yes' : 'No'}', // | ||||||
|
||||||
'\n- Patch Info', | ||||||
'App: ${_app.packageName} v${_app.version}', | ||||||
'App: ${_app.packageName} v${_app.version} (Suggested: ${_getSuggestedVersion(_app.packageName)})', | ||||||
'Patches version: ${_managerAPI.patchesVersion}', | ||||||
'Patches added: ${_formatPatches(patchesAdded)}', | ||||||
'Patches removed: ${_formatPatches(patchesRemoved)}', | ||||||
'Options changed: ${_formatPatches(patchesChanged)}', | ||||||
'Options changed: ${_formatPatches(patchesChanged)}', // | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
'\n- Settings', | ||||||
'Allow changing patch selection: ${_managerAPI.isPatchesChangeEnabled()}', | ||||||
'Version compatibility check: ${_managerAPI.isVersionCompatibilityCheckEnabled()}', | ||||||
'Show universal patches: ${_managerAPI.areUniversalPatchesEnabled()}', | ||||||
'Patches source: ${_managerAPI.getPatchesRepo()}', | ||||||
'Integration source: ${_managerAPI.getIntegrationsRepo()}', | ||||||
'Integration source: ${_managerAPI.getIntegrationsRepo()}', // | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
'\n- Logs', | ||||||
logsTrimmed.join('\n'), | ||||||
]; | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The slash was intentional, it was to prevent Dart from removing or trimming intended whitespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the whitespace necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, by whitespace I mean newline, it's there because it's nicer then clamping everything together.