Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature / Show development profile warning #248

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 78 additions & 27 deletions AppSigner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,31 @@ class AppDelegate: NSObject, NSApplicationDelegate {

@IBOutlet weak var mainView: MainView!
@objc let fileManager = FileManager.default



func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
func applicationDidFinishLaunching(
_ aNotification: Notification
) {

}

func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
func applicationWillTerminate(
_ aNotification: Notification
) {

try? fileManager.removeItem(atPath: Log.logName)
}

func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
func applicationShouldTerminateAfterLastWindowClosed(
_ sender: NSApplication
) -> Bool {

return true
}


// MARK: - Actions: -

@IBAction func fixSigning(_ sender: NSMenuItem) {
if let tempFolder = mainView.makeTempFolder() {
iASShared.fixSigning(tempFolder)
Expand All @@ -35,32 +46,72 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
}

@IBAction func nsMenuLinkClick(_ sender: NSMenuLink) {
NSWorkspace.shared.open(URL(string: sender.url!)!)
@IBAction func nsMenuLinkClick(
_ sender: NSMenuLink
) {

NSWorkspace.shared.open(
URL(string: sender.url!)!
)
}
@IBAction func viewLog(_ sender: AnyObject) {

@IBAction func viewLog(
_ sender: AnyObject
) {

NSWorkspace.shared.openFile(Log.logName)
}
@IBAction func checkForUpdates(_ sender: NSMenuItem) {
UpdatesController.checkForUpdate(forceShow: true)
func updateCheckStatus(_ status: Bool, data: Data?, response: URLResponse?, error: Error?){

@IBAction func checkForUpdates(
_ sender: NSMenuItem
) {

UpdatesController.checkForUpdate(
forceShow: true
)

func updateCheckStatus(
_ status: Bool,
data: Data?,
response: URLResponse?,
error: Error?
){

if status == false {
DispatchQueue.main.async {
let alert = NSAlert()


if error != nil {
alert.messageText = "There was a problem checking for a new version."
alert.informativeText = "More information is available in the application log."
Log.write(error!.localizedDescription)
} else {
alert.messageText = "You are currently running the latest version."
}
alert.runModal()
}

showInvaldNewVersionAlert(
error: error
)
}
}
UpdatesController.checkForUpdate(forceShow: true, callbackFunc: updateCheckStatus)

UpdatesController.checkForUpdate(
forceShow: true,
callbackFunc: updateCheckStatus
)
}
}

private func showInvaldNewVersionAlert(
error: Error?
) {

DispatchQueue.main.async {

let alert = NSAlert()

if error != nil {

alert.messageText = "There was a problem checking for a new version."
alert.informativeText = "More information is available in the application log."
Log.write(error!.localizedDescription)
}

else {

alert.messageText = "You are currently running the latest version."
}

alert.runModal()
}
}
}
Loading