Skip to content

Commit

Permalink
Early access 3
Browse files Browse the repository at this point in the history
 * Added sketch file for new icons
 * Fixed notification 'bounce'
 * Updates for Xcode 8, beta 3
  • Loading branch information
Alan Westbrook committed Jul 19, 2016
1 parent 9326ced commit 8f6e692
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Binary file added Orangered-Swift/Orangered.sketch
Binary file not shown.
10 changes: 7 additions & 3 deletions Orangered-Swift/StatusItemController.swift
Expand Up @@ -14,6 +14,7 @@ private let kRedditCookieURL = URL(string: "https://reddit.com")
private let kLoginMenuTitle = NSLocalizedString("Login…", comment: "Menu item title for bringing up the login window")
private let kLogoutMenuTitle = NSLocalizedString("Log Out", comment: "Menu item title for logging out")
private let kAttemptingLoginTitle = NSLocalizedString("Attempting Login…", comment: "Title of the login menu item while it's attemping to log in")
private let kOpenMailboxRecheckDelay = 5.0

class StatusItemController: NSObject, NSUserNotificationCenterDelegate {

Expand Down Expand Up @@ -238,11 +239,14 @@ class StatusItemController: NSObject, NSUserNotificationCenterDelegate {
if let newMailCount = jsonActual["inbox_count"] as? Int {
if newMailCount != mailCount {
mailCount = newMailCount
notifyMail()

if mailCount > 0 {
notifyMail()
}
}
}

if let modMailState = jsonActual["has_mod_mail"] as? Bool where modMailState == true {
if let modMailState = jsonActual["has_mod_mail"] as? Bool, modMailState == true {
state = .modmail
return
}
Expand Down Expand Up @@ -307,7 +311,7 @@ class StatusItemController: NSObject, NSUserNotificationCenterDelegate {
NSWorkspace.shared().open(url)
}

DispatchQueue.main.after(when: DispatchTime.now() + 5) {
DispatchQueue.main.after(when: DispatchTime.now() + kOpenMailboxRecheckDelay) {
self.checkReddit()
}

Expand Down
2 changes: 1 addition & 1 deletion Orangered-Swift/UserDefaults+Orangered.swift
Expand Up @@ -63,7 +63,7 @@ extension UserDefaults {
&passwordLength,
&passwordData,
&UserDefaults.keychainItem)
if let pass = passwordData where err == errSecSuccess {
if let pass = passwordData, err == errSecSuccess {
let password = String(bytesNoCopy: pass, length: Int(passwordLength), encoding: String.Encoding.utf8, freeWhenDone: true)
return password
}
Expand Down

0 comments on commit 8f6e692

Please sign in to comment.