iOS/Sources/Shared/Environment/AppArea.swift
Copilot 8cdfb4f294
Experiment: Native HomeView/dashboard (#4142)
Basic implementation of a native dashboard - WIP

- [ ] Support more domains toggle action when tapping icon
  - [x] Light
  - [x] Cover
  - [x] Switch
- [ ] Create the equivalent of "more info dialog" for each domain
  - [x] Light
  - [x] Cover
  - [x] Switch
- [x] Add haptics
- [ ] Add more cards such as a camera card
- [ ] Find a way to display sensors information such as humidity and
temperature
- [ ] Allow customizing background
- [x] Allow opening the native dashboard from iOS controls
- [ ] Allow opening the native dashboard from Shortcuts
- [ ] Add an advanced option somewhere in settings that allow user to
see the native dashboard first instead of web UI
- [ ] Add error state
- [x] Add empty state
- [x] Add loading state
- [x] Allow reordering rooms
- [x] Allow reordering cards

<img width="1232" height="1158" alt="CleanShot 2026-01-05 at 16 19
59@2x"
src="https://github.com/user-attachments/assets/84ae8748-ec40-430c-a820-fcb6a88a6270"
/>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com>
2026-01-05 22:38:09 +00:00

48 lines
1.3 KiB
Swift

import Foundation
import GRDB
import HAKit
public struct AppArea: Codable, FetchableRecord, PersistableRecord {
/// serverId-areaId
public let id: String
public let serverId: String
public let areaId: String
public let name: String
public let aliases: [String]
public let picture: String?
public let icon: String?
/// Array containing entity Ids that belong to area
public let entities: Set<String>
public init(
id: String,
serverId: String,
areaId: String,
name: String,
aliases: [String],
picture: String?,
icon: String?,
entities: Set<String>
) {
self.id = id
self.serverId = serverId
self.areaId = areaId
self.name = name
self.aliases = aliases
self.picture = picture
self.icon = icon
self.entities = entities
}
public init(from area: HAAreasRegistryResponse, serverId: String, entities: Set<String>?) {
self.id = "\(serverId)-\(area.areaId)"
self.serverId = serverId
self.areaId = area.areaId
self.name = area.name
self.aliases = area.aliases
self.picture = area.picture
self.icon = area.icon
self.entities = entities ?? []
}
}