aboutsummaryrefslogtreecommitdiff
path: root/iosApp/iosApp/Details/Commands/UnitCommandsViewModel.swift
diff options
context:
space:
mode:
Diffstat (limited to 'iosApp/iosApp/Details/Commands/UnitCommandsViewModel.swift')
-rw-r--r--iosApp/iosApp/Details/Commands/UnitCommandsViewModel.swift12
1 files changed, 10 insertions, 2 deletions
diff --git a/iosApp/iosApp/Details/Commands/UnitCommandsViewModel.swift b/iosApp/iosApp/Details/Commands/UnitCommandsViewModel.swift
index aac82c9..d7298c4 100644
--- a/iosApp/iosApp/Details/Commands/UnitCommandsViewModel.swift
+++ b/iosApp/iosApp/Details/Commands/UnitCommandsViewModel.swift
@@ -25,11 +25,19 @@ class UnitCommandsViewModel: ObservableObject {
@Published var selected: Command?
@Published var selectedId: Int = 0 {
didSet {
- selected = commands.first(where: {
+ if let selected = commands.first(where: {
Int(truncating: $0.id!) == selectedId
- })
+ }) {
+ self.selected = selected
+ notSelected = false
+ } else {
+ self.selected = nil
+ notSelected = true
+ }
}
}
+ @Published var notSelected: Bool = true
+ @Published var showConfirmation: Bool = false
func fetchCommands(id: Int32) {
commandsController.fetchCommands(deviceId: id) { commands, error in