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

39 lines
1 KiB
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, .prod]
2022-02-23 23:15:44 +00:00
var body: some View {
VStack {
Text(LocalText.menuDebugTitle)
2022-02-23 23:15:44 +00:00
.font(.appTitle)
Form {
Text(LocalText.menuDebugApiEnv)
Picker(selection: $selectedEnvironment, label: Text(LocalText.menuDebugApiEnv)) {
2022-02-23 23:15:44 +00:00
ForEach(appEnvironments, id: \.self) {
Text($0.rawValue)
}
}
.pickerStyle(SegmentedPickerStyle())
}
Button(
action: {
authenticator.logout(dataService: dataService)
dataService.switchAppEnvironment(appEnvironment: selectedEnvironment)
},
2023-01-25 21:09:19 +00:00
label: { Text(LocalText.genericChangeApply) }
2022-02-23 23:15:44 +00:00
)
.buttonStyle(SolidCapsuleButtonStyle(width: 220))
}
.padding()
}
}