mirror of
https://github.com/home-assistant/iOS.git
synced 2026-02-20 02:02:07 -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 --> - Create watch home from iPhone - Configure Assist for watch from iPhone - Deprecate message for iOS Actions - Use Scripts or Scenes directly - Show/Hide Assist in Apple Watch - Options to require confirmation before running watch item (script/scene/action) ## Screenshots <!-- If this is a user-facing change not in the frontend, please include screenshots in light and dark mode. -->  https://github.com/user-attachments/assets/1e4509f8-45e5-4b39-bfdc-62f9bce64617 ## 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. -->
49 lines
1.4 KiB
Swift
49 lines
1.4 KiB
Swift
import Foundation
|
|
|
|
public protocol CrashReporter {
|
|
var hasCrashReporter: Bool { get }
|
|
var hasAnalytics: Bool { get }
|
|
|
|
func setUserProperty(value: String?, name: String)
|
|
func logEvent(event: String, params: [String: Any])
|
|
func logError(_ error: NSError)
|
|
}
|
|
|
|
public class CrashReporterImpl: CrashReporter {
|
|
public var hasCrashReporter: Bool = false
|
|
public var hasAnalytics: Bool = false
|
|
|
|
func setup() {
|
|
guard Current.settingsStore.privacy.crashes else {
|
|
return
|
|
}
|
|
|
|
guard AppConstants.BundleID.starts(with: "io.robbie.") else {
|
|
return
|
|
}
|
|
|
|
// no current crash reporter
|
|
hasCrashReporter = false
|
|
hasAnalytics = false
|
|
}
|
|
|
|
public func setUserProperty(value: String?, name: String) {
|
|
// no current analytics/crash reporter
|
|
}
|
|
|
|
public func logEvent(event: String, params: [String: Any]) {
|
|
guard Current.settingsStore.privacy.analytics else { return }
|
|
|
|
Current.Log.verbose("event \(event): \(params)")
|
|
// no current analytics logger
|
|
}
|
|
|
|
public func logError(_ error: NSError) {
|
|
// crash reporting is controlled by the crashes key, but this is more like analytics
|
|
guard Current.settingsStore.privacy.analytics else { return }
|
|
|
|
Current.Log.error("error: \(error.debugDescription)")
|
|
// no current error logger
|
|
}
|
|
}
|