forked from jsnbuchanan/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>
|
<div>
|
||||||
<h3 class="text-lg font-medium text-gray-900">Scan QR Code</h3>
|
<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>
|
</div>
|
||||||
<button
|
<button
|
||||||
class="text-gray-400 hover:text-gray-500"
|
class="text-gray-400 hover:text-gray-500"
|
||||||
@@ -197,6 +197,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="debugMessage" class="bg-yellow-200 text-black p-2 m-2 rounded">
|
||||||
|
{{ debugMessage }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -251,6 +255,7 @@ export default class QRScannerDialog extends Vue {
|
|||||||
preferredCamera: "user" | "environment" = "environment";
|
preferredCamera: "user" | "environment" = "environment";
|
||||||
initializationStatus = "Checking camera access...";
|
initializationStatus = "Checking camera access...";
|
||||||
cameraStatus = "Initializing";
|
cameraStatus = "Initializing";
|
||||||
|
debugMessage = "";
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
logger.log("QRScannerDialog platform detection:", {
|
logger.log("QRScannerDialog platform detection:", {
|
||||||
@@ -274,11 +279,8 @@ export default class QRScannerDialog extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async onInit(promise: Promise<void>, attempt = 1): Promise<void> {
|
async onInit(promise: Promise<void>, attempt = 1): Promise<void> {
|
||||||
if (this.isNativePlatform) return;
|
alert("onInit called, attempt: " + attempt);
|
||||||
this.isInitializing = true;
|
this.debugMessage = "onInit called, attempt: " + attempt;
|
||||||
this.error = null;
|
|
||||||
this.initializationStatus = "Checking camera access...";
|
|
||||||
|
|
||||||
let timeoutHit = false;
|
let timeoutHit = false;
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
timeoutHit = true;
|
timeoutHit = true;
|
||||||
@@ -286,6 +288,7 @@ export default class QRScannerDialog extends Vue {
|
|||||||
this.cameraStatus = "Ready (timeout fallback)";
|
this.cameraStatus = "Ready (timeout fallback)";
|
||||||
this.initializationStatus = "Camera ready (fallback)";
|
this.initializationStatus = "Camera ready (fallback)";
|
||||||
alert("Timeout fallback triggered");
|
alert("Timeout fallback triggered");
|
||||||
|
this.debugMessage = "Timeout fallback triggered";
|
||||||
}, 4000);
|
}, 4000);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -294,9 +297,13 @@ export default class QRScannerDialog extends Vue {
|
|||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
this.isInitializing = false;
|
this.isInitializing = false;
|
||||||
this.cameraStatus = "Ready";
|
this.cameraStatus = "Ready";
|
||||||
|
alert("Promise resolved before timeout");
|
||||||
|
this.debugMessage = "Promise resolved before timeout";
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
|
alert("Promise rejected: " + (error instanceof Error ? error.message : error));
|
||||||
|
this.debugMessage = "Promise rejected: " + (error instanceof Error ? error.message : error);
|
||||||
if (attempt < 3) {
|
if (attempt < 3) {
|
||||||
// Retry after a short delay
|
// Retry after a short delay
|
||||||
setTimeout(() => this.onInit(promise, attempt + 1), 1500);
|
setTimeout(() => this.onInit(promise, attempt + 1), 1500);
|
||||||
|
|||||||
Reference in New Issue
Block a user