forked from trent_larson/crowd-funder-for-time-pwa
chore(qr): add visible debug output and version bump for device-side troubleshooting
- Bump version string in QRScannerDialog to include build number for cache-busting and verification - Add debugMessage UI panel to display internal state and debug info directly in the dialog - Add alert() and debugMessage updates at key points in QR scanner initialization for device-visible feedback
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
>
|
||||
<div>
|
||||
<h3 class="text-lg font-medium text-gray-900">Scan QR Code</h3>
|
||||
<span class="text-xs text-gray-500">v1.1.0</span>
|
||||
<span class="text-xs text-gray-500">v1.1.0 build 00000</span>
|
||||
</div>
|
||||
<button
|
||||
class="text-gray-400 hover:text-gray-500"
|
||||
@@ -197,6 +197,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="debugMessage" class="bg-yellow-200 text-black p-2 m-2 rounded">
|
||||
{{ debugMessage }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -251,6 +255,7 @@ export default class QRScannerDialog extends Vue {
|
||||
preferredCamera: "user" | "environment" = "environment";
|
||||
initializationStatus = "Checking camera access...";
|
||||
cameraStatus = "Initializing";
|
||||
debugMessage = "";
|
||||
|
||||
created() {
|
||||
logger.log("QRScannerDialog platform detection:", {
|
||||
@@ -274,11 +279,8 @@ export default class QRScannerDialog extends Vue {
|
||||
}
|
||||
|
||||
async onInit(promise: Promise<void>, attempt = 1): Promise<void> {
|
||||
if (this.isNativePlatform) return;
|
||||
this.isInitializing = true;
|
||||
this.error = null;
|
||||
this.initializationStatus = "Checking camera access...";
|
||||
|
||||
alert("onInit called, attempt: " + attempt);
|
||||
this.debugMessage = "onInit called, attempt: " + attempt;
|
||||
let timeoutHit = false;
|
||||
const timeout = setTimeout(() => {
|
||||
timeoutHit = true;
|
||||
@@ -286,6 +288,7 @@ export default class QRScannerDialog extends Vue {
|
||||
this.cameraStatus = "Ready (timeout fallback)";
|
||||
this.initializationStatus = "Camera ready (fallback)";
|
||||
alert("Timeout fallback triggered");
|
||||
this.debugMessage = "Timeout fallback triggered";
|
||||
}, 4000);
|
||||
|
||||
try {
|
||||
@@ -294,9 +297,13 @@ export default class QRScannerDialog extends Vue {
|
||||
clearTimeout(timeout);
|
||||
this.isInitializing = false;
|
||||
this.cameraStatus = "Ready";
|
||||
alert("Promise resolved before timeout");
|
||||
this.debugMessage = "Promise resolved before timeout";
|
||||
}
|
||||
} catch (error) {
|
||||
clearTimeout(timeout);
|
||||
alert("Promise rejected: " + (error instanceof Error ? error.message : error));
|
||||
this.debugMessage = "Promise rejected: " + (error instanceof Error ? error.message : error);
|
||||
if (attempt < 3) {
|
||||
// Retry after a short delay
|
||||
setTimeout(() => this.onInit(promise, attempt + 1), 1500);
|
||||
|
||||
Reference in New Issue
Block a user