| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- import SwiftUI
- import Swinject
- struct WatchConfigAppleWatchView: BaseView {
- let resolver: Resolver
- @ObservedObject var state: WatchConfig.StateModel
- @State private var shouldDisplayHint: Bool = false
- @State var hintDetent = PresentationDetent.large
- @State var selectedVerboseHint: AnyView?
- @State var hintLabel: String?
- @State private var decimalPlaceholder: Decimal = 0.0
- @State private var booleanPlaceholder: Bool = false
- @Environment(\.colorScheme) var colorScheme
- @Environment(AppState.self) var appState
- private func onDelete(offsets: IndexSet) {
- state.devices.remove(atOffsets: offsets)
- state.deleteGarminDevice()
- }
- var body: some View {
- List {
- SettingInputSection(
- decimalValue: $decimalPlaceholder,
- booleanValue: $state.confirmBolusFaster,
- shouldDisplayHint: $shouldDisplayHint,
- selectedVerboseHint: Binding(
- get: { selectedVerboseHint },
- set: {
- selectedVerboseHint = $0.map { AnyView($0) }
- hintLabel = "Confirm Bolus Faster"
- }
- ),
- units: state.units,
- type: .boolean,
- label: "Confirm Bolus Faster",
- miniHint: "Reduce the number of crown rotations required for bolus confirmation.",
- verboseHint: Text(
- "Enabling this feature lowers the number of turns on the crown dial required when confirming a bolus."
- ),
- headerText: "Apple Watch Configuration"
- )
- Section(
- header: Text("Contact Image"),
- content: {
- VStack {
- HStack {
- NavigationLink("Contacts Configuration") {
- ContactImage.RootView(resolver: resolver)
- }.foregroundStyle(Color.accentColor)
- }
- }
- }
- ).listRowBackground(Color.chart)
- }
- .listSectionSpacing(sectionSpacing)
- .sheet(isPresented: $shouldDisplayHint) {
- SettingInputHintView(
- hintDetent: $hintDetent,
- shouldDisplayHint: $shouldDisplayHint,
- hintLabel: hintLabel ?? "",
- hintText: selectedVerboseHint ?? AnyView(EmptyView()),
- sheetTitle: "Help"
- )
- }
- .navigationTitle("Apple Watch")
- .navigationBarTitleDisplayMode(.automatic)
- .scrollContentBackground(.hidden)
- .background(appState.trioBackgroundColor(for: colorScheme))
- }
- }
|