Fix qr scanner links

This commit is contained in:
problematicconsumer
2024-01-06 13:36:40 +03:30
parent e6ad5cfd1f
commit cffae11df4
2 changed files with 12 additions and 5 deletions

View File

@@ -12,6 +12,7 @@
### Bug Fixes
- Fixed Android service mode
- Fixed QR code scanner not scanning deep links
## [0.13.4.dev] - 2023-1-4

View File

@@ -77,11 +77,17 @@ class QRCodeScannerScreen extends HookConsumerWidget with PresLogger {
MobileScanner(
controller: controller,
onDetect: (capture) {
final data = capture.barcodes.first;
if (context.mounted && data.type == BarcodeType.url) {
loggy.debug('captured raw: [${data.rawValue}]');
loggy.debug('captured url: [${data.url?.url}]');
Navigator.of(context, rootNavigator: true).pop(data.url?.url);
final rawData = capture.barcodes.first.rawValue;
loggy.debug('captured raw: [$rawData]');
if (rawData != null) {
final uri = Uri.tryParse(rawData);
if (context.mounted && uri != null) {
loggy.debug('captured url: [$uri]');
Navigator.of(context, rootNavigator: true)
.pop(uri.toString());
}
} else {
loggy.warning("unable to capture");
}
},
errorBuilder: (_, error, __) {