omnivore/apple/OmnivoreKit/Sources/App/Views/DebugMenuView.swift

39 lines
975 B
Swift
Raw Normal View History

2022-02-23 23:15:44 +00:00
import Models
import Services
2022-02-23 23:15:44 +00:00
import SwiftUI
import Views
struct DebugMenuView: View {
@EnvironmentObject var authenticator: Authenticator
@EnvironmentObject var dataService: DataService
2022-02-28 20:32:42 +00:00
@Binding var selectedEnvironment: AppEnvironment
2022-02-23 23:15:44 +00:00
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.switchAppEnvironment(appEnvironment: selectedEnvironment)
},
2022-02-23 23:15:44 +00:00
label: { Text("Apply Changes") }
)
.buttonStyle(SolidCapsuleButtonStyle(width: 220))
}
.padding()
}
}