From 770c1433424cf8c4d72464674485b7d123546fbd Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Mon, 30 Oct 2023 08:01:13 -0700 Subject: [PATCH] Fix unreachable catch blocks --- .../Views/Sidebar/MyPlanetSidebarItem.swift | 50 +++++++++++-------- Planet/versioning.xcconfig | 2 +- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/Planet/Views/Sidebar/MyPlanetSidebarItem.swift b/Planet/Views/Sidebar/MyPlanetSidebarItem.swift index 6725d228..d2a549c5 100644 --- a/Planet/Views/Sidebar/MyPlanetSidebarItem.swift +++ b/Planet/Views/Sidebar/MyPlanetSidebarItem.swift @@ -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) @@ -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 @@ -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: { @@ -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: { diff --git a/Planet/versioning.xcconfig b/Planet/versioning.xcconfig index daa0ebd3..1bc0f70a 100644 --- a/Planet/versioning.xcconfig +++ b/Planet/versioning.xcconfig @@ -1 +1 @@ -CURRENT_PROJECT_VERSION = 1756 +CURRENT_PROJECT_VERSION = 1757