Files
omnivore/apple/OmnivoreKit/Sources/App/Views/DebugMenuView.swift
2022-07-06 09:38:24 -07:00

39 lines
999 B
Swift

import Models
import Services
import SwiftUI
import Views
struct DebugMenuView: View {
@EnvironmentObject var authenticator: Authenticator
@EnvironmentObject var dataService: DataService
@Binding var selectedEnvironment: AppEnvironment
let appEnvironments: [AppEnvironment] = [.local, .demo, .dev, .prod]
var body: some View {
VStack {
Text("Debug Menu")
.font(.appTitle)
Form {
Text("API Environment:")
Picker(selection: $selectedEnvironment, label: Text("API Environment:")) {
ForEach(appEnvironments, id: \.self) {
Text($0.rawValue)
}
}
.pickerStyle(SegmentedPickerStyle())
}
Button(
action: {
authenticator.logout(dataService: dataService)
dataService.switchAppEnvironment(appEnvironment: selectedEnvironment)
},
label: { Text("Apply Changes") }
)
.buttonStyle(SolidCapsuleButtonStyle(width: 220))
}
.padding()
}
}