| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- import SwiftUI
- import Swinject
- extension AppDiagnostics {
- struct RootView: BaseView {
- let resolver: Resolver
- @State var state = StateModel()
- @Environment(\.colorScheme) var colorScheme
- @Environment(AppState.self) var appState
- var body: some View {
- List {
- Section(
- header: Text("Anonymized Data Sharing"),
- content: {
- VStack {
- ForEach(DiagnosticsSharingOption.allCases, id: \.self) { option in
- Button(action: {
- state.diagnosticsSharingOption = option
- }) {
- HStack {
- Image(
- systemName: state
- .diagnosticsSharingOption == option ? "largecircle.fill.circle" : "circle"
- )
- .foregroundColor(state.diagnosticsSharingOption == option ? .accentColor : .secondary)
- .imageScale(.large)
- Text(option.displayName)
- .foregroundColor(.primary)
- Spacer()
- }
- .background(Color.chart.opacity(0.65))
- .cornerRadius(10)
- }
- .buttonStyle(.plain)
- }
- .padding()
- }
- .onChange(of: state.diagnosticsSharingOption) {
- state.applyDiagnostics()
- }
- }
- ).listRowBackground(Color.chart)
- Section {
- VStack(alignment: .leading, spacing: 8) {
- Text("Why does Trio collect this data?").bold()
- VStack(alignment: .leading, spacing: 4) {
- Text(
- "• App diagnostic insights help us enhance app stability, ensure safety for all users, and enable us to quickly identify and resolve critical issues."
- )
- Text(
- "• Trio collects the app's state on crash, device, iOS and general system info, and a stack trace."
- )
- Text(
- "• Trio does not collect any health related data, e.g. glucose readings, insulin rates or doses, meal data, setting values, or similar."
- )
- Text(
- "• Trio does not track any usage metrics or any other personal data about users other than the used iPhone model and iOS version."
- )
- }
- Text(
- "Diagnostics are sent to a Google Firebase Crashlytics project, which is securely maintained and accessed only by the Trio team."
- )
- }
- .font(.footnote)
- .multilineTextAlignment(.leading)
- .foregroundStyle(Color.secondary)
- }.listRowBackground(Color.clear)
- }
- .listSectionSpacing(sectionSpacing)
- .scrollContentBackground(.hidden).background(appState.trioBackgroundColor(for: colorScheme))
- .onAppear(perform: configureView)
- .navigationBarTitle("App Diagnostics")
- .navigationBarTitleDisplayMode(.automatic)
- }
- }
- }
|