ServicesView.swift 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // FeatureSettingsView.swift
  3. // FreeAPS
  4. //
  5. // Created by Deniz Cengiz on 26.07.24.
  6. //
  7. import Foundation
  8. import HealthKit
  9. import SwiftUI
  10. import Swinject
  11. struct ServicesView: BaseView {
  12. let resolver: Resolver
  13. @ObservedObject var state: Settings.StateModel
  14. @Environment(\.colorScheme) var colorScheme
  15. var color: LinearGradient {
  16. colorScheme == .dark ? LinearGradient(
  17. gradient: Gradient(colors: [
  18. Color.bgDarkBlue,
  19. Color.bgDarkerDarkBlue
  20. ]),
  21. startPoint: .top,
  22. endPoint: .bottom
  23. )
  24. :
  25. LinearGradient(
  26. gradient: Gradient(colors: [Color.gray.opacity(0.1)]),
  27. startPoint: .top,
  28. endPoint: .bottom
  29. )
  30. }
  31. var body: some View {
  32. Form {
  33. Section(
  34. header: Text("Connected Services"),
  35. content: {
  36. Text("Nightscout").navigationLink(to: .nighscoutConfig, from: self)
  37. Text("Tidepool").navigationLink(to: .tidepoolConfig, from: self)
  38. if HKHealthStore.isHealthDataAvailable() {
  39. Text("Apple Health").navigationLink(to: .healthkit, from: self)
  40. }
  41. }
  42. )
  43. .listRowBackground(Color.chart)
  44. }
  45. .scrollContentBackground(.hidden).background(color)
  46. .navigationTitle("Services")
  47. .navigationBarTitleDisplayMode(.automatic)
  48. }
  49. }