Change how external QR code scanning works (#19743)
This commit is contained in:
parent
208bfebc12
commit
553230ca23
|
@ -35,13 +35,22 @@ interface EMOutgoingMessageConfigGet extends EMMessage {
|
|||
type: "config/get";
|
||||
}
|
||||
|
||||
interface EMOutgoingMessageScanQRCode extends EMMessage {
|
||||
type: "qr_code/scan";
|
||||
interface EMOutgoingMessageBarCodeScan extends EMMessage {
|
||||
type: "bar_code/scan";
|
||||
title: string;
|
||||
description: string;
|
||||
alternative_option_label?: string;
|
||||
}
|
||||
|
||||
interface EMOutgoingMessageBarCodeClose extends EMMessage {
|
||||
type: "bar_code/close";
|
||||
}
|
||||
|
||||
interface EMOutgoingMessageBarCodeNotify extends EMMessage {
|
||||
type: "bar_code/notify";
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface EMOutgoingMessageMatterCommission extends EMMessage {
|
||||
type: "matter/commission";
|
||||
}
|
||||
|
@ -55,13 +64,6 @@ type EMOutgoingMessageWithAnswer = {
|
|||
request: EMOutgoingMessageConfigGet;
|
||||
response: ExternalConfig;
|
||||
};
|
||||
"qr_code/scan": {
|
||||
request: EMOutgoingMessageScanQRCode;
|
||||
response:
|
||||
| EMIncomingMessageQRCodeResponseCanceled
|
||||
| EMIncomingMessageQRCodeResponseAlternativeOptions
|
||||
| EMIncomingMessageQRCodeResponseScanResult;
|
||||
};
|
||||
};
|
||||
|
||||
interface EMOutgoingMessageExoplayerPlayHLS extends EMMessage {
|
||||
|
@ -124,20 +126,23 @@ interface EMOutgoingMessageAssistShow extends EMMessage {
|
|||
}
|
||||
|
||||
type EMOutgoingMessageWithoutAnswer =
|
||||
| EMOutgoingMessageHaptic
|
||||
| EMOutgoingMessageConnectionStatus
|
||||
| EMMessageResultError
|
||||
| EMMessageResultSuccess
|
||||
| EMOutgoingMessageAppConfiguration
|
||||
| EMOutgoingMessageTagWrite
|
||||
| EMOutgoingMessageSidebarShow
|
||||
| EMOutgoingMessageAssistShow
|
||||
| EMOutgoingMessageBarCodeClose
|
||||
| EMOutgoingMessageBarCodeNotify
|
||||
| EMOutgoingMessageBarCodeScan
|
||||
| EMOutgoingMessageConnectionStatus
|
||||
| EMOutgoingMessageExoplayerPlayHLS
|
||||
| EMOutgoingMessageExoplayerResize
|
||||
| EMOutgoingMessageExoplayerStop
|
||||
| EMOutgoingMessageThemeUpdate
|
||||
| EMMessageResultSuccess
|
||||
| EMMessageResultError
|
||||
| EMOutgoingMessageHaptic
|
||||
| EMOutgoingMessageImportThreadCredentials
|
||||
| EMOutgoingMessageMatterCommission
|
||||
| EMOutgoingMessageImportThreadCredentials;
|
||||
| EMOutgoingMessageSidebarShow
|
||||
| EMOutgoingMessageTagWrite
|
||||
| EMOutgoingMessageThemeUpdate;
|
||||
|
||||
interface EMIncomingMessageRestart {
|
||||
id: number;
|
||||
|
@ -172,17 +177,39 @@ interface EMIncomingMessageShowAutomationEditor {
|
|||
};
|
||||
}
|
||||
|
||||
export interface EMIncomingMessageQRCodeResponseCanceled {
|
||||
action: "canceled";
|
||||
export interface EMIncomingMessageBarCodeScanResult {
|
||||
id: number;
|
||||
type: "command";
|
||||
command: "bar_code/scan_result";
|
||||
payload: {
|
||||
// A string decoded from the barcode data.
|
||||
rawValue: string;
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Barcode_Detection_API#supported_barcode_formats
|
||||
format:
|
||||
| "aztec"
|
||||
| "code_128"
|
||||
| "code_39"
|
||||
| "code_93"
|
||||
| "codabar"
|
||||
| "data_matrix"
|
||||
| "ean_13"
|
||||
| "ean_8"
|
||||
| "itf"
|
||||
| "pdf417"
|
||||
| "qr_code"
|
||||
| "upc_a"
|
||||
| "upc_e"
|
||||
| "unknown";
|
||||
};
|
||||
}
|
||||
|
||||
export interface EMIncomingMessageQRCodeResponseAlternativeOptions {
|
||||
action: "alternative_options";
|
||||
}
|
||||
|
||||
export interface EMIncomingMessageQRCodeResponseScanResult {
|
||||
action: "scan_result";
|
||||
result: string;
|
||||
export interface EMIncomingMessageBarCodeScanAborted {
|
||||
id: number;
|
||||
type: "command";
|
||||
command: "bar_code/aborted";
|
||||
payload: {
|
||||
reason: "canceled" | "alternative_options";
|
||||
};
|
||||
}
|
||||
|
||||
export type EMIncomingMessageCommands =
|
||||
|
@ -190,7 +217,9 @@ export type EMIncomingMessageCommands =
|
|||
| EMIncomingMessageShowNotifications
|
||||
| EMIncomingMessageToggleSidebar
|
||||
| EMIncomingMessageShowSidebar
|
||||
| EMIncomingMessageShowAutomationEditor;
|
||||
| EMIncomingMessageShowAutomationEditor
|
||||
| EMIncomingMessageBarCodeScanResult
|
||||
| EMIncomingMessageBarCodeScanAborted;
|
||||
|
||||
type EMIncomingMessage =
|
||||
| EMMessageResultSuccess
|
||||
|
@ -207,7 +236,7 @@ export interface ExternalConfig {
|
|||
canCommissionMatter: boolean;
|
||||
canImportThreadCredentials: boolean;
|
||||
hasAssist: boolean;
|
||||
hasQRScanner: number;
|
||||
hasBarCodeScanner: number;
|
||||
}
|
||||
|
||||
export class ExternalMessaging {
|
||||
|
|
Loading…
Reference in New Issue