diff --git a/assets/i18n/en_US.json b/assets/i18n/en_US.json index 3666ecc4..2bdb43db 100644 --- a/assets/i18n/en_US.json +++ b/assets/i18n/en_US.json @@ -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", diff --git a/lib/services/manager_api.dart b/lib/services/manager_api.dart index 21b0b611..afb7f839 100644 --- a/lib/services/manager_api.dart +++ b/lib/services/manager_api.dart @@ -98,6 +98,14 @@ class ManagerAPI { await _prefs.setBool('crashlyticsEnabled', value); } + Future 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 getPatchedApps() { List apps = _prefs.getStringList('patchedApps') ?? []; return apps.map((a) => PatchedApplication.fromJson(jsonDecode(a))).toList(); diff --git a/lib/ui/views/settings/settings_view.dart b/lib/ui/views/settings/settings_view.dart index c0933e3b..a1c802ac 100644 --- a/lib/ui/views/settings/settings_view.dart +++ b/lib/ui/views/settings/settings_view.dart @@ -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, diff --git a/lib/ui/views/settings/settings_viewmodel.dart b/lib/ui/views/settings/settings_viewmodel.dart index 347e468d..11e37852 100644 --- a/lib/ui/views/settings/settings_viewmodel.dart +++ b/lib/ui/views/settings/settings_viewmodel.dart @@ -337,6 +337,12 @@ class SettingsViewModel extends BaseViewModel { notifyListeners(); } + void deleteKeystore() { + _managerAPI.deleteKeystore(); + _toast.showBottom('settingsView.deletedKeystore'); + notifyListeners(); + } + Future getSdkVersion() async { AndroidDeviceInfo info = await DeviceInfoPlugin().androidInfo; return info.version.sdkInt ?? -1;