diff --git a/Time/Time.xcodeproj/project.pbxproj b/Time/Time.xcodeproj/project.pbxproj index c8743f0..6ffc683 100644 --- a/Time/Time.xcodeproj/project.pbxproj +++ b/Time/Time.xcodeproj/project.pbxproj @@ -7,13 +7,34 @@ objects = { /* Begin PBXBuildFile section */ + 292AA5E21B965AE500D6DEE0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 292AA5E11B965AE500D6DEE0 /* Images.xcassets */; }; + 297053371B97ABF5005C4C50 /* Dramatic.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 2970532D1B97ABF5005C4C50 /* Dramatic.mp3 */; }; + 297053381B97ABF5005C4C50 /* Futuristic Alarm.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 2970532E1B97ABF5005C4C50 /* Futuristic Alarm.mp3 */; }; + 297053391B97ABF5005C4C50 /* Just Alarm.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 2970532F1B97ABF5005C4C50 /* Just Alarm.mp3 */; }; + 2970533A1B97ABF5005C4C50 /* Kitchen Timer.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 297053301B97ABF5005C4C50 /* Kitchen Timer.mp3 */; }; + 2970533B1B97ABF5005C4C50 /* Most Annoying Sound.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 297053311B97ABF5005C4C50 /* Most Annoying Sound.mp3 */; }; + 2970533C1B97ABF5005C4C50 /* Radar.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 297053321B97ABF5005C4C50 /* Radar.mp3 */; }; + 2970533D1B97ABF5005C4C50 /* Rocket Launch.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 297053331B97ABF5005C4C50 /* Rocket Launch.mp3 */; }; + 2970533E1B97ABF5005C4C50 /* Sonar.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 297053341B97ABF5005C4C50 /* Sonar.mp3 */; }; + 2970533F1B97ABF5005C4C50 /* Tornado Siren.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 297053351B97ABF5005C4C50 /* Tornado Siren.mp3 */; }; + 297053401B97ABF5005C4C50 /* Zombies.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 297053361B97ABF5005C4C50 /* Zombies.mp3 */; }; + 297053421B97D9F1005C4C50 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 297053411B97D9F1005C4C50 /* AudioToolbox.framework */; }; + 29E64B811B90EEFD0054E049 /* CQTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 29E64B801B90EEFD0054E049 /* CQTimer.m */; }; + 29E64B8A1B9260640054E049 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 29E64B891B9260640054E049 /* Main.storyboard */; }; + 29E64B951B950FF50054E049 /* Magical Explosion.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 29E64B941B950FF50054E049 /* Magical Explosion.mp3 */; }; + 29E64B9A1B951B230054E049 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29E64B991B951B230054E049 /* AVFoundation.framework */; }; + 29FCC7C01B8BD2860005B464 /* CQNewTimerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29FCC7BF1B8BD2860005B464 /* CQNewTimerViewController.m */; }; + 29FCC7C31B8BD2AE0005B464 /* CQPresetTimerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29FCC7C21B8BD2AE0005B464 /* CQPresetTimerViewController.m */; }; + 29FD99791B96591E0079EBA4 /* ShowCDViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29FD99781B96591E0079EBA4 /* ShowCDViewController.m */; }; + 29FD997C1B96592B0079EBA4 /* CDViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29FD997B1B96592B0079EBA4 /* CDViewController.m */; }; + 29FD997F1B96594A0079EBA4 /* AddCDViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29FD997E1B96594A0079EBA4 /* AddCDViewController.m */; }; 8D05375E1B86687C00588318 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D05375D1B86687C00588318 /* main.m */; }; 8D0537611B86687C00588318 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D0537601B86687C00588318 /* AppDelegate.m */; }; - 8D0537641B86687C00588318 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D0537631B86687C00588318 /* ViewController.m */; }; - 8D0537671B86687C00588318 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8D0537651B86687C00588318 /* Main.storyboard */; }; - 8D0537691B86687C00588318 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8D0537681B86687C00588318 /* Images.xcassets */; }; 8D05376C1B86687C00588318 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8D05376A1B86687C00588318 /* LaunchScreen.xib */; }; 8D0537781B86687C00588318 /* TimeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D0537771B86687C00588318 /* TimeTests.m */; }; + F70BE1E71B8A0ADE0079ABE5 /* SWViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F70BE1E61B8A0ADE0079ABE5 /* SWViewController.m */; }; + F70BE1EA1B8A0AFA0079ABE5 /* TimerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F70BE1E91B8A0AFA0079ABE5 /* TimerViewController.m */; }; + F7D7FAAA1B977B1D00D5051C /* CDEvents.m in Sources */ = {isa = PBXBuildFile; fileRef = F7D7FAA91B977B1D00D5051C /* CDEvents.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -27,19 +48,48 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 292AA5E11B965AE500D6DEE0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 2970532D1B97ABF5005C4C50 /* Dramatic.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = Dramatic.mp3; sourceTree = ""; }; + 2970532E1B97ABF5005C4C50 /* Futuristic Alarm.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "Futuristic Alarm.mp3"; sourceTree = ""; }; + 2970532F1B97ABF5005C4C50 /* Just Alarm.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "Just Alarm.mp3"; sourceTree = ""; }; + 297053301B97ABF5005C4C50 /* Kitchen Timer.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "Kitchen Timer.mp3"; sourceTree = ""; }; + 297053311B97ABF5005C4C50 /* Most Annoying Sound.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "Most Annoying Sound.mp3"; sourceTree = ""; }; + 297053321B97ABF5005C4C50 /* Radar.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = Radar.mp3; sourceTree = ""; }; + 297053331B97ABF5005C4C50 /* Rocket Launch.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "Rocket Launch.mp3"; sourceTree = ""; }; + 297053341B97ABF5005C4C50 /* Sonar.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = Sonar.mp3; sourceTree = ""; }; + 297053351B97ABF5005C4C50 /* Tornado Siren.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "Tornado Siren.mp3"; sourceTree = ""; }; + 297053361B97ABF5005C4C50 /* Zombies.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = Zombies.mp3; sourceTree = ""; }; + 297053411B97D9F1005C4C50 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + 29E64B7F1B90EEFD0054E049 /* CQTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CQTimer.h; sourceTree = ""; }; + 29E64B801B90EEFD0054E049 /* CQTimer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CQTimer.m; sourceTree = ""; }; + 29E64B891B9260640054E049 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; + 29E64B941B950FF50054E049 /* Magical Explosion.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "Magical Explosion.mp3"; sourceTree = ""; }; + 29E64B991B951B230054E049 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + 29FCC7BE1B8BD2860005B464 /* CQNewTimerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CQNewTimerViewController.h; sourceTree = ""; }; + 29FCC7BF1B8BD2860005B464 /* CQNewTimerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CQNewTimerViewController.m; sourceTree = ""; }; + 29FCC7C11B8BD2AE0005B464 /* CQPresetTimerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CQPresetTimerViewController.h; sourceTree = ""; }; + 29FCC7C21B8BD2AE0005B464 /* CQPresetTimerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CQPresetTimerViewController.m; sourceTree = ""; }; + 29FD99771B96591E0079EBA4 /* ShowCDViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShowCDViewController.h; sourceTree = ""; }; + 29FD99781B96591E0079EBA4 /* ShowCDViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShowCDViewController.m; sourceTree = ""; }; + 29FD997A1B96592B0079EBA4 /* CDViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDViewController.h; sourceTree = ""; }; + 29FD997B1B96592B0079EBA4 /* CDViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDViewController.m; sourceTree = ""; }; + 29FD997D1B96594A0079EBA4 /* AddCDViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddCDViewController.h; sourceTree = ""; }; + 29FD997E1B96594A0079EBA4 /* AddCDViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AddCDViewController.m; sourceTree = ""; }; 8D0537581B86687B00588318 /* Time.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Time.app; sourceTree = BUILT_PRODUCTS_DIR; }; 8D05375C1B86687B00588318 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8D05375D1B86687C00588318 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 8D05375F1B86687C00588318 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 8D0537601B86687C00588318 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 8D0537621B86687C00588318 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - 8D0537631B86687C00588318 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - 8D0537661B86687C00588318 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 8D0537681B86687C00588318 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 8D05376B1B86687C00588318 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 8D0537711B86687C00588318 /* TimeTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TimeTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 8D0537761B86687C00588318 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8D0537771B86687C00588318 /* TimeTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TimeTests.m; sourceTree = ""; }; + F70BE1E51B8A0ADE0079ABE5 /* SWViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWViewController.h; sourceTree = ""; }; + F70BE1E61B8A0ADE0079ABE5 /* SWViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWViewController.m; sourceTree = ""; }; + F70BE1E81B8A0AFA0079ABE5 /* TimerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimerViewController.h; sourceTree = ""; }; + F70BE1E91B8A0AFA0079ABE5 /* TimerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TimerViewController.m; sourceTree = ""; }; + F7D7FAA81B977B1D00D5051C /* CDEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDEvents.h; sourceTree = ""; }; + F7D7FAA91B977B1D00D5051C /* CDEvents.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDEvents.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -47,6 +97,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 297053421B97D9F1005C4C50 /* AudioToolbox.framework in Frameworks */, + 29E64B9A1B951B230054E049 /* AVFoundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -60,6 +112,53 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 2970532C1B97AA8C005C4C50 /* Countdown & Stopwatch files */ = { + isa = PBXGroup; + children = ( + 8D05375F1B86687C00588318 /* AppDelegate.h */, + 8D0537601B86687C00588318 /* AppDelegate.m */, + F70BE1E51B8A0ADE0079ABE5 /* SWViewController.h */, + F70BE1E61B8A0ADE0079ABE5 /* SWViewController.m */, + F7D7FAA81B977B1D00D5051C /* CDEvents.h */, + F7D7FAA91B977B1D00D5051C /* CDEvents.m */, + 29FD997D1B96594A0079EBA4 /* AddCDViewController.h */, + 29FD997E1B96594A0079EBA4 /* AddCDViewController.m */, + 29FD997A1B96592B0079EBA4 /* CDViewController.h */, + 29FD997B1B96592B0079EBA4 /* CDViewController.m */, + 29FD99771B96591E0079EBA4 /* ShowCDViewController.h */, + 29FD99781B96591E0079EBA4 /* ShowCDViewController.m */, + ); + name = "Countdown & Stopwatch files"; + sourceTree = ""; + }; + 297053431B97DA10005C4C50 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 297053411B97D9F1005C4C50 /* AudioToolbox.framework */, + 29E64B991B951B230054E049 /* AVFoundation.framework */, + ); + name = Frameworks; + path = ..; + sourceTree = ""; + }; + 29E64B981B9517950054E049 /* Sounds */ = { + isa = PBXGroup; + children = ( + 29E64B941B950FF50054E049 /* Magical Explosion.mp3 */, + 2970532D1B97ABF5005C4C50 /* Dramatic.mp3 */, + 2970532E1B97ABF5005C4C50 /* Futuristic Alarm.mp3 */, + 2970532F1B97ABF5005C4C50 /* Just Alarm.mp3 */, + 297053301B97ABF5005C4C50 /* Kitchen Timer.mp3 */, + 297053311B97ABF5005C4C50 /* Most Annoying Sound.mp3 */, + 297053321B97ABF5005C4C50 /* Radar.mp3 */, + 297053331B97ABF5005C4C50 /* Rocket Launch.mp3 */, + 297053341B97ABF5005C4C50 /* Sonar.mp3 */, + 297053351B97ABF5005C4C50 /* Tornado Siren.mp3 */, + 297053361B97ABF5005C4C50 /* Zombies.mp3 */, + ); + name = Sounds; + sourceTree = ""; + }; 8D05374F1B86687B00588318 = { isa = PBXGroup; children = ( @@ -81,13 +180,20 @@ 8D05375A1B86687B00588318 /* Time */ = { isa = PBXGroup; children = ( - 8D05375F1B86687C00588318 /* AppDelegate.h */, - 8D0537601B86687C00588318 /* AppDelegate.m */, - 8D0537621B86687C00588318 /* ViewController.h */, - 8D0537631B86687C00588318 /* ViewController.m */, - 8D0537651B86687C00588318 /* Main.storyboard */, - 8D0537681B86687C00588318 /* Images.xcassets */, + 29E64B7F1B90EEFD0054E049 /* CQTimer.h */, + 29E64B801B90EEFD0054E049 /* CQTimer.m */, + F70BE1E81B8A0AFA0079ABE5 /* TimerViewController.h */, + F70BE1E91B8A0AFA0079ABE5 /* TimerViewController.m */, + 29FCC7BE1B8BD2860005B464 /* CQNewTimerViewController.h */, + 29FCC7BF1B8BD2860005B464 /* CQNewTimerViewController.m */, + 29FCC7C11B8BD2AE0005B464 /* CQPresetTimerViewController.h */, + 29FCC7C21B8BD2AE0005B464 /* CQPresetTimerViewController.m */, + 29E64B891B9260640054E049 /* Main.storyboard */, 8D05376A1B86687C00588318 /* LaunchScreen.xib */, + 292AA5E11B965AE500D6DEE0 /* Images.xcassets */, + 29E64B981B9517950054E049 /* Sounds */, + 297053431B97DA10005C4C50 /* Frameworks */, + 2970532C1B97AA8C005C4C50 /* Countdown & Stopwatch files */, 8D05375B1B86687B00588318 /* Supporting Files */, ); path = Time; @@ -168,6 +274,7 @@ TargetAttributes = { 8D0537571B86687B00588318 = { CreatedOnToolsVersion = 6.4; + DevelopmentTeam = N48NM3R37Q; }; 8D0537701B86687C00588318 = { CreatedOnToolsVersion = 6.4; @@ -199,9 +306,20 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8D0537671B86687C00588318 /* Main.storyboard in Resources */, + 297053371B97ABF5005C4C50 /* Dramatic.mp3 in Resources */, 8D05376C1B86687C00588318 /* LaunchScreen.xib in Resources */, - 8D0537691B86687C00588318 /* Images.xcassets in Resources */, + 297053401B97ABF5005C4C50 /* Zombies.mp3 in Resources */, + 2970533E1B97ABF5005C4C50 /* Sonar.mp3 in Resources */, + 292AA5E21B965AE500D6DEE0 /* Images.xcassets in Resources */, + 297053381B97ABF5005C4C50 /* Futuristic Alarm.mp3 in Resources */, + 2970533F1B97ABF5005C4C50 /* Tornado Siren.mp3 in Resources */, + 29E64B8A1B9260640054E049 /* Main.storyboard in Resources */, + 29E64B951B950FF50054E049 /* Magical Explosion.mp3 in Resources */, + 2970533A1B97ABF5005C4C50 /* Kitchen Timer.mp3 in Resources */, + 2970533C1B97ABF5005C4C50 /* Radar.mp3 in Resources */, + 297053391B97ABF5005C4C50 /* Just Alarm.mp3 in Resources */, + 2970533D1B97ABF5005C4C50 /* Rocket Launch.mp3 in Resources */, + 2970533B1B97ABF5005C4C50 /* Most Annoying Sound.mp3 in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -219,9 +337,17 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8D0537641B86687C00588318 /* ViewController.m in Sources */, + F70BE1EA1B8A0AFA0079ABE5 /* TimerViewController.m in Sources */, + 29E64B811B90EEFD0054E049 /* CQTimer.m in Sources */, + F70BE1E71B8A0ADE0079ABE5 /* SWViewController.m in Sources */, + F7D7FAAA1B977B1D00D5051C /* CDEvents.m in Sources */, + 29FD99791B96591E0079EBA4 /* ShowCDViewController.m in Sources */, + 29FCC7C31B8BD2AE0005B464 /* CQPresetTimerViewController.m in Sources */, + 29FCC7C01B8BD2860005B464 /* CQNewTimerViewController.m in Sources */, 8D0537611B86687C00588318 /* AppDelegate.m in Sources */, 8D05375E1B86687C00588318 /* main.m in Sources */, + 29FD997F1B96594A0079EBA4 /* AddCDViewController.m in Sources */, + 29FD997C1B96592B0079EBA4 /* CDViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -244,14 +370,6 @@ /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ - 8D0537651B86687C00588318 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 8D0537661B86687C00588318 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; 8D05376A1B86687C00588318 /* LaunchScreen.xib */ = { isa = PBXVariantGroup; children = ( @@ -349,9 +467,16 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); INFOPLIST_FILE = Time/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = 1; }; name = Debug; }; @@ -359,9 +484,16 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); INFOPLIST_FILE = Time/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = 1; }; name = Release; }; @@ -418,6 +550,7 @@ 8D05377D1B86687C00588318 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 8D05377E1B86687C00588318 /* Build configuration list for PBXNativeTarget "TimeTests" */ = { isa = XCConfigurationList; @@ -426,6 +559,7 @@ 8D0537801B86687C00588318 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/Time/Time/AddCDViewController.h b/Time/Time/AddCDViewController.h new file mode 100644 index 0000000..b6c1bc8 --- /dev/null +++ b/Time/Time/AddCDViewController.h @@ -0,0 +1,17 @@ +// +// AddCDViewController.h +// Time +// +// Created by Christella on 9/1/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import +#import "CDEvents.h" + +@interface AddCDViewController : UIViewController + +@property (nonatomic) CDEvents *eventObject; + + +@end diff --git a/Time/Time/AddCDViewController.m b/Time/Time/AddCDViewController.m new file mode 100644 index 0000000..c398a90 --- /dev/null +++ b/Time/Time/AddCDViewController.m @@ -0,0 +1,105 @@ +// +// AddCDViewController.m +// Time +// +// Created by Christella on 9/1/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import "AddCDViewController.h" +#import "CDEvents.h" +#import "CDViewController.h" +#import "ShowCDViewController.h" + + +@interface AddCDViewController () + + +@property (weak, nonatomic) IBOutlet UITableView *eventsView; +@property (nonatomic) NSMutableArray *userEvents; + + + +@end + +@implementation AddCDViewController + +//Delete Action + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.title = @"Your Countdowns"; + self.userEvents = [[NSMutableArray alloc] init]; + +} + + +#pragma mark Table View Methods + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + + return self.userEvents.count; +} + + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + UITableViewCell *cell = [self.eventsView dequeueReusableCellWithIdentifier:@"eventCellIdentifier" forIndexPath:indexPath]; + + CDEvents *eventTemp; + eventTemp = [self.userEvents objectAtIndex:indexPath.row]; + + cell.textLabel.text = eventTemp.userEventTitle; + + return cell; +} + + +#pragma mark New Event Button + +- (IBAction)newEvent:(UIBarButtonItem *)sender { + + + if([sender.title isEqualToString:@"New Event"]){ + + CDViewController *newEventVC = [self.storyboard instantiateViewControllerWithIdentifier:@"NewEventViewController"]; + newEventVC.delegate = self; + [self.navigationController pushViewController:newEventVC animated:YES]; + } + +} + +#pragma mark - Delegate methods + +- (void) addToTheArrayNewEvent:(CDEvents *)newEvent { + [self.userEvents addObject:newEvent]; + [self.eventsView reloadData]; +} + + +#pragma mark - didSelectRowAtIndexPath + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + + ShowCDViewController *cdEventsVC= [self.storyboard instantiateViewControllerWithIdentifier:@"CDEventsViewController"]; + + CDEvents *eventObject = self.userEvents[indexPath.row]; + + //pass the CQTimer timerObject to the next VC + cdEventsVC.eventObject = eventObject; + + + [self.navigationController pushViewController:cdEventsVC animated:YES]; +} + + + + + +@end diff --git a/Time/Time/AppDelegate.m b/Time/Time/AppDelegate.m index d59e7a8..9a1acd7 100644 --- a/Time/Time/AppDelegate.m +++ b/Time/Time/AppDelegate.m @@ -8,38 +8,32 @@ #import "AppDelegate.h" -@interface AppDelegate () - -@end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. - return YES; + return YES; } - (void)applicationWillResignActive:(UIApplication *)application { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. + } - (void)applicationDidEnterBackground:(UIApplication *)application { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } - (void)applicationWillEnterForeground:(UIApplication *)application { - // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. + } - (void)applicationDidBecomeActive:(UIApplication *)application { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } - (void)applicationWillTerminate:(UIApplication *)application { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } @end diff --git a/Time/Time/Base.lproj/Main.storyboard b/Time/Time/Base.lproj/Main.storyboard deleted file mode 100644 index f56d2f3..0000000 --- a/Time/Time/Base.lproj/Main.storyboard +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Time/Time/CDEvents.h b/Time/Time/CDEvents.h new file mode 100644 index 0000000..cebc6c1 --- /dev/null +++ b/Time/Time/CDEvents.h @@ -0,0 +1,24 @@ +// +// CDEvents.h +// Time +// +// Created by Christella on 9/2/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import + +@interface CDEvents : NSObject + +@property (nonatomic) CDEvents *eventObject; + +@property (nonatomic) NSMutableArray *userEvents; + +@property (nonatomic) NSString *userEventTitle; + +@property (nonatomic) NSString *userEventDay; + +@property (nonatomic) NSDate *date; + + +@end diff --git a/Time/Time/CDEvents.m b/Time/Time/CDEvents.m new file mode 100644 index 0000000..31b9de0 --- /dev/null +++ b/Time/Time/CDEvents.m @@ -0,0 +1,16 @@ +// +// CDEvents.m +// Time +// +// Created by Christella on 9/2/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import "CDEvents.h" + + + +@implementation CDEvents + + +@end diff --git a/Time/Time/CDViewController.h b/Time/Time/CDViewController.h new file mode 100644 index 0000000..f398510 --- /dev/null +++ b/Time/Time/CDViewController.h @@ -0,0 +1,34 @@ +// +// CDViewController.h +// Time +// +// Created by Christella on 8/31/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import +#import "CDEvents.h" + + + +@protocol NewEventDelegate + +-(void) addToTheArrayNewEvent:(CDEvents *)newEvent; + + + +@end + +@interface CDViewController : UIViewController + + +@property (nonatomic, weak) id delegate; + +@property (nonatomic) NSString *cdEventTitle; + + + + +- (IBAction)startCountdown:(id)sender; + +@end diff --git a/Time/Time/CDViewController.m b/Time/Time/CDViewController.m new file mode 100644 index 0000000..03130c0 --- /dev/null +++ b/Time/Time/CDViewController.m @@ -0,0 +1,102 @@ +// +// CDViewController.m +// Time +// +// Created by Christella on 8/31/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import "CDViewController.h" +#import "CDEvents.h" +#import "AddCDViewController.h" + + +@interface CDViewController () + + +@property (weak, nonatomic) IBOutlet UILabel *titleLabel; +@property (weak, nonatomic) IBOutlet UITextField *countdownTitle; + + +@property (weak, nonatomic) IBOutlet UIDatePicker *datePicker; +@property (weak, nonatomic) IBOutlet UILabel *countdownLabel; + +@property (weak, nonatomic) IBOutlet UILabel *eventDisplayed; + + + + +@end + +@implementation CDViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + + + +- (IBAction)startCountdown:(id)sender { + + //Remove the time component from the datePicker. We care only about the date + NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar]; + NSUInteger preservedComponents = (NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay); + self.datePicker.date = [calendar dateFromComponents:[calendar components:preservedComponents fromDate:self.datePicker.date]]; + + //Set up a timer that calls the updateTime method every second to update the label + NSTimer *timer; + timer = [NSTimer scheduledTimerWithTimeInterval:1.0 + target:self + selector:@selector(updateTime) + userInfo:nil + repeats:YES]; +} + +-(void)updateTime +{ + //Get the time left until the specified date + NSInteger ti = ((NSInteger)[self.datePicker.date timeIntervalSinceNow]); + NSInteger seconds = ti % 60; + NSInteger minutes = (ti / 60) % 60; + NSInteger hours = (ti / 3600) % 24; + NSInteger days = (ti / 86400); + + //Update the label with the remaining time + self.countdownLabel.text = [NSString stringWithFormat:@"%02li days %02li hrs %02li min %02li sec", (long)days, (long)hours, (long)minutes, (long)seconds]; + + NSDate *myDate = self.datePicker.date; + + NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; + [dateFormat setDateFormat:@"cccc, MMM d, hh:mm aa"]; + NSString *theEventDate = [dateFormat stringFromDate:myDate]; + + self.eventDisplayed.text = theEventDate; +} + +- (IBAction)saveButton:(id)sender { + CDEvents *newEvent = [[CDEvents alloc] init]; + newEvent.userEventTitle = self.countdownTitle.text; + newEvent.date = self.datePicker.date; + + + [self.delegate addToTheArrayNewEvent: newEvent]; + + NSLog(@"%@", newEvent); + + [self.navigationController popToRootViewControllerAnimated:YES]; + +} + + + + + + + +@end diff --git a/Time/Time/CQNewTimerViewController.h b/Time/Time/CQNewTimerViewController.h new file mode 100644 index 0000000..20ef7a2 --- /dev/null +++ b/Time/Time/CQNewTimerViewController.h @@ -0,0 +1,30 @@ +// +// CQNewTimerViewController.h +// Time +// +// Created by Ayuna Vogel on 8/24/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import +#import "CQTimer.h" + +@protocol NewTimerDelegate + +- (void) addToTheArrayNewTimer:(CQTimer *)newTimer; + +@end + +@interface CQNewTimerViewController : UIViewController + + // Delegate property adheres to this protocol NewTimerDelegate. The delegate (it could be any object because its type is id) must implement the methods inside the protocol. +@property (nonatomic, weak) id delegate; + +//@property (nonatomic) CQTimer *timerObject; +//@property (nonatomic) NSMutableArray *presetTimers; +@property (nonatomic) NSString *timerTitle; +@property (nonatomic) NSTimeInterval timerDuration; + + + +@end diff --git a/Time/Time/CQNewTimerViewController.m b/Time/Time/CQNewTimerViewController.m new file mode 100644 index 0000000..4ea32a4 --- /dev/null +++ b/Time/Time/CQNewTimerViewController.m @@ -0,0 +1,198 @@ +// +// CQNewTimerViewController.m +// Time +// +// Created by Ayuna Vogel on 8/24/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import "CQNewTimerViewController.h" +#import "CQTimer.h" +#import "TimerViewController.h" +#import + +@interface CQNewTimerViewController () + +@property (nonatomic) NSTimer *timer; + +@property (nonatomic) int secondsCount; +@property (nonatomic) int hours; +@property (nonatomic) int minutes; +@property (nonatomic) int seconds; + +@property (nonatomic) BOOL isTimerRunning; +@property (nonatomic) BOOL isTimerPaused; + +@property (weak, nonatomic) IBOutlet UIDatePicker *timerPickerView; +@property (weak, nonatomic) IBOutlet UILabel *timerLabel; +@property (weak, nonatomic) IBOutlet UIButton *startCancelButtonTapped; +@property (weak, nonatomic) IBOutlet UIButton *pauseResumeButtonTapped; +@property (weak, nonatomic) IBOutlet UITextField *timerTitleTextField; + +// Sounds +@property (weak, nonatomic) IBOutlet UIPickerView *soundPickerView; +@property (nonatomic) AVAudioPlayer *soundAlarmTimerIsUp; +@property (nonatomic) NSString *soundName; +@property (nonatomic) NSArray *sounds; +@property (nonatomic) AVAudioPlayer *soundAtRowSelected; + +@end + +@implementation CQNewTimerViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.navigationItem.title = @"New Timer"; + + NSInteger seconds = 60; + [self.timerPickerView setDatePickerMode:UIDatePickerModeCountDownTimer]; + [self.timerPickerView setCountDownDuration:seconds]; + + self.sounds = [[NSMutableArray alloc]initWithObjects:@"Radar", @"Sonar", @"Zombies", @"Tornado Siren", @"Rocket Launch", @"Most Annoying Sound", @"Magical Explosion", @"Dramatic", @"Kitchen Timer", @"Futuristic Alarm", @"Just Alarm", nil]; + self.soundName = [self.sounds objectAtIndex:0]; + + self.timerLabel.hidden = YES; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; +} + +#pragma mark - Button methods + +- (void)timerFired: (NSTimer *)timer { + self.secondsCount--; + + self.hours = self.secondsCount/3600; + self.minutes = (self.secondsCount % 3600)/60; + self.seconds = self.secondsCount - (self.hours * 3600) - (self.minutes * 60); + + self.timerLabel.text = [NSString stringWithFormat:@"%02i:%02i:%02i", self.hours, self.minutes, self.seconds]; + self.timerLabel.hidden = NO; + self.timerPickerView.hidden = YES; + + if (self.secondsCount <= 0) { + + [self.timer invalidate]; + self.timer = nil; + + // Code below is added to work with audio files + // Construct URL to sound file + NSString *path = [NSString stringWithFormat:@"%@/%@.mp3", [[NSBundle mainBundle] resourcePath], self.soundName]; + NSURL *soundURL = [NSURL fileURLWithPath:path]; + + // Create audio player object and initialize with URL to sound + self.soundAlarmTimerIsUp = [[AVAudioPlayer alloc] initWithContentsOfURL:soundURL error:nil]; + [self.soundAlarmTimerIsUp play]; + + [self.startCancelButtonTapped setTitle:@"Start" forState:UIControlStateNormal]; + self.pauseResumeButtonTapped.enabled = NO; + + // adds vibration when the timer is up + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); + } +} + +- (IBAction)startCancelButtonTapped:(id)sender { + self.timerDuration = self.timerPickerView.countDownDuration; + + self.seconds = 0; + self.hours = (int)(self.timerDuration/3600.0f); + self.minutes = ((int)self.timerDuration - (self.hours * 3600))/60; + + self.secondsCount = ((self.hours * 3600) + (self.minutes * 60)); + + self.timerLabel.text = [NSString stringWithFormat:@"%02i:%02i:%02i", self.hours, self.minutes, self.seconds]; + + if (self.isTimerRunning == YES) { + + [self.startCancelButtonTapped setTitle:@"Start" forState:UIControlStateNormal]; + [self.pauseResumeButtonTapped setTitle:@"Pause" forState:UIControlStateNormal]; + self.pauseResumeButtonTapped.enabled = NO; + self.timerLabel.hidden = YES; + self.timerPickerView.hidden = NO; + + [self.timer invalidate]; + self.timer = nil; + + } else { + + [self.startCancelButtonTapped setTitle:@"Cancel" forState:UIControlStateNormal]; + self.pauseResumeButtonTapped.enabled = YES; + + + if (self.timer == nil) { + self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerFired:) userInfo:nil repeats:YES]; + } + } + + self.isTimerRunning = !self.isTimerRunning; +} + +- (IBAction)pauseResumeButtonTapped:(id)sender { + if (self.isTimerPaused == NO) { + [self.timer invalidate]; + self.timer = nil; + + [self.pauseResumeButtonTapped setTitle:@"Resume" forState:UIControlStateNormal]; + + } else { + if (self.timer) { + [self.timer invalidate]; + self.timer = nil; + } + self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerFired:) userInfo:nil repeats:YES]; + [self.pauseResumeButtonTapped setTitle:@"Pause" forState:UIControlStateNormal]; + } + + self.isTimerPaused = !self.isTimerPaused; +} + +#pragma mark - Save new Timer ButtonTapped method +// The delegate method below is used to push new VC and pass data to it programmatically. When new VC is pushed in the storyboard through segue action, the method below should be implemented via prepareForSegue method. We don't need prepareForSegue method if we do it programmatically as below. +- (IBAction)saveButtonTapped:(id)sender { + + CQTimer *newTimer = [[CQTimer alloc] init]; + newTimer.timerTitle = self.timerTitleTextField.text; + newTimer.timerDuration = self.timerPickerView.countDownDuration; + newTimer.soundName = self.soundName; + NSString *path = [NSString stringWithFormat:@"%@/%@.mp3", [[NSBundle mainBundle] resourcePath], self.soundName]; + newTimer.soundURL = [NSURL fileURLWithPath:path]; + + [self.delegate addToTheArrayNewTimer:newTimer]; + + + + [self.navigationController popToRootViewControllerAnimated:YES]; +} + +#pragma mark - soundPickerView methods + +// Number of columns in the soundPickerView (one). +- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { + return 1; +} + +// Number of rows (choices) in the soundPickerView (as many as there are sound alarm choices). +- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { + return self.sounds.count; +} + +- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component; +{ + return [self.sounds objectAtIndex:row]; +} + +- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { + + self.soundName = [self.sounds objectAtIndex:row]; + + NSString *path = [NSString stringWithFormat:@"%@/%@.mp3", [[NSBundle mainBundle] resourcePath], self.soundName]; + NSURL *soundURL = [NSURL fileURLWithPath:path]; + + self.soundAtRowSelected = [[AVAudioPlayer alloc] initWithContentsOfURL:soundURL error:nil]; + [self.soundAtRowSelected play]; +} + +@end diff --git a/Time/Time/CQPresetTimerViewController.h b/Time/Time/CQPresetTimerViewController.h new file mode 100644 index 0000000..b19ee81 --- /dev/null +++ b/Time/Time/CQPresetTimerViewController.h @@ -0,0 +1,19 @@ +// +// CQPresetTimerViewController.h +// Time +// +// Created by Ayuna Vogel on 8/24/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import +#import "CQTimer.h" + +@interface CQPresetTimerViewController : UIViewController + +@property (nonatomic) CQTimer *timerObject; +@property (weak, nonatomic) IBOutlet UIDatePicker *timerPickerView; +@property (weak, nonatomic) IBOutlet UILabel *timerLabel; +@property (weak, nonatomic) IBOutlet UILabel *timerTitleLabel; + +@end diff --git a/Time/Time/CQPresetTimerViewController.m b/Time/Time/CQPresetTimerViewController.m new file mode 100644 index 0000000..22fced3 --- /dev/null +++ b/Time/Time/CQPresetTimerViewController.m @@ -0,0 +1,139 @@ +// +// CQPresetTimerViewController.m +// Time +// +// Created by Ayuna Vogel on 8/24/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import "CQPresetTimerViewController.h" +#import "TimerViewController.h" +#import +#import + +@interface CQPresetTimerViewController () + +@property (nonatomic) AVAudioPlayer *soundAlarmTimerIsUp; + +@property (nonatomic) NSTimer *timer; + +@property (nonatomic) int secondsCount; +@property (nonatomic) int hours; +@property (nonatomic) int minutes; +@property (nonatomic) int seconds; + +@property (nonatomic) BOOL isTimerRunning; +@property (nonatomic) BOOL isTimerPaused; + +@property (nonatomic) NSTimeInterval timerDuration; + +@property (weak, nonatomic) IBOutlet UIButton *startCancelButtonTapped; +@property (weak, nonatomic) IBOutlet UIButton *pauseResumeButtonTapped; + +@end + +@implementation CQPresetTimerViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.pauseResumeButtonTapped.enabled = NO; + self.timerPickerView.hidden = YES; + + self.timerTitleLabel.text = self.timerObject.timerTitle; + + self.hours = self.timerObject.timerDuration/3600; + self.minutes = fmod(self.timerObject.timerDuration, 3600) / 60; + self.seconds = self.timerObject.timerDuration - (self.hours * 3600) - (self.minutes * 60); + + self.timerLabel.text = [NSString stringWithFormat:@"%02i:%02i:%02i", self.hours, self.minutes, self.seconds]; + +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; +} + +- (void)timerFired: (NSTimer *)timer { + + self.secondsCount--; + + self.hours = self.secondsCount/3600; + self.minutes = (self.secondsCount % 3600)/60; + self.seconds = self.secondsCount - (self.hours * 3600) - (self.minutes * 60); + + self.timerLabel.text = [NSString stringWithFormat:@"%02i:%02i:%02i", self.hours, self.minutes, self.seconds]; + self.timerLabel.hidden = NO; + self.timerPickerView.hidden = YES; + + if (self.secondsCount <= 0) { + + [self.timer invalidate]; + self.timer = nil; + + self.soundAlarmTimerIsUp = [[AVAudioPlayer alloc] initWithContentsOfURL:self.timerObject.soundURL error:nil]; + [self.soundAlarmTimerIsUp play]; + + [self.startCancelButtonTapped setTitle:@"Start" forState:UIControlStateNormal]; + self.pauseResumeButtonTapped.enabled = NO; + + // adds vibration when the timer is up + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); + } +} + +- (IBAction)startCancelButtonTapped:(id)sender { + self.timerDuration = self.timerObject.timerDuration; + + self.hours = (int)(self.timerDuration/3600.0f); + self.minutes = ((int)self.timerDuration - (self.hours * 3600))/60; + self.seconds = self.timerDuration - (self.hours * 3600) - (self.minutes * 60); + + self.secondsCount = self.timerDuration; + + self.timerLabel.text = [NSString stringWithFormat:@"%02d:%02d:%02d", self.hours, self.minutes, self.seconds]; + + if (self.isTimerRunning == YES) { + + [self.startCancelButtonTapped setTitle:@"Start" forState:UIControlStateNormal]; + [self.pauseResumeButtonTapped setTitle:@"Pause" forState:UIControlStateNormal]; + self.pauseResumeButtonTapped.enabled = NO; + + [self.timer invalidate]; + self.timer = nil; + self.secondsCount = -1; + + } else { + + [self.startCancelButtonTapped setTitle:@"Cancel" forState:UIControlStateNormal]; + self.pauseResumeButtonTapped.enabled = YES; + + if (self.timer == nil) { + self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerFired:) userInfo:nil repeats:YES]; + } + } + + self.isTimerRunning = !self.isTimerRunning; +} + +- (IBAction)pauseResumeButtonTapped:(id)sender { + if (self.isTimerPaused == NO) { + [self.timer invalidate]; + self.timer = nil; + + [self.pauseResumeButtonTapped setTitle:@"Resume" forState:UIControlStateNormal]; + + } else { + if (self.timer) { + [self.timer invalidate]; + self.timer = nil; + } + self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerFired:) userInfo:nil repeats:YES]; + [self.pauseResumeButtonTapped setTitle:@"Pause" forState:UIControlStateNormal]; + } + + self.isTimerPaused = !self.isTimerPaused; +} + + +@end diff --git a/Time/Time/CQTimer.h b/Time/Time/CQTimer.h new file mode 100644 index 0000000..40eb78a --- /dev/null +++ b/Time/Time/CQTimer.h @@ -0,0 +1,31 @@ +// +// CQTimer.h +// Time +// +// Created by Ayuna Vogel on 8/28/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import + +@interface CQTimer : NSObject + +@property (nonatomic) CQTimer *timerObject; +@property (nonatomic) NSMutableArray *presetTimers; +@property (nonatomic) NSString *timerTitle; +@property (nonatomic) NSTimeInterval timerDuration; + +@property (nonatomic) NSTimer *timer; +@property (nonatomic) BOOL isTimerRunning; +@property (nonatomic) BOOL isTimerPaused; + +@property (nonatomic) int secondsCount; +@property (nonatomic) int hours; +@property (nonatomic) int minutes; +@property (nonatomic) int seconds; + +@property (nonatomic) NSURL *soundURL; +@property (nonatomic) NSString *soundName; + + +@end diff --git a/Time/Time/CQTimer.m b/Time/Time/CQTimer.m new file mode 100644 index 0000000..b4265f0 --- /dev/null +++ b/Time/Time/CQTimer.m @@ -0,0 +1,18 @@ +// +// CQTimer.m +// Time +// +// Created by Ayuna Vogel on 8/28/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import "CQTimer.h" + +@implementation CQTimer + +- (void)setTimerDuration:(NSTimeInterval)timerDuration { + + _timerDuration = timerDuration; +} + +@end diff --git a/Time/Time/Dramatic.mp3 b/Time/Time/Dramatic.mp3 new file mode 100755 index 0000000..1c8781f Binary files /dev/null and b/Time/Time/Dramatic.mp3 differ diff --git a/Time/Time/Futuristic Alarm.mp3 b/Time/Time/Futuristic Alarm.mp3 new file mode 100755 index 0000000..591b386 Binary files /dev/null and b/Time/Time/Futuristic Alarm.mp3 differ diff --git a/Time/Time/Images.xcassets/AppIcon.appiconset/Contents.json b/Time/Time/Images.xcassets/AppIcon.appiconset/Contents.json index 36d2c80..5008911 100644 --- a/Time/Time/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Time/Time/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,10 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "1x" + }, { "idiom" : "iphone", "size" : "29x29", @@ -20,6 +25,16 @@ "size" : "40x40", "scale" : "3x" }, + { + "idiom" : "iphone", + "size" : "57x57", + "scale" : "1x" + }, + { + "idiom" : "iphone", + "size" : "57x57", + "scale" : "2x" + }, { "idiom" : "iphone", "size" : "60x60", @@ -50,6 +65,26 @@ "size" : "40x40", "scale" : "2x" }, + { + "idiom" : "ipad", + "size" : "50x50", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "50x50", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "72x72", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "72x72", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "76x76", @@ -59,6 +94,65 @@ "idiom" : "ipad", "size" : "76x76", "scale" : "2x" + }, + { + "idiom" : "car", + "size" : "120x120", + "scale" : "1x" + }, + { + "size" : "24x24", + "idiom" : "watch", + "scale" : "2x", + "role" : "notificationCenter", + "subtype" : "38mm" + }, + { + "size" : "27.5x27.5", + "idiom" : "watch", + "scale" : "2x", + "role" : "notificationCenter", + "subtype" : "42mm" + }, + { + "size" : "29x29", + "idiom" : "watch", + "role" : "companionSettings", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "watch", + "role" : "companionSettings", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "watch", + "scale" : "2x", + "role" : "appLauncher", + "subtype" : "38mm" + }, + { + "size" : "44x44", + "idiom" : "watch", + "scale" : "2x", + "role" : "longLook", + "subtype" : "42mm" + }, + { + "size" : "86x86", + "idiom" : "watch", + "scale" : "2x", + "role" : "quickLook", + "subtype" : "38mm" + }, + { + "size" : "98x98", + "idiom" : "watch", + "scale" : "2x", + "role" : "quickLook", + "subtype" : "42mm" } ], "info" : { diff --git a/Time/Time/Images.xcassets/countdown-icon-on-white-background.imageset/11919834-countdown-icon-on-white-background.jpg b/Time/Time/Images.xcassets/countdown-icon-on-white-background.imageset/11919834-countdown-icon-on-white-background.jpg new file mode 100644 index 0000000..006ee4b Binary files /dev/null and b/Time/Time/Images.xcassets/countdown-icon-on-white-background.imageset/11919834-countdown-icon-on-white-background.jpg differ diff --git a/Time/Time/Images.xcassets/countdown-icon-on-white-background.imageset/Contents.json b/Time/Time/Images.xcassets/countdown-icon-on-white-background.imageset/Contents.json new file mode 100644 index 0000000..b3bc9db --- /dev/null +++ b/Time/Time/Images.xcassets/countdown-icon-on-white-background.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "11919834-countdown-icon-on-white-background.jpg" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Time/Time/Images.xcassets/countdown.imageset/Contents.json b/Time/Time/Images.xcassets/countdown.imageset/Contents.json new file mode 100644 index 0000000..cca45a4 --- /dev/null +++ b/Time/Time/Images.xcassets/countdown.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "countdown.jpg" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Time/Time/Images.xcassets/countdown.imageset/countdown.jpg b/Time/Time/Images.xcassets/countdown.imageset/countdown.jpg new file mode 100644 index 0000000..94d1418 Binary files /dev/null and b/Time/Time/Images.xcassets/countdown.imageset/countdown.jpg differ diff --git a/Time/Time/Images.xcassets/hourglass.imageset/Contents.json b/Time/Time/Images.xcassets/hourglass.imageset/Contents.json new file mode 100644 index 0000000..0a68d67 --- /dev/null +++ b/Time/Time/Images.xcassets/hourglass.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "hourglass@2x.png" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Time/Time/Images.xcassets/hourglass.imageset/hourglass@2x.png b/Time/Time/Images.xcassets/hourglass.imageset/hourglass@2x.png new file mode 100644 index 0000000..21dd3ea Binary files /dev/null and b/Time/Time/Images.xcassets/hourglass.imageset/hourglass@2x.png differ diff --git a/Time/Time/Images.xcassets/img-icon-app-5.imageset/Contents.json b/Time/Time/Images.xcassets/img-icon-app-5.imageset/Contents.json new file mode 100644 index 0000000..dbff0af --- /dev/null +++ b/Time/Time/Images.xcassets/img-icon-app-5.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "img-icon-app-5.jpg" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Time/Time/Images.xcassets/img-icon-app-5.imageset/img-icon-app-5.jpg b/Time/Time/Images.xcassets/img-icon-app-5.imageset/img-icon-app-5.jpg new file mode 100644 index 0000000..0f751fd Binary files /dev/null and b/Time/Time/Images.xcassets/img-icon-app-5.imageset/img-icon-app-5.jpg differ diff --git a/Time/Time/Images.xcassets/stopwatch -1.imageset/Contents.json b/Time/Time/Images.xcassets/stopwatch -1.imageset/Contents.json new file mode 100644 index 0000000..4756d3b --- /dev/null +++ b/Time/Time/Images.xcassets/stopwatch -1.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "stopwatch .png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Time/Time/Images.xcassets/stopwatch -1.imageset/stopwatch .png b/Time/Time/Images.xcassets/stopwatch -1.imageset/stopwatch .png new file mode 100644 index 0000000..4fa9652 Binary files /dev/null and b/Time/Time/Images.xcassets/stopwatch -1.imageset/stopwatch .png differ diff --git a/Time/Time/Images.xcassets/timer-1.imageset/Contents.json b/Time/Time/Images.xcassets/timer-1.imageset/Contents.json new file mode 100644 index 0000000..fa7ef00 --- /dev/null +++ b/Time/Time/Images.xcassets/timer-1.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "timer.png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Time/Time/Images.xcassets/timer-1.imageset/timer.png b/Time/Time/Images.xcassets/timer-1.imageset/timer.png new file mode 100644 index 0000000..6b512f3 Binary files /dev/null and b/Time/Time/Images.xcassets/timer-1.imageset/timer.png differ diff --git a/Time/Time/Info.plist b/Time/Time/Info.plist index 62e151f..ddaca81 100644 --- a/Time/Time/Info.plist +++ b/Time/Time/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - com.mikekavouras.$(PRODUCT_NAME:rfc1034identifier) + com.mikekavouras.OptionSelector CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/Time/Time/Just Alarm.mp3 b/Time/Time/Just Alarm.mp3 new file mode 100755 index 0000000..02c2ee7 Binary files /dev/null and b/Time/Time/Just Alarm.mp3 differ diff --git a/Time/Time/Kitchen Timer.mp3 b/Time/Time/Kitchen Timer.mp3 new file mode 100755 index 0000000..b2ddd1e Binary files /dev/null and b/Time/Time/Kitchen Timer.mp3 differ diff --git a/Time/Time/Magical Explosion.mp3 b/Time/Time/Magical Explosion.mp3 new file mode 100755 index 0000000..e798369 Binary files /dev/null and b/Time/Time/Magical Explosion.mp3 differ diff --git a/Time/Time/Main.storyboard b/Time/Time/Main.storyboard new file mode 100644 index 0000000..fd3c395 --- /dev/null +++ b/Time/Time/Main.storyboard @@ -0,0 +1,1158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Time/Time/Most Annoying Sound.mp3 b/Time/Time/Most Annoying Sound.mp3 new file mode 100755 index 0000000..3675bbe Binary files /dev/null and b/Time/Time/Most Annoying Sound.mp3 differ diff --git a/Time/Time/Radar.mp3 b/Time/Time/Radar.mp3 new file mode 100755 index 0000000..3889a0a Binary files /dev/null and b/Time/Time/Radar.mp3 differ diff --git a/Time/Time/Rocket Launch.mp3 b/Time/Time/Rocket Launch.mp3 new file mode 100755 index 0000000..0d3b0be Binary files /dev/null and b/Time/Time/Rocket Launch.mp3 differ diff --git a/Time/Time/SWViewController.h b/Time/Time/SWViewController.h new file mode 100644 index 0000000..50a409e --- /dev/null +++ b/Time/Time/SWViewController.h @@ -0,0 +1,21 @@ +// +// SWViewController.h +// Time +// +// Created by Christella on 8/23/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import + + + +@interface SWViewController : UIViewController + +@property (weak, nonatomic) IBOutlet UILabel *swLabel; + + + + + +@end diff --git a/Time/Time/SWViewController.m b/Time/Time/SWViewController.m new file mode 100644 index 0000000..8e83139 --- /dev/null +++ b/Time/Time/SWViewController.m @@ -0,0 +1,181 @@ +// +// SWViewController.m +// Time +// +// Created by Christella on 8/23/15. +// Copyright (c) 2015 Christella Dolmo. All rights reserved. +// + +#import "SWViewController.h" + + +@interface SWViewController () + +@property (strong, nonatomic) NSDate *startDate; + +@property (nonatomic) NSTimeInterval totalSessionTime; +@property (nonatomic) NSTimeInterval totalTime; +@property (nonatomic, assign, readwrite) NSTimeInterval currentLapTime; +@property (weak, nonatomic) NSTimer *stopWatchTimer; + +@property (weak, nonatomic) IBOutlet UIButton *startStopButton; +@property (weak, nonatomic) IBOutlet UIButton *lapResetButton; +@property (weak, nonatomic) IBOutlet UITableView *lapsTableView; +@property (strong,nonatomic)NSMutableArray *laps; +@property NSString *displayTime; + + +@end + +@implementation SWViewController + + +-(NSTimer *) createTimer { + + + + self.startDate = [[NSDate alloc]init]; + return [NSTimer scheduledTimerWithTimeInterval:1.0/10.0 target:self selector:@selector(updateTimer) userInfo:nil repeats:YES]; + + +} + +-(void)updateTimer { + + //create date from the elapsed time + NSDate *currentDate = [[NSDate alloc] init]; + + NSTimeInterval timeInterval = [currentDate timeIntervalSinceDate:self.startDate]; + + NSDate *timerDate = [NSDate dateWithTimeIntervalSince1970:timeInterval]; + + //create a date formatter + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init]; + + [dateFormatter setDateFormat:@"mm:ss.SS"]; + + [dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0.0]]; + + //format the elapsed time and set it to the label + NSString *timeString = [dateFormatter stringFromDate:timerDate]; + + self.swLabel.text= timeString; + + self.totalSessionTime = [currentDate timeIntervalSinceDate:self.startDate]; + + NSTimeInterval distance = self.totalTime + self.totalSessionTime; + + self.swLabel.text = [NSString stringWithFormat:@"%0.2f", distance]; + +} + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.swLabel.text = @"00:00.00"; + + [self.startStopButton setTitle:@"Start" forState:UIControlStateNormal]; + + [self.lapResetButton setTitle:@"Lap" forState:UIControlStateNormal]; + + self.laps = [[NSMutableArray alloc] init]; + + self.lapResetButton.enabled = NO; + + +} + +#pragma mark - Table view data source + +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [self.laps count]; +} + +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + NSString *SimpleIdentifier = @"SimpleIdentifier"; + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleIdentifier]; + if (cell ==nil) + { + cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleIdentifier]; + } + cell.textLabel.text = self.laps[indexPath.row]; + cell.detailTextLabel.text = @"Laps"; + + + return cell; +} + + +#pragma mark - Buttons! + +- (IBAction)startStopButtonAction:(id)sender { + + + + + if ( ! self.stopWatchTimer){ + self.stopWatchTimer = [self createTimer]; + + + [self.startStopButton setTitle:@"Stop" forState:UIControlStateNormal]; + [self.lapResetButton setTitle:@"Lap" forState:UIControlStateNormal]; + self.lapResetButton.enabled = YES; + + + + } else { + + + self.totalTime = self.totalTime + self.totalSessionTime; + + [self.stopWatchTimer invalidate]; + + [self.startStopButton setTitle:@"Start" forState:UIControlStateNormal]; + + [self.startStopButton setTitle:@"Stop" forState:UIControlStateNormal]; + + [self.startStopButton setTitle:@"Start" forState:UIControlStateNormal]; + + [self.lapResetButton setTitle:@"Reset" forState:UIControlStateNormal]; + +} + + +} + +- (IBAction)lapResetButtonAction:(id)sender { + + if(self.stopWatchTimer){ + + [self.lapResetButton setTitle:@"Lap" forState:UIControlStateNormal]; + + self.displayTime = self.swLabel.text; + + [self.laps addObject: self.displayTime]; + + [self.lapsTableView reloadData]; + + + + } + + if(!self.stopWatchTimer) { + + [self.lapResetButton setTitle:@"Lap" forState:UIControlStateNormal]; + + [self.stopWatchTimer invalidate]; + + self.stopWatchTimer = nil; + + self.laps = [[NSMutableArray alloc] init]; + + [self.lapsTableView reloadData]; + + self.swLabel.text=[NSString stringWithFormat :@"00:00.0"]; + + self.lapResetButton.enabled = NO; + } + + } + +@end diff --git a/Time/Time/ShowCDViewController.h b/Time/Time/ShowCDViewController.h new file mode 100644 index 0000000..7651e4d --- /dev/null +++ b/Time/Time/ShowCDViewController.h @@ -0,0 +1,19 @@ +// +// ShowCDViewController.h +// Time +// +// Created by Christella on 9/1/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import +#import "CDEvents.h" + +@interface ShowCDViewController : UIViewController + + +@property (nonatomic) CDEvents *eventObject; +@property (nonatomic) NSString *theEventTitleName; + + +@end diff --git a/Time/Time/ShowCDViewController.m b/Time/Time/ShowCDViewController.m new file mode 100644 index 0000000..1b67f3a --- /dev/null +++ b/Time/Time/ShowCDViewController.m @@ -0,0 +1,67 @@ +// +// ShowCDViewController.m +// Time +// +// Created by Christella on 9/1/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import "ShowCDViewController.h" +#import "CDViewController.h" + +@interface ShowCDViewController () + +@property (weak, nonatomic) IBOutlet UILabel *theTitle; + +@property (weak, nonatomic) IBOutlet UILabel *showCountdown; + +@property (weak, nonatomic) IBOutlet UILabel *date; + + + + + +@end + +@implementation ShowCDViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.theTitle.text = self.eventObject.userEventTitle; + + [self displayUpdatedTime]; + + NSTimer *timer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(displayUpdatedTime) userInfo:nil repeats:YES]; + [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes]; + + + + //Get the time left until the specified date + +// +// NSDate *myDate = self.datePicker.date; +// +// NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; +// [dateFormat setDateFormat:@"cccc, MMM d, hh:mm aa"]; +// NSString *theEventDate = [dateFormat stringFromDate:myDate]; + + +} + +- (void)displayUpdatedTime { + NSInteger ti = ((NSInteger)[self.eventObject.date timeIntervalSinceNow]); + NSInteger seconds = ti % 60; + NSInteger minutes = (ti / 60) % 60; + NSInteger hours = (ti / 3600) % 24; + NSInteger days = (ti / 86400); + + //Update the label with the remaining time + self.showCountdown.text = [NSString stringWithFormat:@"%02li days %02li hrs %02li min %02li sec", (long)days, (long)hours, (long)minutes, (long)seconds]; +} + + + + + +@end diff --git a/Time/Time/Sonar.mp3 b/Time/Time/Sonar.mp3 new file mode 100755 index 0000000..90e78cb Binary files /dev/null and b/Time/Time/Sonar.mp3 differ diff --git a/Time/Time/TimerViewController.h b/Time/Time/TimerViewController.h new file mode 100644 index 0000000..11625f3 --- /dev/null +++ b/Time/Time/TimerViewController.h @@ -0,0 +1,16 @@ +// +// TimerViewController.h +// Time +// +// Created by Christella on 8/23/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import +#import "CQTimer.h" + +@interface TimerViewController : UIViewController + +@property (nonatomic) CQTimer *timerObject; + +@end diff --git a/Time/Time/TimerViewController.m b/Time/Time/TimerViewController.m new file mode 100644 index 0000000..0744d68 --- /dev/null +++ b/Time/Time/TimerViewController.m @@ -0,0 +1,240 @@ +// +// TimerViewController.m +// Time +// +// Created by Christella on 8/23/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import "TimerViewController.h" +#import "CQTimer.h" +#import "CQNewTimerViewController.h" +#import "CQPresetTimerViewController.h" +#import + +@interface TimerViewController () + +@property (nonatomic) AVAudioPlayer *soundAlarmTimerIsUp; + +@property (nonatomic) NSTimer *timer; +@property (nonatomic) NSTimeInterval timerDuration; +@property (weak, nonatomic) IBOutlet UIDatePicker *timerPickerView; +@property (weak, nonatomic) IBOutlet UILabel *timerLabel; +@property (weak, nonatomic) IBOutlet UIButton *startButtonTapped; +@property (weak, nonatomic) IBOutlet UIButton *pauseButtonTapped; +@property (weak, nonatomic) IBOutlet UITableView *timersTableView; + +@property (nonatomic) NSMutableArray *presetTimers; + +@property (nonatomic) BOOL isTimerRunning; +@property (nonatomic) BOOL isTimerPaused; + +@property (nonatomic) int secondsCount; +@property (nonatomic) int hours; +@property (nonatomic) int minutes; +@property (nonatomic) int seconds; + + +@end + +@implementation TimerViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.isTimerRunning = NO; + self.isTimerPaused = NO; + self.pauseButtonTapped.enabled = NO; + [self.timerLabel setHidden:YES]; + + NSInteger seconds = 60; + [self.timerPickerView setDatePickerMode:UIDatePickerModeCountDownTimer]; + [self.timerPickerView setCountDownDuration:seconds]; + + //tableview methods + if (!self.presetTimers) { + self.presetTimers = [[NSMutableArray alloc] init]; + } + + CQTimer *coffeeTimer = [[CQTimer alloc] init]; + coffeeTimer.timerTitle = @"Coffee Timer"; + coffeeTimer.timerDuration = 180; + coffeeTimer.soundName = @"Kitchen Timer"; + NSString *path = [NSString stringWithFormat:@"%@/%@.mp3", [[NSBundle mainBundle] resourcePath], coffeeTimer.soundName]; + coffeeTimer.soundURL = [NSURL fileURLWithPath:path]; + [self.presetTimers addObject:coffeeTimer]; + + //scope method (curly braces) so that NSString *path is not redefined every time but is defined only within the scope + { + CQTimer *popcornTimer = [[CQTimer alloc] init]; + popcornTimer.timerTitle = @"Popcorn Timer"; + popcornTimer.timerDuration = 165; + popcornTimer.soundName = @"Dramatic"; + NSString *path = [NSString stringWithFormat:@"%@/%@.mp3", [[NSBundle mainBundle] resourcePath], popcornTimer.soundName]; + popcornTimer.soundURL = [NSURL fileURLWithPath:path]; + [self.presetTimers addObject:popcornTimer]; + } + + //scope method (curly braces) so that NSString *path is not redefined every time but is defined only within the scope + { + CQTimer *demoTimer = [[CQTimer alloc]init]; + demoTimer.timerTitle = @"Demo Timer"; + demoTimer.timerDuration = 3; + demoTimer.soundName = @"Zombies"; + NSString *path = [NSString stringWithFormat:@"%@/%@.mp3", [[NSBundle mainBundle] resourcePath], demoTimer.soundName]; + demoTimer.soundURL = [NSURL fileURLWithPath:path]; + [self.presetTimers addObject:demoTimer]; + } + + // Control dragging from tableview in the storyboard to the timer itself and setting it to its datasource and delegates implements the code below + // self.timersTableView.dataSource = self; + // self.timersTableView.delegate = self; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; +} + +- (void)timerFired: (NSTimer *)timer { + self.secondsCount--; + + self.hours = self.secondsCount/3600; + self.minutes = (self.secondsCount % 3600)/60; + self.seconds = self.secondsCount - (self.hours * 3600) - (self.minutes * 60); + + self.timerLabel.text = [NSString stringWithFormat:@"%02i:%02i:%02i", self.hours, self.minutes, self.seconds]; + self.timerLabel.hidden = NO; + self.timerPickerView.hidden = YES; + + if (self.secondsCount <= 0) { + + [self.timer invalidate]; + self.timer = nil; + + // Create audio player object and initialize with URL to sound + self.soundAlarmTimerIsUp = [[AVAudioPlayer alloc] initWithContentsOfURL:self.timerObject.soundURL error:nil]; + [self.soundAlarmTimerIsUp play]; + + [self.startButtonTapped setTitle:@"Start" forState:UIControlStateNormal]; + self.pauseButtonTapped.enabled = NO; + + // adds vibration when the timer is up + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); + } +} + +#pragma mark - Button methods +//start & cancel Button Tapped +- (IBAction)startButtonTapped:(id)sender { + + self.timerDuration = self.timerPickerView.countDownDuration; + + self.seconds = 0; + self.hours = (int)(self.timerDuration/3600.0f); + self.minutes = ((int)self.timerDuration - (self.hours * 3600))/60; + + self.secondsCount = ((self.hours * 3600) + (self.minutes * 60)); + + self.timerLabel.text = [NSString stringWithFormat:@"%02i:%02i:%02i", self.hours, self.minutes, self.seconds]; + + if (self.isTimerRunning == YES) { + + [self.startButtonTapped setTitle:@"Start" forState:UIControlStateNormal]; + [self.pauseButtonTapped setTitle:@"Pause" forState:UIControlStateNormal]; + self.pauseButtonTapped.enabled = NO; + self.timerLabel.hidden = YES; + self.timerPickerView.hidden = NO; + + [self.timer invalidate]; + self.timer = nil; + + } else { + + [self.startButtonTapped setTitle:@"Cancel" forState:UIControlStateNormal]; + self.pauseButtonTapped.enabled = YES; + + + if (self.timer == nil) { + self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerFired:) userInfo:nil repeats:YES]; + } + } + + self.isTimerRunning = !self.isTimerRunning; +} + +//pause & resume Button Tapped +- (IBAction)pauseButtonTapped:(id)sender { + if (self.isTimerPaused == NO) { + [self.timer invalidate]; + self.timer = nil; + + [self.pauseButtonTapped setTitle:@"Resume" forState:UIControlStateNormal]; + + } else { + if (self.timer) { + [self.timer invalidate]; + self.timer = nil; + } + self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerFired:) userInfo:nil repeats:YES]; + [self.pauseButtonTapped setTitle:@"Pause" forState:UIControlStateNormal]; + } + + self.isTimerPaused = !self.isTimerPaused; +} + +#pragma mark - Table View methods + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.presetTimers.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + UITableViewCell *cell = [self.timersTableView dequeueReusableCellWithIdentifier:@"TimerCellIdentifier" forIndexPath:indexPath]; + + CQTimer *timerTemp; + timerTemp = [self.presetTimers objectAtIndex:indexPath.row]; + + cell.textLabel.text = timerTemp.timerTitle; + + return cell; +} + +#pragma mark - New Timer button tapped method + +- (IBAction)newTimerButtonTapped:(UIBarButtonItem *)sender { + + if([sender.title isEqualToString:@"New Timer"]){ + + CQNewTimerViewController *newTimerVC = [self.storyboard instantiateViewControllerWithIdentifier:@"NewTimerViewController"]; + newTimerVC.delegate = self; + [self.navigationController pushViewController:newTimerVC animated:YES]; + } +} + +#pragma mark - Delegate methods + +- (void) addToTheArrayNewTimer:(CQTimer *)newTimer { + [self.presetTimers addObject:newTimer]; + [self.timersTableView reloadData]; +} + +#pragma mark - didSelectRowAtIndexPath + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + + CQPresetTimerViewController *presetTimerVC = [self.storyboard instantiateViewControllerWithIdentifier:@"PresetTimerViewController"]; + + CQTimer *timerObject = self.presetTimers[indexPath.row]; + + //pass the CQTimer timerObject to the next VC + presetTimerVC.timerObject = timerObject; + + [self.navigationController pushViewController:presetTimerVC animated:YES]; +} + +@end diff --git a/Time/Time/Tornado Siren.mp3 b/Time/Time/Tornado Siren.mp3 new file mode 100755 index 0000000..ebee0ff Binary files /dev/null and b/Time/Time/Tornado Siren.mp3 differ diff --git a/Time/Time/Zombies.mp3 b/Time/Time/Zombies.mp3 new file mode 100755 index 0000000..724c4ec Binary files /dev/null and b/Time/Time/Zombies.mp3 differ