Compare commits

...

5 Commits

Author SHA1 Message Date
  David Alarcon f41c4a9f35 MOS-20 Force to main queue the uninstallMenuExtra function. 1 year ago
  David Alarcon e5c69c23b5 MOS-20 Force uninstallMenuExtra function runs on main thread. 1 year ago
  David Alarcon b13cd75945 MOS-20 Force notify to run at main queue. 1 year ago
  David Alarcon dd6e9902ed Merge branch 'master' into Release_2.1 1 year ago
  David Alarcon 9b2417b98c Merge branch 'translations' into Release_2.1 1 year ago
2 changed files with 15 additions and 11 deletions
Split View
  1. +10
    -8
      Submodules/pEpNotifications/pEpNotifications/AppDelegate.swift
  2. +5
    -3
      Submodules/pEpNotifications/pEpNotifications/DownloadStateNotifier.swift

+ 10
- 8
Submodules/pEpNotifications/pEpNotifications/AppDelegate.swift View File

@ -184,8 +184,11 @@ extension AppDelegate {
return
}
NSStatusBar.system.removeStatusItem(barItem)
statusBarItem = nil
DispatchQueue.main.async { [weak self] in
guard let me = self else { return }
NSStatusBar.system.removeStatusItem(barItem)
me.statusBarItem = nil
}
}
}
@ -231,7 +234,7 @@ extension AppDelegate: PEPNotificationProtocol {
nc.deliver(un)
product.notification = un
}
downloadStateNotifier.notify(.NewVersionAvailable(String(withName)), with: product)
case .noDownloadAvailable:
@ -287,11 +290,12 @@ extension AppDelegate: NSUserNotificationCenterDelegate {
return
}
uninstallMenuExtra()
let filename : String = didActivate.userInfo?["filename"] as! String
NSLog("pEpNotifications: actionButtonClicked for %@", filename)
NSWorkspace.shared.openFile(filename)
downloadStateNotifier.notify(.Connected)
uninstallMenuExtra()
}
}
@ -313,12 +317,10 @@ extension AppDelegate: NSXPCListenerDelegate {
extension AppDelegate: DownloadNotificationManagerDelegate {
func installSelected(with product: Product) {
defer {
uninstallMenuExtra()
}
NSLog("pEpNotifications: actionButtonClicked for %@", product.filename)
NSWorkspace.shared.openFile(product.filename)
downloadStateNotifier.notify(.Connected)
uninstallMenuExtra()
}
}

+ 5
- 3
Submodules/pEpNotifications/pEpNotifications/DownloadStateNotifier.swift View File

@ -26,9 +26,11 @@ struct DownloadStateNotifier {
}
func notify(_ state: DownloadState, with product: Product? = nil) {
menuItem.title = state.localizedString()
menuItem.isEnabled = (product != nil)
menuItem.representedObject = product
DispatchQueue.main.async {
menuItem.title = state.localizedString()
menuItem.isEnabled = (product != nil)
menuItem.representedObject = product
}
}
}


Loading…
Cancel
Save