Files
iOS/Sources/Shared/Database/Tables/KioskSettingsTable.swift
Bruno Pantaleão Gonçalves 42ab5b79ff Add kiosk mode push commands (#4821)
<!-- 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 -->
- Screensaver push commands
- Camera push commands
## 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/41c4555d-1273-4855-b20c-0d2169eebda4



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

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-23 22:25:55 +00:00

35 lines
1.7 KiB
Swift

import Foundation
import GRDB
final class KioskSettingsTable: DatabaseTableProtocol {
var tableName: String { GRDBDatabaseTable.kioskSettings.rawValue }
var definedColumns: [String] { DatabaseTables.KioskSettings.allCases.map(\.rawValue) }
func createIfNeeded(database: DatabaseQueue) throws {
let shouldCreateTable = try database.read { db in
try !db.tableExists(tableName)
}
if shouldCreateTable {
try database.write { db in
try db.create(table: tableName) { t in
t.primaryKey(DatabaseTables.KioskSettings.id.rawValue, .text).notNull()
t.column(DatabaseTables.KioskSettings.enabled.rawValue, .boolean)
t.column(DatabaseTables.KioskSettings.requireAuthentication.rawValue, .boolean)
t.column(DatabaseTables.KioskSettings.acceptRemoteCommands.rawValue, .boolean)
t.column(DatabaseTables.KioskSettings.serverId.rawValue, .text)
t.column(DatabaseTables.KioskSettings.dashboard.rawValue, .text)
t.column(DatabaseTables.KioskSettings.keepScreenOn.rawValue, .boolean)
t.column(DatabaseTables.KioskSettings.removeHeaderAndSidebar.rawValue, .boolean)
t.column(DatabaseTables.KioskSettings.hideStatusBar.rawValue, .boolean)
t.column(DatabaseTables.KioskSettings.autoReload.rawValue, .text)
t.column(DatabaseTables.KioskSettings.settingsEntryPosition.rawValue, .text)
t.column(DatabaseTables.KioskSettings.screensaver.rawValue, .jsonText)
}
}
} else {
try migrateColumns(database: database)
}
}
}