Просмотр исходного кода

Fix Tidepool view
* Change ServicesView.swift Tidepool NavigationLink to Text(…) with .navigationLink(…) modifier
* Change TidepoolStartView.swift to conform to BaseView, add onAppear() modifier and call configureView
* Add Tidepool view to Screen.swift enum

Co-Authored-By: kskandis <kskandis@users.noreply.github.com>

Deniz Cengiz 1 год назад
Родитель
Сommit
5dbae70ae1

+ 1 - 3
FreeAPS/Sources/Modules/Settings/View/Subviews/ServicesView.swift

@@ -38,9 +38,7 @@ struct ServicesView: BaseView {
                 header: Text("Connected Services"),
                 content: {
                     Text("Nightscout").navigationLink(to: .nighscoutConfig, from: self)
-                    NavigationLink(destination: TidepoolStartView(state: state)) {
-                        Text("Tidepool")
-                    }
+                    Text("Tidepool").navigationLink(to: .tidepoolConfig, from: self)
                     if HKHealthStore.isHealthDataAvailable() {
                         Text("Apple Health").navigationLink(to: .healthkit, from: self)
                     }

+ 4 - 1
FreeAPS/Sources/Modules/Settings/View/TidepoolStartView.swift

@@ -1,7 +1,9 @@
 
 import SwiftUI
+import Swinject
 
-struct TidepoolStartView: View {
+struct TidepoolStartView: BaseView {
+    let resolver: Resolver
     @ObservedObject var state: Settings.StateModel
 
     @State private var shouldDisplayHint: Bool = false
@@ -94,5 +96,6 @@ struct TidepoolStartView: View {
         .scrollContentBackground(.hidden).background(color)
         .navigationTitle("Tidepool")
         .navigationBarTitleDisplayMode(.automatic)
+        .onAppear(perform: configureView)
     }
 }

+ 3 - 0
FreeAPS/Sources/Router/Screen.swift

@@ -8,6 +8,7 @@ enum Screen: Identifiable, Hashable {
     case configEditor(file: String)
     case nighscoutConfig
     case nighscoutConfigDirect
+    case tidepoolConfig
     case pumpConfig
     case pumpConfigDirect
     case basalProfileEditor
@@ -65,6 +66,8 @@ extension Screen {
             NightscoutConfig.RootView(resolver: resolver, displayClose: false)
         case .nighscoutConfigDirect:
             NightscoutConfig.RootView(resolver: resolver, displayClose: true)
+        case .tidepoolConfig:
+            TidepoolStartView(resolver: resolver, state: Settings.StateModel())
         case .pumpConfig:
             PumpConfig.RootView(resolver: resolver, displayClose: false)
         case .pumpConfigDirect: