-
-
Notifications
You must be signed in to change notification settings - Fork 776
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add option to import/export keystore (#776)
* feat: add option to import/export keystore * change the order of import/export keystore buttons * feat: add option to change the keystore password
- Loading branch information
Showing
8 changed files
with
193 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
lib/ui/views/settings/settingsFragment/settings_manage_keystore_password.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// ignore_for_file: use_build_context_synchronously | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_i18n/flutter_i18n.dart'; | ||
import 'package:revanced_manager/app/app.locator.dart'; | ||
import 'package:revanced_manager/services/manager_api.dart'; | ||
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart'; | ||
import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart'; | ||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; | ||
import 'package:stacked/stacked.dart'; | ||
|
||
class SManageKeystorePassword extends BaseViewModel { | ||
final ManagerAPI _managerAPI = locator<ManagerAPI>(); | ||
|
||
final TextEditingController _keystorePasswordController = TextEditingController(); | ||
|
||
Future<void> showKeystoreDialog(BuildContext context) async { | ||
final String keystorePasswordText = _managerAPI.getKeystorePassword(); | ||
_keystorePasswordController.text = keystorePasswordText; | ||
return showDialog( | ||
context: context, | ||
builder: (context) => AlertDialog( | ||
title: Row( | ||
children: <Widget>[ | ||
I18nText('settingsView.selectKeystorePassword'), | ||
const Spacer(), | ||
IconButton( | ||
icon: const Icon(Icons.manage_history_outlined), | ||
onPressed: () =>_keystorePasswordController.text = _managerAPI.defaultKeystorePassword, | ||
color: Theme.of(context).colorScheme.secondary, | ||
) | ||
], | ||
), | ||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer, | ||
content: SingleChildScrollView( | ||
child: Column( | ||
children: <Widget>[ | ||
CustomTextField( | ||
inputController: _keystorePasswordController, | ||
label: I18nText('settingsView.selectKeystorePassword'), | ||
hint: "", | ||
onChanged: (value) => notifyListeners(), | ||
), | ||
], | ||
), | ||
), | ||
actions: <Widget>[ | ||
CustomMaterialButton( | ||
isFilled: false, | ||
label: I18nText('cancelButton'), | ||
onPressed: () { | ||
_keystorePasswordController.clear(); | ||
Navigator.of(context).pop(); | ||
}, | ||
), | ||
CustomMaterialButton( | ||
label: I18nText('okButton'), | ||
onPressed: () { | ||
String passwd = _keystorePasswordController.text; | ||
_managerAPI.setKeystorePassword(passwd); | ||
Navigator.of(context).pop(); | ||
}, | ||
) | ||
], | ||
), | ||
); | ||
} | ||
} | ||
|
||
final sManageKeystorePassword = SManageKeystorePassword(); | ||
|
||
class SManageKeystorePasswordUI extends StatelessWidget { | ||
const SManageKeystorePasswordUI({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SettingsTileDialog( | ||
padding: const EdgeInsets.symmetric(horizontal: 20.0), | ||
title: 'settingsView.selectKeystorePassword', | ||
subtitle: 'settingsView.selectKeystorePasswordHint', | ||
onTap: () => sManageKeystorePassword.showKeystoreDialog(context), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters