fix(backups): Resolve backups encryption key on loading state

- Resolves #543
This commit is contained in:
NaiJi 2024-08-06 21:18:01 +04:00 committed by Inex Code
parent eb67c70fa0
commit 76821aeec5
2 changed files with 6 additions and 1 deletions

View file

@ -24,6 +24,8 @@ sealed class BackupsState extends Equatable {
AutobackupQuotas? get autobackupQuotas => null; AutobackupQuotas? get autobackupQuotas => null;
String? get encryptionKey => null;
BackupsState copyWith({required final BackblazeBucket backblazeBucket}); BackupsState copyWith({required final BackblazeBucket backblazeBucket});
} }
@ -114,6 +116,9 @@ class BackupsInitialized extends BackupsState {
@override @override
AutobackupQuotas? get autobackupQuotas => _backupConfig?.autobackupQuotas; AutobackupQuotas? get autobackupQuotas => _backupConfig?.autobackupQuotas;
@override
String? get encryptionKey => _backupConfig?.encryptionKey;
@override @override
Duration? get autobackupPeriod => Duration? get autobackupPeriod =>
_backupConfig?.autobackupPeriod?.inMinutes == 0 _backupConfig?.autobackupPeriod?.inMinutes == 0

View file

@ -34,7 +34,7 @@ class _CopyEncryptionKeyModalState extends State<CopyEncryptionKeyModal> {
@override @override
Widget build(final BuildContext context) { Widget build(final BuildContext context) {
final String? encryptionKey = final String? encryptionKey =
context.watch<BackupsBloc>().state.backblazeBucket?.encryptionKey; context.watch<BackupsBloc>().state.encryptionKey;
if (encryptionKey == null) { if (encryptionKey == null) {
return ListView( return ListView(
controller: widget.scrollController, controller: widget.scrollController,