diff options
author | Isidro Henoch <imhenoch@protonmail.com> | 2022-02-12 17:37:20 -0600 |
---|---|---|
committer | Isidro Henoch <imhenoch@protonmail.com> | 2022-02-12 17:37:20 -0600 |
commit | e58ceb3d9f7d4a0d497d5957d3fc21cef9ca554b (patch) | |
tree | 83971af6ebf12d930b95803c3ceb77199fcfedf5 | |
parent | 8098ae108e59d3170f88379d8aa51363036ea5eb (diff) | |
download | etbsa-trackermap-mobile-e58ceb3d9f7d4a0d497d5957d3fc21cef9ca554b.tar.gz etbsa-trackermap-mobile-e58ceb3d9f7d4a0d497d5957d3fc21cef9ca554b.tar.bz2 etbsa-trackermap-mobile-e58ceb3d9f7d4a0d497d5957d3fc21cef9ca554b.zip |
Minor changes that doesn't have a major impact
-rw-r--r-- | iosApp/iosApp/Details/Commands/UnitCommandsView.swift | 10 | ||||
-rw-r--r-- | iosApp/iosApp/Details/Information/UnitInformationView.swift | 4 | ||||
-rw-r--r-- | iosApp/iosApp/Devices/DevicesView.swift | 2 | ||||
-rw-r--r-- | iosApp/iosApp/Session/RootViewModel.swift | 6 |
4 files changed, 10 insertions, 12 deletions
diff --git a/iosApp/iosApp/Details/Commands/UnitCommandsView.swift b/iosApp/iosApp/Details/Commands/UnitCommandsView.swift index eef3ae4..b60b1cf 100644 --- a/iosApp/iosApp/Details/Commands/UnitCommandsView.swift +++ b/iosApp/iosApp/Details/Commands/UnitCommandsView.swift @@ -21,12 +21,7 @@ import shared struct UnitCommandsView: View { @ObservedObject var unitCommandsViewModel = UnitCommandsViewModel() - var unit: UnitInformation - - init(unit: UnitInformation) { - self.unit = unit - unitCommandsViewModel.fetchCommands(id: unit.device.id) - } + let unit: UnitInformation var body: some View { VStack { @@ -54,5 +49,8 @@ struct UnitCommandsView: View { } } } + .onAppear { + unitCommandsViewModel.fetchCommands(id: unit.device.id) + } } } diff --git a/iosApp/iosApp/Details/Information/UnitInformationView.swift b/iosApp/iosApp/Details/Information/UnitInformationView.swift index f713ab4..4c0d722 100644 --- a/iosApp/iosApp/Details/Information/UnitInformationView.swift +++ b/iosApp/iosApp/Details/Information/UnitInformationView.swift @@ -93,11 +93,11 @@ struct UnitInformationView: View { } } // MARK: - Protocol - if let protocol_ = unit.position?.protocol { + if let `protocol` = unit.position?.protocol { HStack { Text("protocol") Spacer() - Text(protocol_).foregroundColor(.secondaryLabel) + Text(`protocol`).foregroundColor(.secondaryLabel) } } } diff --git a/iosApp/iosApp/Devices/DevicesView.swift b/iosApp/iosApp/Devices/DevicesView.swift index 06f1df1..e80a4c3 100644 --- a/iosApp/iosApp/Devices/DevicesView.swift +++ b/iosApp/iosApp/Devices/DevicesView.swift @@ -20,7 +20,7 @@ import SwiftUI struct DevicesView: View { @ObservedObject var devicesViewModel: DevicesViewModel - init (unitsViewModel: UnitsViewModel) { + init(unitsViewModel: UnitsViewModel) { self._devicesViewModel = ObservedObject( wrappedValue: DevicesViewModel(unitsViewModel: unitsViewModel)) } diff --git a/iosApp/iosApp/Session/RootViewModel.swift b/iosApp/iosApp/Session/RootViewModel.swift index 25a170f..d065777 100644 --- a/iosApp/iosApp/Session/RootViewModel.swift +++ b/iosApp/iosApp/Session/RootViewModel.swift @@ -23,13 +23,13 @@ class RootViewModel: ObservableObject { @Published var loginState: SessionController.LoginState = SessionController.LoginStateNothing() - init () { + init() { let collector = Collector<SessionController.LoginState?>(callback: setLoginState) sessionController.loginStateFlow.collect(collector: collector) { (unit, error) in } restoreSession() } - func setLoginState (state: SessionController.LoginState?) { + func setLoginState(state: SessionController.LoginState?) { print("State is: \(state?.debugDescription ?? "")") self.loginState = state ?? SessionController.LoginStateNothing() } @@ -38,7 +38,7 @@ class RootViewModel: ObservableObject { sessionController.restoreSession() } - func login (session: SessionBody) { + func login(session: SessionBody) { print("Username: \(session.email)") print("Password: \(session.password)") print("Server URL: \(session.url)") |