|
|
@@ -6,8 +6,8 @@ extension CGMSettings {
|
|
|
struct RootView: BaseView {
|
|
|
let resolver: Resolver
|
|
|
let displayClose: Bool
|
|
|
+ let bluetoothManager: BluetoothStateManager
|
|
|
@StateObject var state = StateModel()
|
|
|
-
|
|
|
@State private var shouldDisplayHint: Bool = false
|
|
|
@State var hintDetent = PresentationDetent.large
|
|
|
@State var selectedVerboseHint: AnyView?
|
|
|
@@ -35,48 +35,56 @@ extension CGMSettings {
|
|
|
Section(
|
|
|
header: Text("CGM Integration to Trio"),
|
|
|
content: {
|
|
|
- let cgmState = state.cgmCurrent
|
|
|
- if cgmState.type != .none {
|
|
|
- Button {
|
|
|
- state.shouldDisplayCGMSetupSheet = true
|
|
|
- } label: {
|
|
|
- HStack {
|
|
|
- Image(systemName: "sensor.tag.radiowaves.forward.fill")
|
|
|
- Text(cgmState.displayName)
|
|
|
- }
|
|
|
- .frame(maxWidth: .infinity, minHeight: 50, alignment: .center)
|
|
|
- .font(.title2)
|
|
|
- }.padding()
|
|
|
+ if bluetoothManager.bluetoothAuthorization != .authorized {
|
|
|
+ HStack {
|
|
|
+ Spacer()
|
|
|
+ BluetoothRequiredView()
|
|
|
+ Spacer()
|
|
|
+ }
|
|
|
} else {
|
|
|
- VStack {
|
|
|
+ let cgmState = state.cgmCurrent
|
|
|
+ if cgmState.type != .none {
|
|
|
Button {
|
|
|
- showCGMSelection.toggle()
|
|
|
+ state.shouldDisplayCGMSetupSheet = true
|
|
|
} label: {
|
|
|
- Text("Add CGM")
|
|
|
- .font(.title3) }
|
|
|
- .frame(maxWidth: .infinity, alignment: .center)
|
|
|
- .buttonStyle(.bordered)
|
|
|
+ HStack {
|
|
|
+ Image(systemName: "sensor.tag.radiowaves.forward.fill")
|
|
|
+ Text(cgmState.displayName)
|
|
|
+ }
|
|
|
+ .frame(maxWidth: .infinity, minHeight: 50, alignment: .center)
|
|
|
+ .font(.title2)
|
|
|
+ }.padding()
|
|
|
+ } else {
|
|
|
+ VStack {
|
|
|
+ Button {
|
|
|
+ showCGMSelection.toggle()
|
|
|
+ } label: {
|
|
|
+ Text("Add CGM")
|
|
|
+ .font(.title3) }
|
|
|
+ .frame(maxWidth: .infinity, alignment: .center)
|
|
|
+ .buttonStyle(.bordered)
|
|
|
|
|
|
- HStack(alignment: .center) {
|
|
|
- Text(
|
|
|
- "Pair your CGM with Trio. See hint for compatible devices."
|
|
|
- )
|
|
|
- .font(.footnote)
|
|
|
- .foregroundColor(.secondary)
|
|
|
- .lineLimit(nil)
|
|
|
- Spacer()
|
|
|
- Button(
|
|
|
- action: {
|
|
|
- shouldDisplayHint.toggle()
|
|
|
- },
|
|
|
- label: {
|
|
|
- HStack {
|
|
|
- Image(systemName: "questionmark.circle")
|
|
|
+ HStack(alignment: .center) {
|
|
|
+ Text(
|
|
|
+ "Pair your CGM with Trio. See hint for compatible devices."
|
|
|
+ )
|
|
|
+ .font(.footnote)
|
|
|
+ .foregroundColor(.secondary)
|
|
|
+ .lineLimit(nil)
|
|
|
+ Spacer()
|
|
|
+ Button(
|
|
|
+ action: {
|
|
|
+ shouldDisplayHint.toggle()
|
|
|
+ },
|
|
|
+ label: {
|
|
|
+ HStack {
|
|
|
+ Image(systemName: "questionmark.circle")
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- ).buttonStyle(BorderlessButtonStyle())
|
|
|
- }.padding(.top)
|
|
|
- }.padding(.vertical)
|
|
|
+ ).buttonStyle(BorderlessButtonStyle())
|
|
|
+ }.padding(.top)
|
|
|
+ }.padding(.vertical)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
)
|