chore: merge dev to main (#1388)

This commit is contained in:
Ushie 2023-10-15 20:19:54 +03:00 committed by GitHub
commit b355778a92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 18 deletions

View File

@ -254,7 +254,7 @@
"resetStoredPatchesLabel": "Reset patch selection", "resetStoredPatchesLabel": "Reset patch selection",
"resetStoredPatchesHint": "Reset the stored patch selection", "resetStoredPatchesHint": "Reset the stored patch selection",
"resetStoredPatchesDialogTitle": "Reset patch selection?", "resetStoredPatchesDialogTitle": "Reset patch selection?",
"resetStoredPatchesDialogText": "The default selection of patches will be restored..", "resetStoredPatchesDialogText": "The default selection of patches will be restored.",
"resetStoredPatches": "Patch selection has been reset", "resetStoredPatches": "Patch selection has been reset",
"resetStoredOptionsLabel": "Reset patch options", "resetStoredOptionsLabel": "Reset patch options",

View File

@ -677,7 +677,7 @@ class ManagerAPI {
Future<List<String>> getDefaultPatches() async { Future<List<String>> getDefaultPatches() async {
final List<Patch> patches = await getPatches(); final List<Patch> patches = await getPatches();
final List<String> defaultPatches = []; final List<String> defaultPatches = [];
if (isVersionCompatibilityCheckEnabled() == false) { if (isVersionCompatibilityCheckEnabled() == true) {
defaultPatches.addAll( defaultPatches.addAll(
patches patches
.where( .where(

View File

@ -80,7 +80,8 @@ class PatcherViewModel extends BaseViewModel {
} }
bool checkRequiredPatchOption(BuildContext context) { bool checkRequiredPatchOption(BuildContext context) {
if (getNullRequiredOptions(selectedPatches, selectedApp!.packageName).isNotEmpty) { if (getNullRequiredOptions(selectedPatches, selectedApp!.packageName)
.isNotEmpty) {
showRequiredOptionDialog(context); showRequiredOptionDialog(context);
return false; return false;
} }
@ -190,7 +191,7 @@ class PatcherViewModel extends BaseViewModel {
this.selectedPatches.clear(); this.selectedPatches.clear();
this.selectedPatches.addAll(patches.where((patch) => !patch.excluded)); this.selectedPatches.addAll(patches.where((patch) => !patch.excluded));
} }
if (!_managerAPI.isVersionCompatibilityCheckEnabled()) { if (_managerAPI.isVersionCompatibilityCheckEnabled()) {
this.selectedPatches.removeWhere((patch) => !isPatchSupported(patch)); this.selectedPatches.removeWhere((patch) => !isPatchSupported(patch));
} }
if (!_managerAPI.areUniversalPatchesEnabled()) { if (!_managerAPI.areUniversalPatchesEnabled()) {
@ -199,11 +200,12 @@ class PatcherViewModel extends BaseViewModel {
.removeWhere((patch) => patch.compatiblePackages.isEmpty); .removeWhere((patch) => patch.compatiblePackages.isEmpty);
} }
final usedPatches = _managerAPI.getUsedPatches(selectedApp!.packageName); final usedPatches = _managerAPI.getUsedPatches(selectedApp!.packageName);
for (final patch in usedPatches){ for (final patch in usedPatches) {
if (!patches.any((p) => p.name == patch.name)){ if (!patches.any((p) => p.name == patch.name)) {
removedPatches.add('${patch.name}'); removedPatches.add('${patch.name}');
for (final option in patch.options) { for (final option in patch.options) {
_managerAPI.clearPatchOption(selectedApp!.packageName, patch.name, option.key); _managerAPI.clearPatchOption(
selectedApp!.packageName, patch.name, option.key);
} }
} }
} }

View File

@ -169,7 +169,7 @@ class PatchesSelectorViewModel extends BaseViewModel {
.where( .where(
(element) => (element) =>
!element.excluded && !element.excluded &&
(_managerAPI.isVersionCompatibilityCheckEnabled() || (!_managerAPI.isVersionCompatibilityCheckEnabled() ||
isPatchSupported(element)), isPatchSupported(element)),
), ),
); );
@ -209,7 +209,10 @@ class PatchesSelectorViewModel extends BaseViewModel {
query.isEmpty || query.isEmpty ||
query.length < 2 || query.length < 2 ||
patch.name.toLowerCase().contains(query.toLowerCase()) || patch.name.toLowerCase().contains(query.toLowerCase()) ||
patch.name.replaceAll(RegExp(r'[^\w\s]+'), '').toLowerCase().contains(query.toLowerCase()), patch.name
.replaceAll(RegExp(r'[^\w\s]+'), '')
.toLowerCase()
.contains(query.toLowerCase()),
) )
.toList(); .toList();
if (_managerAPI.areUniversalPatchesEnabled()) { if (_managerAPI.areUniversalPatchesEnabled()) {
@ -281,7 +284,7 @@ class PatchesSelectorViewModel extends BaseViewModel {
this.selectedPatches.addAll( this.selectedPatches.addAll(
patches.where((patch) => selectedPatches.contains(patch.name)), patches.where((patch) => selectedPatches.contains(patch.name)),
); );
if (!_managerAPI.isVersionCompatibilityCheckEnabled()) { if (_managerAPI.isVersionCompatibilityCheckEnabled()) {
this.selectedPatches.removeWhere((patch) => !isPatchSupported(patch)); this.selectedPatches.removeWhere((patch) => !isPatchSupported(patch));
} }
} else { } else {

View File

@ -48,12 +48,13 @@ class _PatchItemState extends State<PatchItem> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
widget.isSelected = widget.isSelected && widget.isSelected = widget.isSelected &&
(!widget.isUnsupported || (!widget.isUnsupported ||
widget._managerAPI.isVersionCompatibilityCheckEnabled()) && !widget.hasUnsupportedPatchOption; !widget._managerAPI.isVersionCompatibilityCheckEnabled()) &&
!widget.hasUnsupportedPatchOption;
return Padding( return Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0), padding: const EdgeInsets.symmetric(vertical: 4.0),
child: Opacity( child: Opacity(
opacity: widget.isUnsupported && opacity: widget.isUnsupported &&
widget._managerAPI.isVersionCompatibilityCheckEnabled() == false widget._managerAPI.isVersionCompatibilityCheckEnabled() == true
? 0.5 ? 0.5
: 1, : 1,
child: CustomCard( child: CustomCard(
@ -65,7 +66,7 @@ class _PatchItemState extends State<PatchItem> {
), ),
onTap: () { onTap: () {
if (widget.isUnsupported && if (widget.isUnsupported &&
!widget._managerAPI.isVersionCompatibilityCheckEnabled()) { widget._managerAPI.isVersionCompatibilityCheckEnabled()) {
widget.isSelected = false; widget.isSelected = false;
widget.toast.showBottom('patchItem.unsupportedPatchVersion'); widget.toast.showBottom('patchItem.unsupportedPatchVersion');
} else if (widget.isChangeEnabled) { } else if (widget.isChangeEnabled) {
@ -79,7 +80,7 @@ class _PatchItemState extends State<PatchItem> {
setState(() {}); setState(() {});
} }
if (!widget.isUnsupported || if (!widget.isUnsupported ||
widget._managerAPI.isVersionCompatibilityCheckEnabled()) { !widget._managerAPI.isVersionCompatibilityCheckEnabled()) {
widget.onChanged(widget.isSelected); widget.onChanged(widget.isSelected);
} }
}, },
@ -98,7 +99,8 @@ class _PatchItemState extends State<PatchItem> {
), ),
onChanged: (newValue) { onChanged: (newValue) {
if (widget.isUnsupported && if (widget.isUnsupported &&
!widget._managerAPI.isVersionCompatibilityCheckEnabled()) { widget._managerAPI
.isVersionCompatibilityCheckEnabled()) {
widget.isSelected = false; widget.isSelected = false;
widget.toast.showBottom( widget.toast.showBottom(
'patchItem.unsupportedPatchVersion', 'patchItem.unsupportedPatchVersion',
@ -114,7 +116,8 @@ class _PatchItemState extends State<PatchItem> {
setState(() {}); setState(() {});
} }
if (!widget.isUnsupported || if (!widget.isUnsupported ||
widget._managerAPI.isVersionCompatibilityCheckEnabled()) { !widget._managerAPI
.isVersionCompatibilityCheckEnabled()) {
widget.onChanged(widget.isSelected); widget.onChanged(widget.isSelected);
} }
}, },
@ -154,7 +157,7 @@ class _PatchItemState extends State<PatchItem> {
runSpacing: 4, runSpacing: 4,
children: [ children: [
if (widget.isUnsupported && if (widget.isUnsupported &&
widget._managerAPI !widget._managerAPI
.isVersionCompatibilityCheckEnabled()) .isVersionCompatibilityCheckEnabled())
Padding( Padding(
padding: const EdgeInsets.only(top: 8), padding: const EdgeInsets.only(top: 8),

View File

@ -4,7 +4,7 @@ homepage: https://github.com/revanced/revanced-manager
publish_to: 'none' publish_to: 'none'
version: 1.13.0+101300000 version: 1.13.1+101300100
environment: environment:
sdk: '>=3.0.0 <4.0.0' sdk: '>=3.0.0 <4.0.0'