Files
iOS/Sources/Shared/Database/DatabaseTables.swift
Bruno Pantaleão Gonçalves 12c8d5ccec Reworked the foundation for Kiosk Mode (#4805)
<!-- 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 -->
This PR removes the previous foundation for kiosk mode and add a
simplified version fully made for SwiftUI.

## 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/d6f1ba1e-6806-4a72-9fb4-c326f3479ad4


## 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#1357

## 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: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 10:57:42 +02:00

193 lines
5.0 KiB
Swift

import Foundation
public enum GRDBDatabaseTable: String {
case HAAppEntity = "hAAppEntity"
case watchConfig
case assistPipelines
case carPlayConfig
case appIconShortcutConfig
case serverInfoMirror
// Obsolete: replaced by `displayEntityRegistry`. Kept only so `deleteOldTables` can drop it.
case appEntityRegistryListForDisplay
// Entity registry sourced from `config/entity_registry/list_for_display` (the full
// `config/entity_registry/list` endpoint is no longer requested). Rows are
// `EntityRegistryListForDisplay.Entity`. Named for its source so it isn't mistaken for the
// dropped full-registry table (which was named `entityRegistry`).
case displayEntityRegistry
case deviceRegistry
case appPanel
case customWidget
case appArea
case homeViewConfiguration
case assistConfiguration
case allowedTags
case kioskSettings
// Dropped since 2025.2, now saved as json file
// Context: https://github.com/groue/GRDB.swift/issues/1626#issuecomment-2623927815
case clientEvent
}
public enum DatabaseTables {
public enum AppEntity: String, CaseIterable {
case id
case entityId
case serverId
case domain
case name
case icon
case rawDeviceClass
}
public enum WatchConfig: String, CaseIterable {
case id
case assist
case items
}
// Assist pipelines
public enum AssistPipelines: String, CaseIterable {
case serverId
case preferredPipeline
case pipelines
}
// CarPlay configuration
public enum CarPlayConfig: String, CaseIterable {
case id
case tabs
case quickAccessItems
case quickAccessLayout
}
public enum AppIconShortcutConfig: String, CaseIterable {
case id
case items
}
public enum ServerInfoMirror: String, CaseIterable {
case id
case serverInfoJSON
}
// Sidebar dashboard panels
public enum AppPanel: String, CaseIterable {
case id
case serverId
case icon
case title
case path
case component
case showInSidebar
}
public enum CustomWidget: String, CaseIterable {
case id
case name
case items
case itemsStates
}
// Areas from Home Assistant
public enum AppArea: String, CaseIterable {
case id
case serverId
case areaId
case name
case aliases
case picture
case icon
case sortOrder
case entities
}
// Home View Configuration (per server)
public enum HomeViewConfiguration: String, CaseIterable {
case id
case sectionOrder
case visibleSectionIds
case allowMultipleSelection
case entityOrderByRoom
case hiddenEntityIds
case showUsagePredictionSection
case areasLayout
case showSummaries
}
// Columns for the `displayEntityRegistry` table (sourced from
// config/entity_registry/list_for_display). Names must match
// EntityRegistryListForDisplay.Entity's stored properties.
public enum DisplayEntityRegistry: String, CaseIterable {
case serverId
case entityId
case platform
case labels
case deviceId
case name
case hasEntityName
case entityCategory
case translationKey
case decimalPlaces
case areaId
case hidden
case icon
}
// Device Registry (full device registry data)
public enum DeviceRegistry: String, CaseIterable {
case id // Auto generated by GRDB (serverId-deviceId)
case serverId
case deviceId
case areaId
case configurationURL
case configEntries
case configEntriesSubentries
case connections
case createdAt
case disabledBy
case entryType
case hwVersion
case identifiers
case labels
case manufacturer
case model
case modelID
case modifiedAt
case nameByUser
case name
case primaryConfigEntry
case serialNumber
case swVersion
case viaDeviceID
}
public enum AssistConfiguration: String, CaseIterable {
case id
case enableOnDeviceSTT
case onDeviceSTTLocaleIdentifier
case muteTTS
case enableOnDeviceTTS
case onDeviceTTSVoiceIdentifier
}
public enum AllowedTag: String, CaseIterable {
case tag
}
// Kiosk mode configuration (single row). Column names must match
// `KioskSettings`'s stored properties so GRDB's Codable mapping lines up.
public enum KioskSettings: String, CaseIterable {
case id
case enabled
case requireAuthentication
case serverId
case dashboard
case keepScreenOn
case removeHeaderAndSidebar
case hideStatusBar
case autoReload
case settingsEntryPosition
case screensaver
}
}