From ce2c314d4b343205ca5d4c37c97d1451e83de111 Mon Sep 17 00:00:00 2001 From: Alexander Heinrich Date: Wed, 3 Nov 2021 18:05:46 +0100 Subject: [PATCH] Fixing issues with the Mail plug-in update processs --- .../xcshareddata/swiftpm/Package.resolved | 12 ++++++------ .../OpenHaystack/HaystackApp/FileManager.swift | 2 +- .../HaystackApp/Mail Plugin/MailPluginManager.swift | 6 +----- .../HaystackApp/Views/OpenHaystackMainView.swift | 3 +++ 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/OpenHaystack/OpenHaystack.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/OpenHaystack/OpenHaystack.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 499a646..d24976a 100644 --- a/OpenHaystack/OpenHaystack.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/OpenHaystack/OpenHaystack.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/apple/swift-crypto.git", "state": { "branch": null, - "revision": "9b9d1868601a199334da5d14f4ab2d37d4f8d0c5", - "version": "1.0.2" + "revision": "3bea268b223651c4ab7b7b9ad62ef9b2d4143eb6", + "version": "1.1.6" } }, { @@ -15,8 +15,8 @@ "repositoryURL": "https://github.com/apple/swift-nio.git", "state": { "branch": null, - "revision": "6d3ca7e54e06a69d0f2612c2ce8bb8b7319085a4", - "version": "2.26.0" + "revision": "6aa9347d9bc5bbfe6a84983aec955c17ffea96ef", + "version": "2.33.0" } }, { @@ -24,8 +24,8 @@ "repositoryURL": "https://github.com/apple/swift-nio-ssl", "state": { "branch": null, - "revision": "bbb38fbcbbe9dc4665b2c638dfa5681b01079bfb", - "version": "2.10.4" + "revision": "5e68c1ded15619bb281b273fa8c2d8fd7f7b2b7d", + "version": "2.16.1" } } ] diff --git a/OpenHaystack/OpenHaystack/HaystackApp/FileManager.swift b/OpenHaystack/OpenHaystack/HaystackApp/FileManager.swift index 2cdcdfb..5a16404 100644 --- a/OpenHaystack/OpenHaystack/HaystackApp/FileManager.swift +++ b/OpenHaystack/OpenHaystack/HaystackApp/FileManager.swift @@ -32,7 +32,7 @@ extension FileManager { } else { do { // Copy file - try FileManager.default.copyItem(at: fileURL, to: to.appendingPathComponent(file)) + try self.createFile(atPath: to.appendingPathComponent(file).path, contents: Data(contentsOf: fileURL), attributes: nil) } catch { if fileURL.lastPathComponent != "CodeResources" { throw error diff --git a/OpenHaystack/OpenHaystack/HaystackApp/Mail Plugin/MailPluginManager.swift b/OpenHaystack/OpenHaystack/HaystackApp/Mail Plugin/MailPluginManager.swift index 01e93f6..1736e27 100644 --- a/OpenHaystack/OpenHaystack/HaystackApp/Mail Plugin/MailPluginManager.swift +++ b/OpenHaystack/OpenHaystack/HaystackApp/Mail Plugin/MailPluginManager.swift @@ -87,11 +87,7 @@ struct MailPluginManager { } do { - //Remove old plug-ins first - if FileManager.default.fileExists(atPath: pluginURL.path) { - try FileManager.default.removeItem(at: pluginURL) - } - + // Create the Bundles folder if necessary try FileManager.default.createDirectory(at: pluginsFolderURL, withIntermediateDirectories: true, attributes: nil) } catch { print(error.localizedDescription) diff --git a/OpenHaystack/OpenHaystack/HaystackApp/Views/OpenHaystackMainView.swift b/OpenHaystack/OpenHaystack/HaystackApp/Views/OpenHaystackMainView.swift index 45f90f3..031f292 100644 --- a/OpenHaystack/OpenHaystack/HaystackApp/Views/OpenHaystackMainView.swift +++ b/OpenHaystack/OpenHaystack/HaystackApp/Views/OpenHaystackMainView.swift @@ -135,6 +135,7 @@ struct OpenHaystackMainView: View { action: { if !self.mailPluginIsActive { self.showMailPlugInPopover.toggle() + self.checkPluginIsRunning(silent: true, nil) } else { self.downloadLocationReports() } @@ -177,9 +178,11 @@ struct OpenHaystackMainView: View { if pluginManager.isMailPluginInstalled == false { // Install the mail plugin self.alertType = .activatePlugin + self.checkPluginIsRunning(silent: true, nil) } else { self.checkPluginIsRunning(nil) } + } /// Download the location reports for all current accessories. Shows an error if something fails, like plug-in is missing