Clover.app v1.08 Beta

There was a bug creating the temporary directory for the download of new Clover revision, fixed. Now the app version label is clickable and open the Clover repository at github in the user default web browser.
This commit is contained in:
vectorsigma72 2019-11-22 18:27:15 +01:00
parent 32c2f6e103
commit 7c54bef85e
3 changed files with 22 additions and 12 deletions

View File

@ -855,7 +855,7 @@
CODE_SIGN_ENTITLEMENTS = Clover/Clover.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.08;
CURRENT_PROJECT_VERSION = 1.09;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Clover/Frameworks",
@ -869,7 +869,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Clover/Frameworks",
);
MARKETING_VERSION = 1.08;
MARKETING_VERSION = 1.09;
PRODUCT_BUNDLE_IDENTIFIER = org.slice.Clover;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
@ -884,7 +884,7 @@
CODE_SIGN_ENTITLEMENTS = Clover/Clover.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.08;
CURRENT_PROJECT_VERSION = 1.09;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Clover/Frameworks",
@ -898,7 +898,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Clover/Frameworks",
);
MARKETING_VERSION = 1.08;
MARKETING_VERSION = 1.09;
PRODUCT_BUNDLE_IDENTIFIER = org.slice.Clover;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;

View File

@ -34,7 +34,7 @@ func getLatestRelease(reply: @escaping (String?, String?) -> Void) {
if (line.range(of: "href=\"/CloverHackyColor/CloverBootloader/releases/download/") != nil) {
link = line.components(separatedBy: "href=\"")[1]
link = "https://github.com\(link.components(separatedBy: "\"")[0])"
print(link)
//print(link)
if link.lastPath.hasPrefix("CloverV2") && link.hasSuffix(".zip") {
vers = link.components(separatedBy: "/releases/download/")[1]
vers = vers.components(separatedBy: "/")[0]

View File

@ -123,6 +123,9 @@ class SettingsViewController: NSViewController, NSTextFieldDelegate, URLSessionD
selector: #selector(self.setUpdateTimer),
userInfo: nil,
repeats: true)
let clickVersion = NSClickGestureRecognizer(target: self, action: #selector(goToWebSite))
self.appVersionField.addGestureRecognizer(clickVersion)
}
func setUpdateInformations() {
@ -150,6 +153,12 @@ class SettingsViewController: NSViewController, NSTextFieldDelegate, URLSessionD
}
}
// MARK: Go to Website
@objc func goToWebSite() {
let link = "https://github.com/CloverHackyColor/CloverBootloader"
NSWorkspace.shared.open(URL(string: link)!)
}
// MARK: Disks
func searchESPDisks() {
self.unmountButton.isEnabled = false
@ -565,16 +574,21 @@ class SettingsViewController: NSViewController, NSTextFieldDelegate, URLSessionD
let lastPath = downloadTask.originalRequest!.url!.lastPathComponent
let data = try Data(contentsOf: location)
if lastPath.fileExtension == "zip" && lastPath.hasPrefix("CloverV2") {
// ok, We have the download completed: replace CloverV2 inside SharedSupport directory!
// Decompress the zip archive
let tempDir = NSTemporaryDirectory().addPath("CloverXXXXX")
// NSUserName() ensure the user have read write permissions
let tempDir = "/tmp/CloverXXXXX\(NSUserName())Update"
if fm.fileExists(atPath: tempDir) {
try fm.removeItem(atPath: tempDir)
try fm.createDirectory(atPath: tempDir, withIntermediateDirectories: true, attributes: nil)
}
try fm.createDirectory(atPath: tempDir,
withIntermediateDirectories: false,
attributes: nil)
let file = tempDir.addPath(lastPath)
try data.write(to: URL(fileURLWithPath: file))
unzip(file: file, destination: tempDir) { (success) in
@ -582,9 +596,6 @@ class SettingsViewController: NSViewController, NSTextFieldDelegate, URLSessionD
self.replaceCloverV2(with: tempDir.addPath("CloverV2"))
}
}
} else {
try data.write(to: URL(fileURLWithPath: NSHomeDirectory().addPath("Downloads/\(lastPath)")))
replaceCloverV2(with: "/Users/vectorsigma/src/CloverBootloader/CloverPackage/CloverV2")
}
} catch {
@ -632,7 +643,6 @@ class SettingsViewController: NSViewController, NSTextFieldDelegate, URLSessionD
do {
try fm.removeItem(atPath: Cloverv2Path)
try fm.copyItem(atPath: newOne, toPath: Cloverv2Path)
print("CloverV2 Replaced!")
DispatchQueue.main.async {
self.lastReleaseRev = nil
self.lastReleaseLink = nil