Skip to content

Commit

Permalink
Add update check on background queue on every pop-up open.
Browse files Browse the repository at this point in the history
  • Loading branch information
melgu committed Aug 17, 2020
1 parent dd87de9 commit 82b62ef
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Denon Volume.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.24;
CURRENT_PROJECT_VERSION = 1.25;
DEVELOPMENT_TEAM = V7E5P7292M;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -649,7 +649,7 @@
"@loader_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 1.24;
MARKETING_VERSION = 1.25;
PRODUCT_BUNDLE_IDENTIFIER = "com.melgu.Denon-Volume";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -666,7 +666,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.24;
CURRENT_PROJECT_VERSION = 1.25;
DEVELOPMENT_TEAM = V7E5P7292M;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -680,7 +680,7 @@
"@loader_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 1.24;
MARKETING_VERSION = 1.25;
PRODUCT_BUNDLE_IDENTIFIER = "com.melgu.Denon-Volume";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
18 changes: 15 additions & 3 deletions Denon Volume/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSTouchBarDelegate {
// Objects
let denonCommunicator = DenonCommunicator()
var menuViewController: MenuViewController?

// UpdateNotification
let updateNotification = UpdateNotification(feedUrl: URL(string: "http://www.melvin-gundlach.de/apps/app-feeds/Denon-Volume.json")!)

// Global Hotkeys
Expand Down Expand Up @@ -84,6 +86,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSTouchBarDelegate {
if let button = statusItem.button {
print("showPopover Inside Button")
popover.show(relativeTo: button.bounds, of: button, preferredEdge: NSRectEdge.minY)

updateCheck()
}
print("showPopover Button done")

Expand All @@ -104,6 +108,17 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSTouchBarDelegate {
}
}

// MARK: - Func: UpdateNotification

func updateCheck() {
DispatchQueue.global(qos: .background).async { [unowned self] in
if updateNotification.checkForUpdates() {
DispatchQueue.main.async {
updateNotification.showNewVersionView()
}
}
}
}

// MARK: - Func: Other

Expand Down Expand Up @@ -263,9 +278,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSTouchBarDelegate {
NSTouchBar.minimizeSystemModalTouchBar(groupTouchBar)
print("Touch Bar finished")

if updateNotification.checkForUpdates() {
updateNotification.showNewVersionView()
}
print("applicationDidFinishLaunching finished")
}

Expand Down

0 comments on commit 82b62ef

Please sign in to comment.