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",
"firebaseCrashlyticsLabel": "Firebase Crashlytics",
"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": {
"widgetTitle": "App Info",

View File

@ -98,6 +98,14 @@ class ManagerAPI {
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<String> apps = _prefs.getStringList('patchedApps') ?? [];
return apps.map((a) => PatchedApplication.fromJson(jsonDecode(a))).toList();

View File

@ -136,6 +136,22 @@ class SettingsView extends StatelessWidget {
subtitle: 'settingsView.sourcesLabelHint',
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,

View File

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