mirror of
https://github.com/home-assistant/iOS.git
synced 2026-02-05 06:35:37 -06:00
Adds new fastlane lanes: - `fastlane lint` which checks the linters - `fastlane autocorrect` which applies the linters which can autocorrect (Rubocop, SwiftFormat) Adds a build step to the Codegen abstract target which runs SwiftFormat in lint mode, pointing out what it's going to change when run. Applies SwiftFormat to nearly all code -- exempts a few externally-sourced files and generated code.
27 lines
812 B
Swift
27 lines
812 B
Swift
import Foundation
|
|
import PromiseKit
|
|
|
|
public extension WebhookResponseIdentifier {
|
|
static var unhandled: Self { .init(rawValue: "unhandled") }
|
|
}
|
|
|
|
struct WebhookResponseUnhandled: WebhookResponseHandler {
|
|
init(api: HomeAssistantAPI) {}
|
|
|
|
static func shouldReplace(request current: WebhookRequest, with proposed: WebhookRequest) -> Bool {
|
|
// the unhandled variant never replaces requests. to customize, create another implementation.
|
|
false
|
|
}
|
|
|
|
func handle(
|
|
request: Promise<WebhookRequest>,
|
|
result: Promise<Any>
|
|
) -> Guarantee<WebhookResponseHandlerResult> {
|
|
result.then { _ in
|
|
Guarantee.value(WebhookResponseHandlerResult.default)
|
|
}.recover { _ in
|
|
Guarantee.value(WebhookResponseHandlerResult.default)
|
|
}
|
|
}
|
|
}
|