mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-07-18 02:24:07 +00:00
pop until the users was verified
This commit is contained in:
parent
dfa6ac2cfe
commit
48be46cf47
2 changed files with 13 additions and 0 deletions
|
|
@ -54,6 +54,7 @@ class ScannedNewProfile {
|
||||||
|
|
||||||
class MainCameraController {
|
class MainCameraController {
|
||||||
void Function()? setState;
|
void Function()? setState;
|
||||||
|
void Function(Contact contact)? onVerificationSuccessDismissed;
|
||||||
CameraController? cameraController;
|
CameraController? cameraController;
|
||||||
ScreenshotController screenshotController = ScreenshotController();
|
ScreenshotController screenshotController = ScreenshotController();
|
||||||
SelectedCameraDetails selectedCameraDetails = SelectedCameraDetails();
|
SelectedCameraDetails selectedCameraDetails = SelectedCameraDetails();
|
||||||
|
|
@ -556,6 +557,7 @@ class MainCameraController {
|
||||||
final context = cameraPreviewKey.currentContext;
|
final context = cameraPreviewKey.currentContext;
|
||||||
if (verificationOk && context != null && context.mounted) {
|
if (verificationOk && context != null && context.mounted) {
|
||||||
await VerificationSuccessDialog.show(context, contact);
|
await VerificationSuccessDialog.show(context, contact);
|
||||||
|
onVerificationSuccessDismissed?.call(contact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,17 @@ class QrCodeScannerViewState extends State<QrCodeScannerView> {
|
||||||
_mainCameraController.setState = () {
|
_mainCameraController.setState = () {
|
||||||
if (mounted) 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) {
|
Permission.camera.isGranted.then((hasPermission) {
|
||||||
if (hasPermission && mounted) {
|
if (hasPermission && mounted) {
|
||||||
unawaited(_mainCameraController.selectCamera(0, true));
|
unawaited(_mainCameraController.selectCamera(0, true));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue