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 ### Bug Fixes
- Fixed Android service mode - Fixed Android service mode
- Fixed QR code scanner not scanning deep links
## [0.13.4.dev] - 2023-1-4 ## [0.13.4.dev] - 2023-1-4

View File

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