Skip to content

Commit

Permalink
TW-1766: handle case 404 when call get recovery key
Browse files Browse the repository at this point in the history
  • Loading branch information
sherlockvn committed Jul 15, 2024
1 parent 8323b47 commit f52b164
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
41 changes: 20 additions & 21 deletions lib/pages/bootstrap/bootstrap_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import 'package:matrix/encryption/utils/bootstrap.dart';
import 'package:matrix/matrix.dart';
import 'package:share_plus/share_plus.dart';

import '../key_verification/key_verification_dialog.dart';

class BootstrapDialog extends StatefulWidget {
final bool wipe;
final Client client;
Expand Down Expand Up @@ -333,25 +331,26 @@ class BootstrapDialogState extends State<BootstrapDialog> {
const Expanded(child: Divider()),
],
),
const SizedBox(height: 16),
ElevatedButton.icon(
icon: const Icon(Icons.cast_connected_outlined),
label: Text(L10n.of(context)!.transferFromAnotherDevice),
onPressed: _recoveryKeyInputLoading
? null
: () async {
final req = await TwakeDialog
.showFutureLoadingDialogFullScreen(
future: () => widget.client
.userDeviceKeys[widget.client.userID!]!
.startVerification(),
);
if (req.error != null) return;
await KeyVerificationDialog(request: req.result!)
.show(context);
Navigator.of(context, rootNavigator: false).pop();
},
),
// TODO: TW-1766: temporary disable right now, because not supported yet
// const SizedBox(height: 16),
// ElevatedButton.icon(
// icon: const Icon(Icons.cast_connected_outlined),
// label: Text(L10n.of(context)!.transferFromAnotherDevice),
// onPressed: _recoveryKeyInputLoading
// ? null
// : () async {
// final req = await TwakeDialog
// .showFutureLoadingDialogFullScreen(
// future: () => widget.client
// .userDeviceKeys[widget.client.userID!]!
// .startVerification(),
// );
// if (req.error != null) return;
// await KeyVerificationDialog(request: req.result!)
// .show(context);
// Navigator.of(context, rootNavigator: false).pop();
// },
// ),
const SizedBox(height: 16),
ElevatedButton.icon(
style: ElevatedButton.styleFrom(
Expand Down
7 changes: 4 additions & 3 deletions lib/pages/bootstrap/tom_bootstrap_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,10 @@ class TomBootstrapDialogState extends State<TomBootstrapDialog>
);
}
},
(success) => setState(
() => _uploadRecoveryKeyState = UploadRecoveryKeyState.initial,
),
(success) => setState(() {
_uploadRecoveryKeyState = UploadRecoveryKeyState.initial;
_createBootstrap();
}),
),
);
}
Expand Down

0 comments on commit f52b164

Please sign in to comment.