Fix slow active profile selection on launch

Regression due to missing .stack navigation style basically.

Restore .onAppear() on NavigationLink.
This commit is contained in:
Davide De Rosa 2022-05-02 09:53:18 +02:00
parent 75650b1f0a
commit 576eb1512a
2 changed files with 10 additions and 2 deletions

View File

@ -52,6 +52,7 @@ extension View {
let color = themeAccentColor
return accentColor(color)
.toggleStyle(SwitchToggleStyle(tint: color))
.themeNavigationViewStyle()
#endif
}

View File

@ -125,8 +125,6 @@ struct OrganizerView: View {
return ZStack {
hiddenSceneView
mainView
.onAppear(perform: presentActiveProfile)
if !profileManager.hasProfiles {
emptyView
}
@ -209,6 +207,8 @@ struct OrganizerView: View {
profileLabel(forHeader: header)
}.contextMenu {
profileMenu(forHeader: header)
}.onAppear {
presentIfActiveProfile(header.id)
}
}
@ -338,6 +338,13 @@ extension OrganizerView {
}
extension OrganizerView {
private func presentIfActiveProfile(_ id: UUID) {
guard id == profileManager.activeHeader?.id else {
return
}
presentActiveProfile()
}
private func presentActiveProfile() {
guard isFirstLaunch else {
return