Skip to content

Commit

Permalink
Fix unreachable catch blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
livid committed Oct 30, 2023
1 parent ae757b1 commit 770c143
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 22 deletions.
50 changes: 29 additions & 21 deletions Planet/Views/Sidebar/MyPlanetSidebarItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ struct MyPlanetSidebarItem: View {
Spacer()
if planet.isPublishing {
LoadingIndicatorView()
} else {
}
else {
if planet.isPinned {
Image(systemName: "externaldrive.fill.badge.checkmark")
.foregroundColor(.secondary)
Expand Down Expand Up @@ -302,11 +303,18 @@ struct MyPlanetSidebarItem: View {

private func openVSCode(_ template: Template) {
guard
let appUrl = NSWorkspace.shared.urlForApplication(withBundleIdentifier: "com.microsoft.VSCode")
let appUrl = NSWorkspace.shared.urlForApplication(
withBundleIdentifier: "com.microsoft.VSCode"
)
else { return }

let url = URL(fileURLWithPath: template.path.path)
NSWorkspace.shared.open([url], withApplicationAt: appUrl, configuration: self.openConfiguration(), completionHandler: nil)
NSWorkspace.shared.open(
[url],
withApplicationAt: appUrl,
configuration: self.openConfiguration(),
completionHandler: nil
)
}

@ViewBuilder
Expand All @@ -321,17 +329,17 @@ struct MyPlanetSidebarItem: View {
}

Button {
do {
Task(priority: .background) {
PlanetStore.shared.selectedView = .myPlanet(planet)
Task(priority: .background) {
PlanetStore.shared.selectedView = .myPlanet(planet)
do {
try await planet.quickRebuild()
}
}
catch {
Task { @MainActor in
self.planetStore.isShowingAlert = true
self.planetStore.alertTitle = "Failed to Quick Rebuild Planet"
self.planetStore.alertMessage = error.localizedDescription
catch {
Task { @MainActor in
self.planetStore.isShowingAlert = true
self.planetStore.alertTitle = "Failed to Quick Rebuild Planet"
self.planetStore.alertMessage = error.localizedDescription
}
}
}
} label: {
Expand All @@ -340,17 +348,17 @@ struct MyPlanetSidebarItem: View {
.keyboardShortcut("r", modifiers: [.command, .shift])

Button {
do {
Task(priority: .background) {
PlanetStore.shared.selectedView = .myPlanet(planet)
Task(priority: .background) {
PlanetStore.shared.selectedView = .myPlanet(planet)
do {
try await planet.rebuild()
}
}
catch {
Task { @MainActor in
self.planetStore.isShowingAlert = true
self.planetStore.alertTitle = "Failed to Rebuild Planet"
self.planetStore.alertMessage = error.localizedDescription
catch {
Task { @MainActor in
self.planetStore.isShowingAlert = true
self.planetStore.alertTitle = "Failed to Rebuild Planet"
self.planetStore.alertMessage = error.localizedDescription
}
}
}
} label: {
Expand Down
2 changes: 1 addition & 1 deletion Planet/versioning.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CURRENT_PROJECT_VERSION = 1756
CURRENT_PROJECT_VERSION = 1757

0 comments on commit 770c143

Please sign in to comment.