mirror of
https://github.com/ninxsoft/Mist.git
synced 2024-09-20 07:49:40 -04:00
Add Show in Finder button to download view
This commit is contained in:
parent
e9543a4a8a
commit
0392412d3e
1 changed files with 16 additions and 2 deletions
|
@ -16,6 +16,8 @@ struct DownloadView: View {
|
|||
var presentationMode: Binding<PresentationMode>
|
||||
@AppStorage("enableNotifications")
|
||||
private var enableNotifications: Bool = false
|
||||
@AppStorage("showInFinder")
|
||||
private var showInFinder: Bool = false
|
||||
var downloadType: DownloadType
|
||||
var imageName: String
|
||||
var name: String
|
||||
|
@ -63,9 +65,13 @@ struct DownloadView: View {
|
|||
}
|
||||
}
|
||||
Divider()
|
||||
HStack {
|
||||
Toggle("Show in Finder upon completion", isOn: $showInFinder)
|
||||
Spacer()
|
||||
Button(buttonText) {
|
||||
stop()
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
.frame(width: width, height: height)
|
||||
|
@ -137,6 +143,14 @@ struct DownloadView: View {
|
|||
if enableNotifications {
|
||||
sendNotification(for: downloadType, name: name, version: version, build: build, success: true)
|
||||
}
|
||||
|
||||
if showInFinder {
|
||||
guard let url: URL = destinationURL else {
|
||||
return
|
||||
}
|
||||
|
||||
NSWorkspace.shared.selectFile(url.path, inFileViewerRootedAtPath: "")
|
||||
}
|
||||
}
|
||||
|
||||
private func checkForUserCancellation(_ failure: Error) -> Bool {
|
||||
|
|
Loading…
Reference in a new issue