mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 04:37:37 +02:00
refactor: cleanup remember patches feature (#630)
This commit is contained in:
@ -42,7 +42,6 @@ class AppSelectorViewModel extends BaseViewModel {
|
||||
patchDate: DateTime.now(),
|
||||
);
|
||||
locator<PatcherViewModel>().loadLastSelectedPatches();
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> selectAppFromStorage(BuildContext context) async {
|
||||
@ -78,7 +77,6 @@ class AppSelectorViewModel extends BaseViewModel {
|
||||
isFromStorage: true,
|
||||
);
|
||||
locator<PatcherViewModel>().loadLastSelectedPatches();
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
}
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
|
@ -114,8 +114,7 @@ class PatcherViewModel extends BaseViewModel {
|
||||
await _managerAPI.getSelectedPatches(selectedApp!.originalPackageName);
|
||||
List<Patch> patches =
|
||||
_patcherAPI.getFilteredPatches(selectedApp!.originalPackageName);
|
||||
this
|
||||
.selectedPatches
|
||||
this.selectedPatches
|
||||
.addAll(patches.where((patch) => selectedPatches.contains(patch.name)));
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -80,9 +80,9 @@ class SettingsViewModel extends BaseViewModel {
|
||||
await CRFileSaver.saveFileWithDialog(SaveFileDialogParams(
|
||||
sourceFilePath: tempFilePath, destinationFileName: ''));
|
||||
File(tempFilePath).delete();
|
||||
locator<Toast>().showBottom('settingsView.exportedPatches');
|
||||
_toast.showBottom('settingsView.exportedPatches');
|
||||
} else {
|
||||
locator<Toast>().showBottom('settingsView.noExportFileFound');
|
||||
_toast.showBottom('settingsView.noExportFileFound');
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s);
|
||||
@ -97,20 +97,16 @@ class SettingsViewModel extends BaseViewModel {
|
||||
);
|
||||
if (result != null && result.files.single.path != null) {
|
||||
File inFile = File(result.files.single.path!);
|
||||
final File storedPatchesFile = File(_managerAPI.storedPatchesFile);
|
||||
if (!storedPatchesFile.existsSync()) {
|
||||
storedPatchesFile.createSync(recursive: true);
|
||||
}
|
||||
inFile.copySync(storedPatchesFile.path);
|
||||
inFile.copySync(_managerAPI.storedPatchesFile);
|
||||
inFile.delete();
|
||||
if (locator<PatcherViewModel>().selectedApp != null) {
|
||||
locator<PatcherViewModel>().loadLastSelectedPatches();
|
||||
}
|
||||
locator<Toast>().showBottom('settingsView.importedPatches');
|
||||
_toast.showBottom('settingsView.importedPatches');
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
locator<Toast>().showBottom('settingsView.jsonSelectorErrorMessage');
|
||||
_toast.showBottom('settingsView.jsonSelectorErrorMessage');
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user