Skip to content

Commit

Permalink
Fix qr scanner links
Browse files Browse the repository at this point in the history
  • Loading branch information
problematicconsumer committed Jan 6, 2024
1 parent e6ad5cf commit cffae11
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 11 additions & 5 deletions lib/features/common/qr_code_scanner_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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, __) {
Expand Down

0 comments on commit cffae11

Please sign in to comment.