mirror of
https://github.com/home-assistant/iOS.git
synced 2026-02-10 12:51:23 -06:00
<!-- Thank you for submitting a Pull Request and helping to improve Home Assistant. Please complete the following sections to help the processing and review of your changes. Please do not delete anything from this template. --> ## Summary <!-- Provide a brief summary of the changes you have made and most importantly what they aim to achieve --> ## Screenshots <!-- If this is a user-facing change not in the frontend, please include screenshots in light and dark mode. --> <img width="1776" height="1124" alt="CleanShot 2025-12-23 at 03 29 25@2x" src="https://github.com/user-attachments/assets/ab1a5c9f-72a9-4dc8-ae44-1f7d574738f6" /> ## Link to pull request in Documentation repository <!-- Pull requests that add, change or remove functionality must have a corresponding pull request in the Companion App Documentation repository (https://github.com/home-assistant/companion.home-assistant). Please add the number of this pull request after the "#" --> Documentation: home-assistant/companion.home-assistant# ## Any other notes <!-- If there is any other information of note, like if this Pull Request is part of a bigger change, please include it here. --> --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
44 lines
1.4 KiB
Swift
44 lines
1.4 KiB
Swift
import Foundation
|
|
@testable import HomeAssistant
|
|
import PromiseKit
|
|
import Shared
|
|
|
|
final class MockWebViewExternalMessageHandler: WebViewExternalMessageHandlerProtocol {
|
|
var webViewController: (any HomeAssistant.WebViewControllerProtocol)?
|
|
|
|
var handleExternalMessageCalled = false
|
|
var handleExternalMessageParams: [String: Any]?
|
|
var sendExternalBusCalled = false
|
|
var sendExternalBusMessage: Shared.WebSocketMessage?
|
|
var scanImprovCalled = false
|
|
var stopImprovScanIfNeededCalled = false
|
|
var showAssistCalled = false
|
|
var showAssistParams: (server: Shared.Server, pipeline: String, autoStartRecording: Bool)?
|
|
|
|
var sendExternalBusReturnValue: PromiseKit.Promise<Void> = PromiseKit.Promise.value(())
|
|
|
|
func handleExternalMessage(_ dictionary: [String: Any]) {
|
|
handleExternalMessageCalled = true
|
|
handleExternalMessageParams = dictionary
|
|
}
|
|
|
|
func sendExternalBus(message: Shared.WebSocketMessage) -> PromiseKit.Promise<Void> {
|
|
sendExternalBusCalled = true
|
|
sendExternalBusMessage = message
|
|
return sendExternalBusReturnValue
|
|
}
|
|
|
|
func scanImprov() {
|
|
scanImprovCalled = true
|
|
}
|
|
|
|
func stopImprovScanIfNeeded() {
|
|
stopImprovScanIfNeededCalled = true
|
|
}
|
|
|
|
func showAssist(server: Shared.Server, pipeline: String, autoStartRecording: Bool) {
|
|
showAssistCalled = true
|
|
showAssistParams = (server, pipeline, autoStartRecording)
|
|
}
|
|
}
|