feat: ability to delete keystores.

This commit is contained in:
Aunali321 2022-10-17 00:22:07 +05:30
parent 331691cc9d
commit 9de063aced
4 changed files with 34 additions and 1 deletions

View file

@ -136,7 +136,10 @@
"sentryHint": "Send anonymous logs to help us improve ReVanced Manager", "sentryHint": "Send anonymous logs to help us improve ReVanced Manager",
"firebaseCrashlyticsLabel": "Firebase Crashlytics", "firebaseCrashlyticsLabel": "Firebase Crashlytics",
"firebaseCrashlyticsHint": "Send anonymous crash reports to help us improve ReVanced Manager", "firebaseCrashlyticsHint": "Send anonymous crash reports to help us improve ReVanced Manager",
"restartAppForChanges": "Restart the app to apply changes" "restartAppForChanges": "Restart the app to apply changes",
"deleteKeystoreLabel": "Delete keystore",
"deleteKeystoreHint": "Delete the keystore used to sign the app",
"deletedKeystore": "Keystore deleted"
}, },
"appInfoView": { "appInfoView": {
"widgetTitle": "App Info", "widgetTitle": "App Info",

View file

@ -98,6 +98,14 @@ class ManagerAPI {
await _prefs.setBool('crashlyticsEnabled', value); await _prefs.setBool('crashlyticsEnabled', value);
} }
Future<void> deleteKeystore() async {
final File keystore = File(
'/sdcard/Android/data/app.revanced.manager.flutter/files/revanced-keystore.keystore');
if (await keystore.exists()) {
await keystore.delete();
}
}
List<PatchedApplication> getPatchedApps() { List<PatchedApplication> getPatchedApps() {
List<String> apps = _prefs.getStringList('patchedApps') ?? []; List<String> apps = _prefs.getStringList('patchedApps') ?? [];
return apps.map((a) => PatchedApplication.fromJson(jsonDecode(a))).toList(); return apps.map((a) => PatchedApplication.fromJson(jsonDecode(a))).toList();

View file

@ -136,6 +136,22 @@ class SettingsView extends StatelessWidget {
subtitle: 'settingsView.sourcesLabelHint', subtitle: 'settingsView.sourcesLabelHint',
onTap: () => model.showSourcesDialog(context), onTap: () => model.showSourcesDialog(context),
), ),
ListTile(
contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'settingsView.deleteKeystoreLabel',
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText('settingsView.deleteKeystoreHint'),
onTap: () => model.deleteKeystore,
),
], ],
), ),
_settingsDivider, _settingsDivider,

View file

@ -337,6 +337,12 @@ class SettingsViewModel extends BaseViewModel {
notifyListeners(); notifyListeners();
} }
void deleteKeystore() {
_managerAPI.deleteKeystore();
_toast.showBottom('settingsView.deletedKeystore');
notifyListeners();
}
Future<int> getSdkVersion() async { Future<int> getSdkVersion() async {
AndroidDeviceInfo info = await DeviceInfoPlugin().androidInfo; AndroidDeviceInfo info = await DeviceInfoPlugin().androidInfo;
return info.version.sdkInt ?? -1; return info.version.sdkInt ?? -1;