Fix active profile not preselected on launch
Function called multiple times sets isFirstLaunch to true even if not active profile.
This commit is contained in:
parent
18e9f7cbb5
commit
923ea923ab
|
@ -101,7 +101,7 @@ extension OrganizerView {
|
||||||
ProfileHeaderRow(header: header)
|
ProfileHeaderRow(header: header)
|
||||||
}
|
}
|
||||||
}.onAppear {
|
}.onAppear {
|
||||||
preselectActiveProfile(header.id)
|
preselectIfActiveProfile(header.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,23 +134,22 @@ extension OrganizerView.ProfilesList {
|
||||||
}
|
}
|
||||||
|
|
||||||
extension OrganizerView.ProfilesList {
|
extension OrganizerView.ProfilesList {
|
||||||
private func preselectActiveProfile(_ id: UUID) {
|
private func preselectIfActiveProfile(_ id: UUID) {
|
||||||
guard isFirstLaunch else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
isFirstLaunch = false
|
|
||||||
|
|
||||||
// do not push profile if:
|
// do not push profile if:
|
||||||
//
|
//
|
||||||
// - an alert is active, as it would break navigation
|
// - an alert is active, as it would break navigation
|
||||||
// - on iPad, as it's already shown
|
// - on iPad, as it's already shown
|
||||||
//
|
//
|
||||||
if alertType == nil,
|
guard alertType == nil, themeIdiom != .pad, id == profileManager.activeHeader?.id else {
|
||||||
themeIdiom != .pad,
|
return
|
||||||
id == profileManager.activeHeader?.id {
|
|
||||||
|
|
||||||
selectedProfileId = id
|
|
||||||
}
|
}
|
||||||
|
guard isFirstLaunch else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
isFirstLaunch = false
|
||||||
|
|
||||||
|
selectedProfileId = id
|
||||||
}
|
}
|
||||||
|
|
||||||
private func performMigrationsIfNeeded() {
|
private func performMigrationsIfNeeded() {
|
||||||
|
|
Loading…
Reference in New Issue