Files
iOS/Sources/App/Notifications/NotificationManagerLocalPushInterface.swift
Bruno Pantaleão Gonçalves 1bf28ec458 Improve local push reconnection and add logs (#4702)
<!-- 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 -->
- Added button to retry local push reconnection
- Improves reconnection logic
- Added logs to debug in case of issues
## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## 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. -->
2026-06-04 21:42:33 +00:00

38 lines
1016 B
Swift

import Foundation
import HAKit
import Shared
enum NotificationManagerLocalPushStatus {
case allowed(LocalPushManager.State)
case disabled
case unsupported
}
enum LocalPushRetryReason: Equatable {
case appOpen
case appOpenDelayed(seconds: TimeInterval)
case manual
case serverChanged
var eventValue: String {
switch self {
case .appOpen:
return "app_open"
case let .appOpenDelayed(seconds):
return "app_open_\(Int(seconds))s"
case .manual:
return "manual"
case .serverChanged:
return "server_changed"
}
}
}
protocol NotificationManagerLocalPushInterface {
func status(for server: Server) -> NotificationManagerLocalPushStatus
func addObserver(for server: Server, handler: @escaping (NotificationManagerLocalPushStatus) -> Void)
-> HACancellable
func retryLocalPush(for server: Server?, reason: LocalPushRetryReason)
func scheduleAppOpenLocalPushRetries()
}