From 8cd2528835dc201f10daabe873264a5f908f511a Mon Sep 17 00:00:00 2001 From: Eryan Cobham Date: Wed, 20 Jul 2016 17:04:50 -0500 Subject: [PATCH 1/9] Added Harbor Credits --- Harbor.xcodeproj/project.pbxproj | 12 ++++++++++++ Harbor/BuildView.xib | 4 ++-- Harbor/Credits.rtf | 13 +++++++++++++ Harbor/Info.plist | 6 ++---- 4 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 Harbor/Credits.rtf diff --git a/Harbor.xcodeproj/project.pbxproj b/Harbor.xcodeproj/project.pbxproj index 614ad1d..17f868b 100644 --- a/Harbor.xcodeproj/project.pbxproj +++ b/Harbor.xcodeproj/project.pbxproj @@ -40,6 +40,7 @@ 31CEEC161D3826BD0023A5AC /* NSButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31CEEC151D3826BD0023A5AC /* NSButton.swift */; }; 4C86D9FC1CE50142008E91E4 /* codeshipLogo_blue.png in Resources */ = {isa = PBXBuildFile; fileRef = 4C86D9FA1CE50142008E91E4 /* codeshipLogo_blue.png */; }; 4C86D9FD1CE50142008E91E4 /* codeshipLogo_blue@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4C86D9FB1CE50142008E91E4 /* codeshipLogo_blue@2x.png */; }; + 721620151D401E4A00EE239C /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 721620141D401E4A00EE239C /* Credits.rtf */; }; CDD5638F36C28F1CBED22C30 /* Pods_Harbor_HarborTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1EF75FA103814CE2B8C146C9 /* Pods_Harbor_HarborTests.framework */; }; D01093BC1BB5B3D7002D5794 /* SettingsSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D01093BB1BB5B3D7002D5794 /* SettingsSpec.swift */; }; D01093BF1BB5D932002D5794 /* NotificationCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = D01093BE1BB5D932002D5794 /* NotificationCenter.swift */; }; @@ -161,6 +162,7 @@ 6A44CEAA7EBDF79EBEA74B01 /* Pods-Harbor-HarborTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Harbor-HarborTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.release.xcconfig"; sourceTree = ""; }; 6AB17BFC533903194B2259FA /* Pods-HarborTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HarborTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-HarborTests/Pods-HarborTests.release.xcconfig"; sourceTree = ""; }; 7150961101FB11B6275D20F3 /* Pods_HarborTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_HarborTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 721620141D401E4A00EE239C /* Credits.rtf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = ""; }; 9F06F0036A0C8CA9A3D11BA6 /* Pods-Harbor.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Harbor.release.xcconfig"; path = "Pods/Target Support Files/Pods-Harbor/Pods-Harbor.release.xcconfig"; sourceTree = ""; }; C0CEA4AAFB6873D19A822129 /* Pods-Harbor.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Harbor.test.xcconfig"; path = "Pods/Target Support Files/Pods-Harbor/Pods-Harbor.test.xcconfig"; sourceTree = ""; }; D01093BB1BB5B3D7002D5794 /* SettingsSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = SettingsSpec.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; @@ -324,6 +326,14 @@ name = View; sourceTree = ""; }; + 721620101D401E0000EE239C /* Resources */ = { + isa = PBXGroup; + children = ( + 721620141D401E4A00EE239C /* Credits.rtf */, + ); + name = Resources; + sourceTree = ""; + }; A338C7D8E749FE47B694D06D /* Pods */ = { isa = PBXGroup; children = ( @@ -441,6 +451,7 @@ D0772F0A1B3C437800031FB9 /* Harbor */ = { isa = PBXGroup; children = ( + 721620101D401E0000EE239C /* Resources */, 10FA200E1C933E1B00A642A7 /* Application.swift */, D0772F0B1B3C437800031FB9 /* AppDelegate.swift */, D08EAB3F1B98D5D5009564CE /* Views */, @@ -655,6 +666,7 @@ 4C86D9FD1CE50142008E91E4 /* codeshipLogo_blue@2x.png in Resources */, D08EAB3B1B98A60A009564CE /* codeshipLogo_red.png in Resources */, D08EAB391B98A60A009564CE /* codeshipLogo_green.png in Resources */, + 721620151D401E4A00EE239C /* Credits.rtf in Resources */, D08EAB321B97531A009564CE /* MainMenu.xib in Resources */, D0B1777A1B9651BD0055ECC6 /* codeshipLogo_black@2x.png in Resources */, D0B177791B9651BD0055ECC6 /* codeshipLogo_black.png in Resources */, diff --git a/Harbor/BuildView.xib b/Harbor/BuildView.xib index ef68665..9153a63 100644 --- a/Harbor/BuildView.xib +++ b/Harbor/BuildView.xib @@ -1,7 +1,7 @@ - + - + diff --git a/Harbor/Credits.rtf b/Harbor/Credits.rtf new file mode 100644 index 0000000..30ff2bf --- /dev/null +++ b/Harbor/Credits.rtf @@ -0,0 +1,13 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1404\cocoasubrtf470 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\margl1440\margr1440\vieww9000\viewh8400\viewkind0 +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0 + +\f0\fs24 \cf0 Brought to you by your friends at {\field{\*\fldinst{HYPERLINK "http://devmynd.com"}}{\fldrslt DevMynd}} in Chicago and San Francisco. +\b \ +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 +\cf0 \ +Contributors +\b0 : Erin Hochstatter, Ty Cobb, \ +Michael Crismali, Joe Hirn, Ifu Aniemeka, Erick Arias & Eryan Cobham} \ No newline at end of file diff --git a/Harbor/Info.plist b/Harbor/Info.plist index bfa3204..fd61390 100644 --- a/Harbor/Info.plist +++ b/Harbor/Info.plist @@ -17,17 +17,15 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.1.1 + 0.1.2 CFBundleSignature ???? - CFBundleVersion - 1 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) LSUIElement NSHumanReadableCopyright - Copyright © 2015 DevMynd. All rights reserved. + Copyright © 2016 DevMynd. All rights reserved. NSMainNibFile MainMenu NSPrincipalClass From 5293bbc0050ca54b1c839a865db658ec02de6e73 Mon Sep 17 00:00:00 2001 From: Erick Arias Date: Thu, 21 Jul 2016 14:49:05 -0500 Subject: [PATCH 2/9] added images and some text explaining how to install --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ad7f4ea..cb28b94 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,14 @@ You can also download Harbor from the app store. ### Setup Go to [Codeship] (http://www.codeship.io) (if you haven't already, you'll need to set up an account). Click on your profile picture. Under **My Account**, go to the **Account Settings** page. Copy your API Key. -Click on the Harbor app and select **Set Preferences**. Paste your API key in the field labeled 'Codeship API Key'. Set the refresh rate (which is measured in seconds) and hit 'Save'. -You're good to go! :D + +Click on the Harbor app and select **Set Preferences**. Paste your API key in the field labeled 'Codeship API Key'. Set the refresh rate (which is measured in seconds) and hit 'Save'. Your projects will be automatically fetched from Codeship. + +![Harbor Settings](https://www.devmynd.com/wp-content/uploads/2016/07/harbor_settings.jpg "Harbor Settings") + +Click the Harbor icon from the menu bar. You will see a list of your Codeship Projects. Projects with a green Harbor icon are passing, while red means they are failing. A black Harbor icon means that a project is currently building. If you hover over a project you will see the your latest commits. + +![Harbor Menu](https://www.devmynd.com/wp-content/uploads/2016/07/harbor_menu.jpg "Harbor Menu") ### License Copyright (c) 2016 DevMynd Software. From 4666b43d72de6eac42f13b67b72a8b45d10d9b71 Mon Sep 17 00:00:00 2001 From: Erick Arias Date: Thu, 21 Jul 2016 14:56:02 -0500 Subject: [PATCH 3/9] Added Devmynd Logo --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index cb28b94..910e931 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![Devmynd](https://www.devmynd.com/wp-content/uploads/2016/07/logo-horizontal.jpg "Devmynd") + # Harbor Monitor your codeship builds from the comfort of a convenient OSX status bar application. From 40035c1dc92d76b27d4ae8f4bb4e12753b125ff2 Mon Sep 17 00:00:00 2001 From: Erick Arias Date: Thu, 21 Jul 2016 16:07:58 -0500 Subject: [PATCH 4/9] Added line breaks --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 910e931..454335b 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,12 @@ You can also download Harbor from the app store. Go to [Codeship] (http://www.codeship.io) (if you haven't already, you'll need to set up an account). Click on your profile picture. Under **My Account**, go to the **Account Settings** page. Copy your API Key. Click on the Harbor app and select **Set Preferences**. Paste your API key in the field labeled 'Codeship API Key'. Set the refresh rate (which is measured in seconds) and hit 'Save'. Your projects will be automatically fetched from Codeship. - +
![Harbor Settings](https://www.devmynd.com/wp-content/uploads/2016/07/harbor_settings.jpg "Harbor Settings") - +
Click the Harbor icon from the menu bar. You will see a list of your Codeship Projects. Projects with a green Harbor icon are passing, while red means they are failing. A black Harbor icon means that a project is currently building. If you hover over a project you will see the your latest commits. - +
![Harbor Menu](https://www.devmynd.com/wp-content/uploads/2016/07/harbor_menu.jpg "Harbor Menu") - +
### License Copyright (c) 2016 DevMynd Software. From c32ffb83efaa162c89fe2245be95c33c23d50de8 Mon Sep 17 00:00:00 2001 From: Eryan Cobham Date: Thu, 4 Aug 2016 15:18:20 -0500 Subject: [PATCH 5/9] made sure a default refresh rate is already added when the app initializes for the first time --- Harbor/Settings.swift | 3 ++- HarborTests/SettingsSpec.swift | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Harbor/Settings.swift b/Harbor/Settings.swift index 6030408..b67f5a3 100644 --- a/Harbor/Settings.swift +++ b/Harbor/Settings.swift @@ -62,6 +62,7 @@ class Settings: SettingsType { } var isFirstRun: Bool + private let defaultRefreshRate = 60.0 init(defaults: UserDefaults, keychain: Keychain, notificationCenter: NotificationCenter) { self.defaults = defaults @@ -69,7 +70,7 @@ class Settings: SettingsType { self.notificationCenter = notificationCenter apiKey = keychain.stringForKey(Key.ApiKey) ?? "" - refreshRate = defaults.doubleForKey(Key.RefreshRate) + refreshRate = (defaults.doubleForKey(Key.RefreshRate) > 0.0) ? defaults.doubleForKey(Key.RefreshRate) : defaultRefreshRate disabledProjectIds = defaults.objectForKey(Key.DisabledProjects) as? [Int] ?? [Int]() isFirstRun = !defaults.boolForKey(Key.HasLaunched) launchOnLogin = isFirstRun ? true : defaults.boolForKey(Key.LaunchOnLogin) diff --git a/HarborTests/SettingsSpec.swift b/HarborTests/SettingsSpec.swift index 84866de..edeb991 100644 --- a/HarborTests/SettingsSpec.swift +++ b/HarborTests/SettingsSpec.swift @@ -30,13 +30,20 @@ class SettingsSpec: HarborSpec { expect(local.subject.apiKey).to(equal(apiKey)) } - it("retrieves the correct refresh rate"){ - let refreshRate = 60.0 + it("retrieves the correct refresh rate if it's been set"){ + let refreshRate = 90.0 example.subject.refreshRate = refreshRate let local = example.rebuild { $0.defaults = example.defaults } expect(local.subject.refreshRate).to(equal(refreshRate)) } + + it("provides a default refresh rate if it has not been set"){ + let refreshRate = 60.0 + + let local = example.rebuild { $0.defaults = example.defaults } + expect(local.subject.refreshRate).to(equal(refreshRate)) + } it("retrieves the correct disabled project ids"){ let disabledProjectIds = [1, 2, 3, 4] From 0d94c4ff794af36ed786e127b69db3b7a9fe5c89 Mon Sep 17 00:00:00 2001 From: Eryan Cobham Date: Fri, 5 Aug 2016 10:49:13 -0500 Subject: [PATCH 6/9] Moved the Launch on Login checkbox to the bottom --- Harbor/PreferencesPaneWindowController.xib | 74 +++++++++++++--------- 1 file changed, 43 insertions(+), 31 deletions(-) diff --git a/Harbor/PreferencesPaneWindowController.xib b/Harbor/PreferencesPaneWindowController.xib index 4385a88..54b479c 100644 --- a/Harbor/PreferencesPaneWindowController.xib +++ b/Harbor/PreferencesPaneWindowController.xib @@ -1,7 +1,7 @@ - + - + @@ -22,7 +22,7 @@ - + @@ -100,27 +100,15 @@ - - + - - + - - + @@ -149,8 +137,11 @@ - + + + + @@ -185,8 +180,8 @@ - - + + @@ -194,6 +189,11 @@ + + + + + @@ -209,8 +209,8 @@ - + + + + - - - - - + + + + + - - + From bf385afa9cfa1aff4bf8c6b84a464ebedd4336f6 Mon Sep 17 00:00:00 2001 From: Eryan Cobham Date: Fri, 5 Aug 2016 16:14:56 -0500 Subject: [PATCH 7/9] Changed everything to use an int, except for the call to NSTimer --- Harbor/PreferencesPaneWindowController.xib | 18 +++++++++--------- Harbor/PreferencesPresenter.swift | 10 +++++----- Harbor/Settings.swift | 6 +++--- Harbor/SettingsType.swift | 2 +- Harbor/TimerCoordinator.swift | 10 +++++++--- Harbor/UserDefaults.swift | 17 +++++++++++------ HarborTests/MockSettings.swift | 2 +- HarborTests/MockUserDefaults.swift | 14 +++++++------- HarborTests/PreferencesPresenterSpec.swift | 4 ++-- HarborTests/SettingsSpec.swift | 6 +++--- HarborTests/TimerCoordinatorSpec.swift | 7 ++++--- 11 files changed, 53 insertions(+), 43 deletions(-) diff --git a/Harbor/PreferencesPaneWindowController.xib b/Harbor/PreferencesPaneWindowController.xib index 4385a88..4403f0c 100644 --- a/Harbor/PreferencesPaneWindowController.xib +++ b/Harbor/PreferencesPaneWindowController.xib @@ -1,7 +1,7 @@ - + - + @@ -22,7 +22,7 @@ - + @@ -122,11 +122,11 @@ - + - + @@ -209,16 +209,16 @@ - diff --git a/Harbor/PreferencesPresenter.swift b/Harbor/PreferencesPresenter.swift index e4abe93..02619e7 100644 --- a/Harbor/PreferencesPresenter.swift +++ b/Harbor/PreferencesPresenter.swift @@ -11,7 +11,7 @@ class PreferencesPresenter : Presenter { // // MARK: Properties private var apiKey: String = "" - private var refreshRate: Double = 60.0 + private var refreshRate: Int = 60 private(set) var launchOnLogin: Bool = true private var allProjects: [Project] private var apiKeyError: String = "" @@ -95,7 +95,7 @@ class PreferencesPresenter : Presenter { } func updateRefreshRate(refreshRate: String) { - self.refreshRate = (refreshRate as NSString).doubleValue + self.refreshRate = (refreshRate as NSString).integerValue validateRefreshRate(refreshRate) setNeedsRefresh() } @@ -174,11 +174,11 @@ class PreferencesPresenter : Presenter { } private func validateRefreshRate(value: String) { - let doubleValue = Double(value) + let refreshValue = Int(value) - if doubleValue == nil { + if refreshValue == nil { refreshRateError = "must be a number" - } else if !(5 ... 600 ~= doubleValue!) { + } else if !(5 ... 600 ~= refreshValue!) { refreshRateError = "must be between 5 and 600 seconds" } else { refreshRateError = "" diff --git a/Harbor/Settings.swift b/Harbor/Settings.swift index 6030408..24aefea 100644 --- a/Harbor/Settings.swift +++ b/Harbor/Settings.swift @@ -38,9 +38,9 @@ class Settings: SettingsType { } } - var refreshRate: Double { + var refreshRate: Int { didSet { - defaults.setDouble(refreshRate, forKey: Key.RefreshRate) + defaults.setInteger(refreshRate, forKey: Key.RefreshRate) postNotification(.RefreshRate) } } @@ -69,7 +69,7 @@ class Settings: SettingsType { self.notificationCenter = notificationCenter apiKey = keychain.stringForKey(Key.ApiKey) ?? "" - refreshRate = defaults.doubleForKey(Key.RefreshRate) + refreshRate = defaults.integerForKey(Key.RefreshRate) disabledProjectIds = defaults.objectForKey(Key.DisabledProjects) as? [Int] ?? [Int]() isFirstRun = !defaults.boolForKey(Key.HasLaunched) launchOnLogin = isFirstRun ? true : defaults.boolForKey(Key.LaunchOnLogin) diff --git a/Harbor/SettingsType.swift b/Harbor/SettingsType.swift index 7ab209a..ef34b39 100644 --- a/Harbor/SettingsType.swift +++ b/Harbor/SettingsType.swift @@ -3,7 +3,7 @@ import Foundation protocol SettingsType { var apiKey: String { get set } - var refreshRate: Double { get set } + var refreshRate: Int { get set } var disabledProjectIds: [Int] { get set } var launchOnLogin: Bool { get set } var isFirstRun: Bool { get set } diff --git a/Harbor/TimerCoordinator.swift b/Harbor/TimerCoordinator.swift index 4eaef34..4cb2320 100644 --- a/Harbor/TimerCoordinator.swift +++ b/Harbor/TimerCoordinator.swift @@ -40,12 +40,12 @@ class TimerCoordinator: NSObject, TimerCoordinatorType { // // MARK: Helpers - private func setupTimer(refreshRate: Double) -> NSTimer? { + private func setupTimer(refreshRate: Int) -> NSTimer? { // cancel current timer if necessary stopTimer() - if !refreshRate.isZero { - currentTimer = NSTimer(timeInterval: refreshRate, target: self, selector:#selector(TimerCoordinator.handleUpdateTimer(_:)), userInfo: nil, repeats: true) + if refreshRate != 0 { + currentTimer = NSTimer(timeInterval: convertIntToDouble(refreshRate), target: self, selector:#selector(TimerCoordinator.handleUpdateTimer(_:)), userInfo: nil, repeats: true) runLoop.addTimer(currentTimer!, forMode: NSDefaultRunLoopMode) } @@ -57,4 +57,8 @@ class TimerCoordinator: NSObject, TimerCoordinatorType { projectsInteractor.refreshProjects() } } + + private func convertIntToDouble(integer: Int) -> Double { + return Double(integer) + } } \ No newline at end of file diff --git a/Harbor/UserDefaults.swift b/Harbor/UserDefaults.swift index 7eaf9b1..25117a2 100644 --- a/Harbor/UserDefaults.swift +++ b/Harbor/UserDefaults.swift @@ -4,8 +4,8 @@ protocol UserDefaults { func setObject(object: AnyObject?, forKey key: CustomStringConvertible) func objectForKey(key: CustomStringConvertible) -> AnyObject? - func setDouble(double: Double, forKey key: CustomStringConvertible) - func doubleForKey(key: CustomStringConvertible) -> Double + func setInteger(integer: Int, forKey key: CustomStringConvertible) + func integerForKey(key: CustomStringConvertible) -> Int func setBool(bool: Bool, forKey key: CustomStringConvertible) func boolForKey(key: CustomStringConvertible) -> Bool @@ -22,12 +22,17 @@ extension NSUserDefaults : UserDefaults { return self.objectForKey(key.description) } - func setDouble(double: Double, forKey key: CustomStringConvertible) { - self.setDouble(double, forKey: key.description) + func setInteger(integer: Int, forKey key: CustomStringConvertible) { + if let currentObject = objectForKey(key.description) { + if currentObject is Double { + removeObjectForKey(key.description) + } + } + self.setInteger(integer, forKey: key.description) } - func doubleForKey(key: CustomStringConvertible) -> Double { - return self.doubleForKey(key.description) + func integerForKey(key: CustomStringConvertible) -> Int { + return self.integerForKey(key.description) } func setBool(bool: Bool, forKey key: CustomStringConvertible) { diff --git a/HarborTests/MockSettings.swift b/HarborTests/MockSettings.swift index f695c96..cd15928 100644 --- a/HarborTests/MockSettings.swift +++ b/HarborTests/MockSettings.swift @@ -3,7 +3,7 @@ import Foundation class MockSettings: SettingsType { var apiKey: String = "" - var refreshRate: Double = 0.0 + var refreshRate: Int = 0 var disabledProjectIds: [Int] = [] var launchOnLogin: Bool = false var isFirstRun: Bool = false diff --git a/HarborTests/MockUserDefaults.swift b/HarborTests/MockUserDefaults.swift index a4d301c..e22e18c 100644 --- a/HarborTests/MockUserDefaults.swift +++ b/HarborTests/MockUserDefaults.swift @@ -4,8 +4,8 @@ class MockUserDefaults : UserDefaults { enum Method : MethodType { case SetObject case ObjectForKey - case SetDouble - case DoubleForKey + case SetInteger + case IntegerForKey } var invocation: Invocation? @@ -20,14 +20,14 @@ class MockUserDefaults : UserDefaults { return lastValue as! AnyObject? } - func setDouble(double: Double, forKey key: CustomStringConvertible) { - invocation = Invocation(.SetDouble, double) + func setInteger(integer: Int, forKey key: CustomStringConvertible) { + invocation = Invocation(.SetInteger, integer) } - func doubleForKey(key: CustomStringConvertible) -> Double { + func integerForKey(key: CustomStringConvertible) -> Int { let lastValue = invocation?.value - invocation = Invocation(.DoubleForKey, lastValue) - return lastValue as? Double ?? 0.0 + invocation = Invocation(.IntegerForKey, lastValue) + return lastValue as? Int ?? 0 } func setBool(bool: Bool, forKey key: CustomStringConvertible) { diff --git a/HarborTests/PreferencesPresenterSpec.swift b/HarborTests/PreferencesPresenterSpec.swift index 123c72f..95f1ccf 100644 --- a/HarborTests/PreferencesPresenterSpec.swift +++ b/HarborTests/PreferencesPresenterSpec.swift @@ -88,7 +88,7 @@ class PreferencesPresenterSpec: HarborSpec { override func spec() { describe("#savePreferences") { beforeEach { subject.updateApiKey("abc123") - subject.updateRefreshRate("10.0") + subject.updateRefreshRate("10") subject.updateLaunchOnLogin(true) subject.setNeedsRefresh() subject.savePreferences() @@ -96,7 +96,7 @@ class PreferencesPresenterSpec: HarborSpec { override func spec() { it("updates settings"){ expect(settings.apiKey) == "abc123" - expect(settings.refreshRate) == Double("10.0") + expect(settings.refreshRate) == Int("10") expect(settings.launchOnLogin) == true expect(subject.needsRefresh).to(beFalse()) } diff --git a/HarborTests/SettingsSpec.swift b/HarborTests/SettingsSpec.swift index 84866de..09b36ef 100644 --- a/HarborTests/SettingsSpec.swift +++ b/HarborTests/SettingsSpec.swift @@ -31,7 +31,7 @@ class SettingsSpec: HarborSpec { } it("retrieves the correct refresh rate"){ - let refreshRate = 60.0 + let refreshRate = 60 example.subject.refreshRate = refreshRate let local = example.rebuild { $0.defaults = example.defaults } @@ -49,10 +49,10 @@ class SettingsSpec: HarborSpec { describe("setting") { describe("the refresh rate") { - let value = 60.0 + let value = 60 it("updates user defaults with the given rate"){ - let invocation = Invocations.defaults(.SetDouble, VerifierOf(value)) + let invocation = Invocations.defaults(.SetInteger, VerifierOf(value)) example.subject.refreshRate = value expect(example.defaults.invocation).to(match(invocation)) diff --git a/HarborTests/TimerCoordinatorSpec.swift b/HarborTests/TimerCoordinatorSpec.swift index 1a2e93e..7c9c20a 100644 --- a/HarborTests/TimerCoordinatorSpec.swift +++ b/HarborTests/TimerCoordinatorSpec.swift @@ -30,11 +30,11 @@ class TimerCoordinatorSpec: HarborSpec { describe("when starting a timer") { beforeEach { - example.settings.refreshRate = 60.0 + example.settings.refreshRate = 60 } it("should not create a timer when the refresh rate is 0.0") { - example.settings.refreshRate = 0.0 + example.settings.refreshRate = 0 let timer = example.subject.startTimer() expect(timer).to(beNil()) @@ -42,8 +42,9 @@ class TimerCoordinatorSpec: HarborSpec { it("creates a timer") { let timer = example.subject.startTimer() + let refreshRateAsDouble = Double(example.settings.refreshRate) expect(timer).toNot(beNil()) - expect(timer!.timeInterval).to(equal(example.settings.refreshRate)) + expect(timer!.timeInterval).to(equal(refreshRateAsDouble)) } it("adds the timer to the run loop") { From 7c192fa1a7d834ff436e42d206ad19ff0ddf8e65 Mon Sep 17 00:00:00 2001 From: Eryan Cobham Date: Fri, 5 Aug 2016 16:43:39 -0500 Subject: [PATCH 8/9] Moving the checkbox to line up with save --- Harbor/PreferencesPaneWindowController.xib | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Harbor/PreferencesPaneWindowController.xib b/Harbor/PreferencesPaneWindowController.xib index 3e9e718..4b546ec 100644 --- a/Harbor/PreferencesPaneWindowController.xib +++ b/Harbor/PreferencesPaneWindowController.xib @@ -223,7 +223,7 @@