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

move contact image inside apple watch settings

Marc R Kellerman 1 год назад
Родитель
Сommit
c2e1d8997e

+ 1 - 1
FreeAPS/Sources/Modules/Settings/SettingItems.swift

@@ -57,7 +57,7 @@ enum SettingItems {
             title: "Contact Image",
             view: .watch,
             searchContents: ["Display on Watch", "Watch Complication"],
-            path: ["Devices", "Smart Watch", "Contact Image"]
+            path: ["Devices", "Smart Watch", "Apple Watch", "Contact Image"]
         )
     ]
 

+ 17 - 0
FreeAPS/Sources/Modules/WatchConfig/View/WatchConfigAppleWatchView.swift

@@ -1,6 +1,8 @@
 import SwiftUI
+import Swinject
 
 struct WatchConfigAppleWatchView: View {
+    let resolver: Resolver
     @ObservedObject var state: WatchConfig.StateModel
 
     @State private var shouldDisplayHint: Bool = false
@@ -108,6 +110,21 @@ struct WatchConfigAppleWatchView: View {
                 miniHint: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr.",
                 verboseHint: "Confirm Bolus Faster… bla bla bla"
             )
+
+            Section(
+                header: Text("Complications"),
+                content: {
+                    VStack {
+                        HStack {
+                            NavigationLink(
+                                "Contact Image",
+                                destination: ContactTrick.RootView(resolver: resolver)
+                            ).foregroundStyle(Color.accentColor)
+                        }
+                    }
+//                        .padding(.bottom)
+                }
+            ).listRowBackground(Color.chart)
         }
         .sheet(isPresented: $shouldDisplayHint) {
             SettingInputHintView(

+ 6 - 11
FreeAPS/Sources/Modules/WatchConfig/View/WatchConfigRootView.swift

@@ -29,20 +29,15 @@ extension WatchConfig {
                 Section(
                     header: Text("Smartwatch Configuration"),
                     content: {
-                        NavigationLink("Apple Watch", destination: WatchConfigAppleWatchView(state: state))
+                        NavigationLink("Apple Watch", destination: WatchConfigAppleWatchView(resolver: resolver, state: state))
                         NavigationLink("Garmin", destination: WatchConfigGarminView(state: state))
                     }
                 ).listRowBackground(Color.chart)
-                Section(
-                    header: Text("Complications"),
-                    content: {
-                        NavigationLink("Contact Image", destination: ContactTrick.RootView(resolver: resolver))
-                    }
-                ).listRowBackground(Color.chart) }
-                .scrollContentBackground(.hidden).background(color)
-                .onAppear(perform: configureView)
-                .navigationTitle("Watch")
-                .navigationBarTitleDisplayMode(.automatic)
+            }
+            .scrollContentBackground(.hidden).background(color)
+            .onAppear(perform: configureView)
+            .navigationTitle("Watch")
+            .navigationBarTitleDisplayMode(.automatic)
         }
     }
 }

+ 0 - 2
FreeAPS/Sources/Services/ContactTrick/ContactTrickManager.swift

@@ -92,7 +92,6 @@ final class BaseContactTrickManager: NSObject, ContactTrickManager, Injectable {
 
         broadcaster.register(SettingsObserver.self, observer: self)
         broadcaster.register(CarbsObserver.self, observer: self)
-
     }
 
     private func registerSubscribers() {
@@ -444,7 +443,6 @@ final class BaseContactTrickManager: NSObject, ContactTrickManager, Injectable {
 
         return description
     }
-
 }
 
 extension BaseContactTrickManager: