Skip to content

Commit

Permalink
Allow mobile apps to provide QR code functionality (#19570)
Browse files Browse the repository at this point in the history
* Add QR code scanner to external bus

* Make `hasQRScanner` a version number
  • Loading branch information
balloob authored Jan 31, 2024
1 parent 8acae63 commit b728b9e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/external_app/external_messaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ interface EMOutgoingMessageConfigGet extends EMMessage {
type: "config/get";
}

interface EMOutgoingMessageScanQRCode extends EMMessage {
type: "qr_code/scan";
title: string;
description: string;
alternative_option_label?: string;
}

interface EMOutgoingMessageMatterCommission extends EMMessage {
type: "matter/commission";
}
Expand All @@ -48,6 +55,13 @@ type EMOutgoingMessageWithAnswer = {
request: EMOutgoingMessageConfigGet;
response: ExternalConfig;
};
"qr_code/scan": {
request: EMOutgoingMessageScanQRCode;
response:
| EMIncomingMessageQRCodeResponseCanceled
| EMIncomingMessageQRCodeResponseAlternativeOptions
| EMIncomingMessageQRCodeResponseScanResult;
};
};

interface EMOutgoingMessageExoplayerPlayHLS extends EMMessage {
Expand Down Expand Up @@ -158,6 +172,19 @@ interface EMIncomingMessageShowAutomationEditor {
};
}

export interface EMIncomingMessageQRCodeResponseCanceled {
action: "canceled";
}

export interface EMIncomingMessageQRCodeResponseAlternativeOptions {
action: "alternative_options";
}

export interface EMIncomingMessageQRCodeResponseScanResult {
action: "scan_result";
result: string;
}

export type EMIncomingMessageCommands =
| EMIncomingMessageRestart
| EMIncomingMessageShowNotifications
Expand All @@ -180,6 +207,7 @@ export interface ExternalConfig {
canCommissionMatter: boolean;
canImportThreadCredentials: boolean;
hasAssist: boolean;
hasQRScanner: number;
}

export class ExternalMessaging {
Expand Down

0 comments on commit b728b9e

Please sign in to comment.