Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 19 additions & 126 deletions HomeAssistant.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,6 @@ SPEC CHECKSUMS:
Version: de5907f2c5d0f3cf21708db7801d1d5401139486
XCGLogger: 1943831ef907df55108b0b18657953f868de973b

PODFILE CHECKSUM: 63209440b17ff6d23dca34a6c8fe5c61067dbac6
PODFILE CHECKSUM: d601418d28009e934d3c93f1b929585f03f8aa35

COCOAPODS: 1.15.2
7 changes: 0 additions & 7 deletions Sources/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
sceneManager.activateAnyScene(for: .settings)
}

@objc func openActionsPreferences() {
precondition(Current.sceneManager.supportsMultipleScenes)
let delegate: Guarantee<SettingsSceneDelegate> = sceneManager.scene(for: .init(activity: .settings))
delegate.done { $0.pushActions(animated: true) }
}

@objc func openHelp() {
openURLInBrowser(
URL(string: "https://companion.home-assistant.io")!,
Expand Down Expand Up @@ -438,7 +432,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
private func setupModels() {
// Force Realm migration to happen now
_ = Realm.live()
Action.setupObserver()
NotificationCategory.setupObserver()
Comment thread
bgoncal marked this conversation as resolved.
}

Expand Down
59 changes: 1 addition & 58 deletions Sources/App/Frontend/IncomingURLHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class IncomingURLHandler {
case callService = "call_service"
case fireEvent = "fire_event"
case sendLocation = "send_location"
case performAction = "perform_action"
case assist
case navigate
case invite
Expand Down Expand Up @@ -60,8 +59,6 @@ class IncomingURLHandler {
message: L10n.UrlHandler.SendLocation.Confirm.message,
handler: { self.sendLocationURLHandler() }
)
case .performAction:
performActionURLHandler(url, serviceData: serviceData)
case .camera:
guard #available(iOS 16.0, *),
var components = URLComponents(url: url, resolvingAgainstBaseURL: false) else {
Expand Down Expand Up @@ -338,21 +335,7 @@ class IncomingURLHandler {
if let identifier = AppIconShortcutItemsUpdater.identifier(from: shortcutItem.type) {
return handleAppIconShortcut(identifier: identifier)
}
if
let action = Current.realm().object(ofType: Action.self, forPrimaryKey: shortcutItem.type),
let server = Current.servers.server(for: action) {
Current.sceneManager.showFullScreenConfirm(
icon: MaterialDesignIcons(named: action.IconName),
text: action.Text,
onto: .value(windowController.window)
)

return Current.api(for: server)?
.HandleAction(actionID: shortcutItem.type, source: .AppShortcut) ??
.init(error: HomeAssistantAPI.APIError.noAPIAvailable)
} else {
return .init(error: HomeAssistantAPI.APIError.notConfigured)
}
return .init(error: HomeAssistantAPI.APIError.notConfigured)
}
}
}
Expand Down Expand Up @@ -902,44 +885,4 @@ extension IncomingURLHandler {
)
}
}

private func performActionURLHandler(_ url: URL, serviceData: [String: String]) {
let pathComponents = url.pathComponents
guard pathComponents.count > 1 else {
Current.Log.error("not enough path components for perform action handler")
return
}

let source: AppTriggerSource = {
if
let sourceString = serviceData["source"],
let source = AppTriggerSource(rawValue: sourceString) {
return source
} else {
return .URLHandler
}
}()

let actionID = url.pathComponents[1]

guard
let action = Current.realm().object(ofType: Action.self, forPrimaryKey: actionID),
let server = Current.servers.server(for: action),
let api = Current.api(for: server) else {
Current.sceneManager.showFullScreenConfirm(
icon: .alertCircleIcon,
text: L10n.UrlHandler.Error.actionNotFound,
onto: .value(windowController.window)
)
return
}

Current.sceneManager.showFullScreenConfirm(
icon: MaterialDesignIcons(named: action.IconName),
text: action.Text,
onto: .value(windowController.window)
)

api.HandleAction(actionID: actionID, source: source).cauterize()
}
}
10 changes: 0 additions & 10 deletions Sources/App/Frontend/WebView/WebViewController+Alerts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -477,16 +477,6 @@ extension WebViewController {
showEmptyState()
}

func showActionAutomationEditorNotAvailable() {
let alert = UIAlertController(
title: L10n.Alerts.ActionAutomationEditor.Unavailable.title,
message: L10n.Alerts.ActionAutomationEditor.Unavailable.body,
preferredStyle: .alert
)
alert.addAction(.init(title: L10n.okLabel, style: .default))
present(alert, animated: true)
}

func openDebug() {
let controller = UIHostingController(rootView: AnyView(
NavigationView {
Expand Down
23 changes: 0 additions & 23 deletions Sources/App/Frontend/WebView/WebViewController+Navigation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,29 +104,6 @@ extension WebViewController {
}
}

func openActionAutomationEditor(actionId: String) {
guard server.info.version >= .externalBusCommandAutomationEditor else {
showActionAutomationEditorNotAvailable()
return
}
_ = webViewExternalMessageHandler.sendExternalBus(message: .init(
command: WebViewExternalBusOutgoingMessage.showAutomationEditor.rawValue,
payload: [
"config": [
"trigger": [
[
"platform": "event",
"event_type": "ios.action_fired",
"event_data": [
"actionID": actionId,
],
],
],
],
]
))
}

func getLatestConfig() {
_ = Current.api(for: server)?.getConfig()
}
Expand Down
Loading
Loading