mirror of
https://github.com/home-assistant/iOS.git
synced 2026-06-20 01:35:23 -05:00
This is somewhat in prep of being able to make the project file generated, but also just organizes things into more concrete directory structures.
This pulls out _all_ of the build settings from the root level, and most from the target level, into xcconfigs.
The new directory structure looks like:
- Sources
- App
- (everything from HomeAssistant/)
- WatchApp
- Shared
- MacBridge
- Extensions
- Intents
- NotificationContent
- NotificationService
- Share
- Today
- Watch
- Widgets
- Tests
- App
- UI
- Shared
Somewhat intentionally, the file structure under these is not yet standardized/organized.
The project targets are now:
- App
- WatchApp
- Shared-iOS
- Shared-watchOS
- MacBridge
- Tests-App
- Tests-UI
- Tests-Shared
- Extension-Intents
- Extension-NotificationContent
- Extension-NotificationService
- Extension-Share
- Extension-Today
- Extension-Widget
- WatchExtension-Watch
This does not yet clean up resources vs. sources, nor does it handle some of the "it's in Sources/App but it's part of Shared" crossover directory issues.
86 lines
3.0 KiB
Swift
86 lines
3.0 KiB
Swift
import Foundation
|
|
import ObjectMapper
|
|
|
|
public struct MobileAppConfigAction: ImmutableMappable, UpdatableModelSource {
|
|
var name: String
|
|
var backgroundColor: String?
|
|
var labelText: String?
|
|
var labelColor: String?
|
|
var iconIcon: String?
|
|
var iconColor: String?
|
|
|
|
public init(map: Map) throws {
|
|
self.name = try map.value("name")
|
|
self.backgroundColor = try? map.value("background_color")
|
|
self.labelText = try? map.value("label.text")
|
|
self.labelColor = try? map.value("label.color")
|
|
self.iconIcon = try? map.value("icon.icon")
|
|
self.iconColor = try? map.value("icon.color")
|
|
}
|
|
|
|
public var primaryKey: String { name }
|
|
}
|
|
|
|
public struct MobileAppConfigPushCategory: ImmutableMappable, UpdatableModelSource {
|
|
public struct Action: ImmutableMappable {
|
|
public var title: String
|
|
public var identifier: String
|
|
public var authenticationRequired: Bool
|
|
public var behavior: String
|
|
public var activationMode: String
|
|
public var destructive: Bool
|
|
public var textInputButtonTitle: String?
|
|
public var textInputPlaceholder: String?
|
|
|
|
public init(map: Map) throws {
|
|
self.title = try map.value("title", default: "Missing title")
|
|
self.identifier = try map.value("identifier", default: "missing")
|
|
self.authenticationRequired = try map.value("authenticationRequired", default: false)
|
|
self.behavior = try map.value("behavior", default: "default")
|
|
self.activationMode = try map.value("activationMode", default: "background")
|
|
self.destructive = try map.value("destructive", default: false)
|
|
self.textInputButtonTitle = try? map.value("textInputButtonTitle")
|
|
self.textInputPlaceholder = try? map.value("textInputPlaceholder")
|
|
}
|
|
}
|
|
|
|
public var name: String
|
|
public var identifier: String
|
|
public var actions: [Action]
|
|
|
|
public init(map: Map) throws {
|
|
self.name = try map.value("name")
|
|
self.identifier = try map.value("identifier", default: name)
|
|
self.actions = map.value("actions", default: [])
|
|
}
|
|
|
|
public var primaryKey: String { identifier.uppercased() }
|
|
}
|
|
|
|
public struct MobileAppConfigPush: ImmutableMappable {
|
|
public var categories: [MobileAppConfigPushCategory]
|
|
|
|
internal init(categories: [MobileAppConfigPushCategory] = []) {
|
|
self.categories = []
|
|
}
|
|
|
|
public init(map: Map) throws {
|
|
self.categories = map.value("categories", default: [])
|
|
}
|
|
}
|
|
|
|
public struct MobileAppConfig: ImmutableMappable {
|
|
public var push: MobileAppConfigPush
|
|
public var actions: [MobileAppConfigAction]
|
|
|
|
internal init(push: MobileAppConfigPush = .init(), actions: [MobileAppConfigAction] = []) {
|
|
self.push = push
|
|
self.actions = actions
|
|
}
|
|
|
|
public init(map: Map) throws {
|
|
self.push = (try? map.value("push")) ?? MobileAppConfigPush()
|
|
self.actions = map.value("actions", default: [])
|
|
}
|
|
}
|