mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
Remove InfoPane from split view instead of hiding it
When it was hidden the split view would still allow you to resize the remaining split, which resulted in weird behaviour. Instead, just remove the info pane split and the split view doesn't let you resize. Had to move where this global alert lives as a result because it might have to be presented even if the info pane isn't visible. I tried changing the alert so it wasn't on the main window, and was instead local to the buttons that triggered its presentation, and this worked for all but the case where the CancelInstallButton was used from the Xcode menu. So for now I left it close to where it already was.
This commit is contained in:
parent
e5065b4a58
commit
1dd6232891
1 changed files with 16 additions and 13 deletions
|
|
@ -24,19 +24,11 @@ struct MainWindow: View {
|
|||
primaryButton: .destructive(Text("Uninstall"), action: { self.appState.uninstall(id: xcode.id) }),
|
||||
secondaryButton: .cancel(Text("Cancel")))
|
||||
}
|
||||
InfoPane(selectedXcodeID: selectedXcodeID)
|
||||
.frame(minWidth: 300, maxWidth: .infinity)
|
||||
.frame(width: isShowingInfoPane ? nil : 0)
|
||||
.isHidden(!isShowingInfoPane)
|
||||
// This alert isn't intentionally placed here,
|
||||
// just trying to put it in a unique part of the hierarchy
|
||||
// since you can't have more than one in the same spot.
|
||||
.alert(item: $appState.xcodeBeingConfirmedForInstallCancellation) { xcode in
|
||||
Alert(title: Text("Are you sure you want to stop the installation of Xcode \(xcode.description)?"),
|
||||
message: Text("Any progress will be discarded."),
|
||||
primaryButton: .destructive(Text("Stop Installation"), action: { self.appState.cancelInstall(id: xcode.id) }),
|
||||
secondaryButton: .cancel(Text("Cancel")))
|
||||
}
|
||||
|
||||
if isShowingInfoPane {
|
||||
InfoPane(selectedXcodeID: selectedXcodeID)
|
||||
.frame(minWidth: 300, maxWidth: .infinity)
|
||||
}
|
||||
}
|
||||
.mainToolbar(
|
||||
category: $category,
|
||||
|
|
@ -51,6 +43,17 @@ struct MainWindow: View {
|
|||
.environmentObject(appState)
|
||||
}
|
||||
// This overlay is only here to work around the one-alert-per-view limitation
|
||||
.overlay(
|
||||
Color.clear
|
||||
// This particular alert could be added specifically to InstallationStepView and CancelInstallButton _except_ for when CancelInstallButton is used in the Xcode CommandMenu, so it's here for now.
|
||||
.alert(item: $appState.xcodeBeingConfirmedForInstallCancellation) { xcode in
|
||||
Alert(title: Text("Are you sure you want to stop the installation of Xcode \(xcode.description)?"),
|
||||
message: Text("Any progress will be discarded."),
|
||||
primaryButton: .destructive(Text("Stop Installation"), action: { self.appState.cancelInstall(id: xcode.id) }),
|
||||
secondaryButton: .cancel(Text("Cancel")))
|
||||
}
|
||||
)
|
||||
// This overlay is only here to work around the one-alert-per-view limitation
|
||||
.overlay(
|
||||
Color.clear
|
||||
.alert(isPresented: $appState.isPreparingUserForActionRequiringHelper.isNotNil) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue