ServicesView.swift 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. NavigationLink(destination: TidepoolStartView(state: state)) {
  38. Text("Tidepool")
  39. }
  40. if HKHealthStore.isHealthDataAvailable() {
  41. Text("Apple Health").navigationLink(to: .healthkit, from: self)
  42. }
  43. }
  44. )
  45. .listRowBackground(Color.chart)
  46. }
  47. .scrollContentBackground(.hidden).background(color)
  48. .navigationTitle("Services")
  49. .navigationBarTitleDisplayMode(.automatic)
  50. }
  51. }