Remove ContactScanView and rename ContactQRScanView to ContactQRScanFullView
- Deleted ContactScanView.vue and its route from the router. - Renamed ContactQRScanView.vue to ContactQRScanFullView.vue. - Updated all router paths, names, and references for consistency. - Fixed related links and imports to use the new view/component name.
This commit is contained in:
@@ -94,13 +94,13 @@ export class WebInlineQRScanner implements QRScannerService {
|
||||
// First try the Permissions API if available
|
||||
if (navigator.permissions && navigator.permissions.query) {
|
||||
try {
|
||||
const permissions = await navigator.permissions.query({
|
||||
name: "camera" as PermissionName,
|
||||
});
|
||||
logger.error(
|
||||
const permissions = await navigator.permissions.query({
|
||||
name: "camera" as PermissionName,
|
||||
});
|
||||
logger.error(
|
||||
`[WebInlineQRScanner:${this.id}] Permission state from Permissions API:`,
|
||||
permissions.state,
|
||||
);
|
||||
permissions.state,
|
||||
);
|
||||
if (permissions.state === "granted") {
|
||||
this.updateCameraState("ready", "Camera permissions granted");
|
||||
return true;
|
||||
@@ -121,7 +121,7 @@ export class WebInlineQRScanner implements QRScannerService {
|
||||
video: true,
|
||||
});
|
||||
// If we get here, we have permission
|
||||
testStream.getTracks().forEach(track => track.stop());
|
||||
testStream.getTracks().forEach((track) => track.stop());
|
||||
this.updateCameraState("ready", "Camera permissions granted");
|
||||
return true;
|
||||
} catch (mediaError) {
|
||||
@@ -133,8 +133,11 @@ export class WebInlineQRScanner implements QRScannerService {
|
||||
message: error.message,
|
||||
},
|
||||
);
|
||||
|
||||
if (error.name === "NotAllowedError" || error.name === "PermissionDeniedError") {
|
||||
|
||||
if (
|
||||
error.name === "NotAllowedError" ||
|
||||
error.name === "PermissionDeniedError"
|
||||
) {
|
||||
this.updateCameraState("permission_denied", "Camera access denied");
|
||||
return false;
|
||||
}
|
||||
@@ -193,26 +196,26 @@ export class WebInlineQRScanner implements QRScannerService {
|
||||
);
|
||||
|
||||
try {
|
||||
const stream = await navigator.mediaDevices.getUserMedia({
|
||||
video: {
|
||||
facingMode: "environment",
|
||||
width: { ideal: 1280 },
|
||||
height: { ideal: 720 },
|
||||
},
|
||||
});
|
||||
|
||||
this.updateCameraState("ready", "Camera permissions granted");
|
||||
|
||||
// Stop the test stream immediately
|
||||
stream.getTracks().forEach((track) => {
|
||||
logger.error(`[WebInlineQRScanner:${this.id}] Stopping test track:`, {
|
||||
kind: track.kind,
|
||||
label: track.label,
|
||||
readyState: track.readyState,
|
||||
const stream = await navigator.mediaDevices.getUserMedia({
|
||||
video: {
|
||||
facingMode: "environment",
|
||||
width: { ideal: 1280 },
|
||||
height: { ideal: 720 },
|
||||
},
|
||||
});
|
||||
track.stop();
|
||||
});
|
||||
return true;
|
||||
|
||||
this.updateCameraState("ready", "Camera permissions granted");
|
||||
|
||||
// Stop the test stream immediately
|
||||
stream.getTracks().forEach((track) => {
|
||||
logger.error(`[WebInlineQRScanner:${this.id}] Stopping test track:`, {
|
||||
kind: track.kind,
|
||||
label: track.label,
|
||||
readyState: track.readyState,
|
||||
});
|
||||
track.stop();
|
||||
});
|
||||
return true;
|
||||
} catch (mediaError) {
|
||||
const error = mediaError as Error;
|
||||
logger.error(
|
||||
@@ -224,31 +227,31 @@ export class WebInlineQRScanner implements QRScannerService {
|
||||
},
|
||||
);
|
||||
|
||||
// Update state based on error type
|
||||
if (
|
||||
// Update state based on error type
|
||||
if (
|
||||
error.name === "NotFoundError" ||
|
||||
error.name === "DevicesNotFoundError"
|
||||
) {
|
||||
this.updateCameraState("not_found", "No camera found on this device");
|
||||
throw new Error("No camera found on this device");
|
||||
} else if (
|
||||
) {
|
||||
this.updateCameraState("not_found", "No camera found on this device");
|
||||
throw new Error("No camera found on this device");
|
||||
} else if (
|
||||
error.name === "NotAllowedError" ||
|
||||
error.name === "PermissionDeniedError"
|
||||
) {
|
||||
this.updateCameraState("permission_denied", "Camera access denied");
|
||||
throw new Error(
|
||||
"Camera access denied. Please grant camera permission and try again",
|
||||
);
|
||||
} else if (
|
||||
) {
|
||||
this.updateCameraState("permission_denied", "Camera access denied");
|
||||
throw new Error(
|
||||
"Camera access denied. Please grant camera permission and try again",
|
||||
);
|
||||
} else if (
|
||||
error.name === "NotReadableError" ||
|
||||
error.name === "TrackStartError"
|
||||
) {
|
||||
this.updateCameraState(
|
||||
"in_use",
|
||||
"Camera is in use by another application",
|
||||
);
|
||||
throw new Error("Camera is in use by another application");
|
||||
} else {
|
||||
) {
|
||||
this.updateCameraState(
|
||||
"in_use",
|
||||
"Camera is in use by another application",
|
||||
);
|
||||
throw new Error("Camera is in use by another application");
|
||||
} else {
|
||||
this.updateCameraState("error", error.message);
|
||||
throw new Error(`Camera error: ${error.message}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user