diff --git a/src/views/ContactQRScanShowView.vue b/src/views/ContactQRScanShowView.vue index c1bb9823..6a39410d 100644 --- a/src/views/ContactQRScanShowView.vue +++ b/src/views/ContactQRScanShowView.vue @@ -83,12 +83,20 @@ >
- Start Scanning - + +
{{ error }} @@ -96,6 +104,14 @@ permissions. + + + @@ -104,9 +120,11 @@ import { AxiosError } from "axios"; import QRCodeVue3 from "qr-code-generator-vue3"; import { Component, Vue } from "vue-facing-decorator"; import { useClipboard } from "@vueuse/core"; +import { Capacitor } from "@capacitor/core"; import QuickNav from "../components/QuickNav.vue"; import UserNameDialog from "../components/UserNameDialog.vue"; +import QRScannerDialog from "../components/QRScanner/QRScannerDialog.vue"; import { NotificationIface } from "../constants/app"; import { db, retrieveSettingsForActiveAccount } from "../db/index"; import { Contact } from "../db/tables/contacts"; @@ -137,6 +155,7 @@ interface IUserNameDialog { QRCodeVue3, QuickNav, UserNameDialog, + QRScannerDialog, }, }) export default class ContactQRScanShow extends Vue { @@ -151,6 +170,8 @@ export default class ContactQRScanShow extends Vue { qrValue = ""; isScanning = false; error: string | null = null; + showScannerDialog = false; + isNativePlatform = Capacitor.isNativePlatform(); ETHR_DID_PREFIX = ETHR_DID_PREFIX; @@ -251,7 +272,13 @@ export default class ContactQRScanShow extends Vue { } } - // Add scan listener + // Show the scanner dialog for web + if (!this.isNativePlatform) { + this.showScannerDialog = true; + return; + } + + // For native platforms, use the scanner service scanner.addListener({ onScan: this.onScanDetect, onError: this.onScanError, @@ -574,6 +601,11 @@ export default class ContactQRScanShow extends Vue { }); } + closeScannerDialog() { + this.showScannerDialog = false; + this.isScanning = false; + } + // Lifecycle hooks mounted() { this.isMounted = true;