2022-02-23 23:15:44 +00:00
|
|
|
import Models
|
2022-02-24 01:08:16 +00:00
|
|
|
import Services
|
2022-02-23 23:15:44 +00:00
|
|
|
import SwiftUI
|
|
|
|
|
import Views
|
|
|
|
|
|
|
|
|
|
struct DebugMenuView: View {
|
2022-02-24 01:08:16 +00:00
|
|
|
@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
|
|
|
|
2023-01-19 10:26:28 +00:00
|
|
|
let appEnvironments: [AppEnvironment] = [.local, .demo, .prod]
|
2022-02-23 23:15:44 +00:00
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
|
VStack {
|
2023-01-25 20:45:12 +00:00
|
|
|
Text(LocalText.menuDebugTitle)
|
2022-02-23 23:15:44 +00:00
|
|
|
.font(.appTitle)
|
|
|
|
|
Form {
|
2023-01-25 20:45:12 +00:00
|
|
|
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(
|
2022-02-24 01:08:16 +00:00
|
|
|
action: {
|
2022-06-23 20:55:12 +00:00
|
|
|
authenticator.logout(dataService: dataService)
|
2022-02-24 01:08:16 +00:00
|
|
|
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()
|
|
|
|
|
}
|
|
|
|
|
}
|