pop until the users was verified

This commit is contained in:
otsmr 2026-07-09 20:43:37 +02:00
parent dfa6ac2cfe
commit 48be46cf47
2 changed files with 13 additions and 0 deletions

View file

@ -54,6 +54,7 @@ class ScannedNewProfile {
class MainCameraController {
void Function()? setState;
void Function(Contact contact)? onVerificationSuccessDismissed;
CameraController? cameraController;
ScreenshotController screenshotController = ScreenshotController();
SelectedCameraDetails selectedCameraDetails = SelectedCameraDetails();
@ -556,6 +557,7 @@ class MainCameraController {
final context = cameraPreviewKey.currentContext;
if (verificationOk && context != null && context.mounted) {
await VerificationSuccessDialog.show(context, contact);
onVerificationSuccessDismissed?.call(contact);
}
}
continue;

View file

@ -31,6 +31,17 @@ class QrCodeScannerViewState extends State<QrCodeScannerView> {
_mainCameraController.setState = () {
if (mounted) setState(() {});
};
if (widget.openToVerify && widget.contact != null) {
_mainCameraController.onVerificationSuccessDismissed = (contact) {
if (mounted) {
Navigator.popUntil(context, (route) {
final name = route.settings.name;
if (name == null) return true;
return !name.contains('qr_scanner') && !name.contains('verifybadge');
});
}
};
}
Permission.camera.isGranted.then((hasPermission) {
if (hasPermission && mounted) {
unawaited(_mainCameraController.selectCamera(0, true));