mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
use onAppear to set selectedEnvironment in debug menu
This commit is contained in:
parent
76c56dcdad
commit
1aaab4d337
2 changed files with 5 additions and 6 deletions
|
|
@ -6,14 +6,10 @@ import Views
|
|||
struct DebugMenuView: View {
|
||||
@EnvironmentObject var authenticator: Authenticator
|
||||
@EnvironmentObject var dataService: DataService
|
||||
@State private var selectedEnvironment: AppEnvironment
|
||||
@State private var selectedEnvironment = AppEnvironment.dev
|
||||
|
||||
let appEnvironments: [AppEnvironment] = [.local, .demo, .dev, .prod]
|
||||
|
||||
init(initialEnvironment: AppEnvironment) {
|
||||
self._selectedEnvironment = State(initialValue: initialEnvironment)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Text("Debug Menu")
|
||||
|
|
@ -38,5 +34,8 @@ struct DebugMenuView: View {
|
|||
.buttonStyle(SolidCapsuleButtonStyle(width: 220))
|
||||
}
|
||||
.padding()
|
||||
.onAppear {
|
||||
selectedEnvironment = dataService.appEnvironment
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ struct WelcomeView: View {
|
|||
public var body: some View {
|
||||
primaryContent()
|
||||
.sheet(isPresented: $showDebugModal) {
|
||||
DebugMenuView(initialEnvironment: dataService.appEnvironment)
|
||||
DebugMenuView()
|
||||
}
|
||||
.onReceive(Publishers.keyboardHeight) { isKeyboardOnScreen = $0 > 1 }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue