feat(scanner): complete localized artifact quality checkpoint
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { useCallback } from "react";
|
||||
import type { CaptureOptions, CaptureResult } from "../../../types/global";
|
||||
import { captureSelectedSourceAction, exportCurrentGoodAction, loadStoredArtifactSnapshotAction, refreshCaptureSourcesAction, runDemoScanAction, showOverlayAction } from "../services/appControllerService";
|
||||
import { captureSelectedSourceAction, exportCurrentGoodAction, hideOverlayAction, loadStoredArtifactSnapshotAction, refreshCaptureSourcesAction, runDemoScanAction, showOverlayAction } from "../services/appControllerService";
|
||||
import type { AppControllerContext } from "../services/appControllerService";
|
||||
import { useToast } from "../../feedback";
|
||||
|
||||
interface AppControllerActionsInput {
|
||||
appControllerContext: AppControllerContext;
|
||||
@@ -14,11 +15,13 @@ export interface AppControllerActionsResult {
|
||||
runDemoScan: () => Promise<void>;
|
||||
exportCurrentGood: () => Promise<void>;
|
||||
showOverlay: () => Promise<void>;
|
||||
hideOverlay: () => Promise<void>;
|
||||
}
|
||||
|
||||
export function useAppControllerActions({
|
||||
appControllerContext,
|
||||
}: AppControllerActionsInput): AppControllerActionsResult {
|
||||
const toast = useToast();
|
||||
const loadStoredArtifactSnapshot = useCallback(async () => {
|
||||
await loadStoredArtifactSnapshotAction(appControllerContext);
|
||||
}, [appControllerContext]);
|
||||
@@ -40,8 +43,22 @@ export function useAppControllerActions({
|
||||
}, [appControllerContext]);
|
||||
|
||||
const showOverlay = useCallback(async () => {
|
||||
await showOverlayAction(appControllerContext);
|
||||
}, [appControllerContext]);
|
||||
const result = await showOverlayAction(appControllerContext);
|
||||
if (result.ok) {
|
||||
toast.success("Overlay geoeffnet", { description: "Die schreibgeschuetzte Ergebnis-Karte ist jetzt sichtbar." });
|
||||
} else {
|
||||
toast.error("Overlay konnte nicht geoeffnet werden", { description: "Pruefe die Desktop-App-Verbindung und versuche es erneut." });
|
||||
}
|
||||
}, [appControllerContext, toast]);
|
||||
|
||||
const hideOverlay = useCallback(async () => {
|
||||
const result = await hideOverlayAction(appControllerContext);
|
||||
if (result.ok) {
|
||||
toast.success("Overlay geschlossen");
|
||||
} else {
|
||||
toast.error("Overlay konnte nicht geschlossen werden", { description: "Es ist kein aktives Overlay vorhanden oder die App-Verbindung fehlt." });
|
||||
}
|
||||
}, [appControllerContext, toast]);
|
||||
|
||||
return {
|
||||
loadStoredArtifactSnapshot,
|
||||
@@ -50,5 +67,6 @@ export function useAppControllerActions({
|
||||
runDemoScan,
|
||||
exportCurrentGood,
|
||||
showOverlay,
|
||||
hideOverlay,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user