diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..fcabc93 Binary files /dev/null and b/.DS_Store differ diff --git a/TapeDeck.xcodeproj/project.pbxproj b/TapeDeck.xcodeproj/project.pbxproj new file mode 100644 index 0000000..062688e --- /dev/null +++ b/TapeDeck.xcodeproj/project.pbxproj @@ -0,0 +1,676 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 52; + objects = { + +/* Begin PBXBuildFile section */ + BD7A5E342510173A003E992C /* day.gif in Resources */ = {isa = PBXBuildFile; fileRef = BD7A5E332510173A003E992C /* day.gif */; }; + BD7D35D72510042D00A61B6B /* night.gif in Resources */ = {isa = PBXBuildFile; fileRef = BD7D35D52510042D00A61B6B /* night.gif */; }; + BD7D35DB2510111700A61B6B /* SwiftyGif in Frameworks */ = {isa = PBXBuildFile; productRef = BD7D35DA2510111700A61B6B /* SwiftyGif */; }; + BDA060FA2447F3E6009C72CE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDA060F92447F3E6009C72CE /* AppDelegate.swift */; }; + BDA060FC2447F3E6009C72CE /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDA060FB2447F3E6009C72CE /* SceneDelegate.swift */; }; + BDA060FE2447F3E6009C72CE /* FirstViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDA060FD2447F3E6009C72CE /* FirstViewController.swift */; }; + BDA061002447F3E6009C72CE /* SecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDA060FF2447F3E6009C72CE /* SecondViewController.swift */; }; + BDA061032447F3E6009C72CE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BDA061012447F3E6009C72CE /* Main.storyboard */; }; + BDA061052447F3F2009C72CE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BDA061042447F3F2009C72CE /* Assets.xcassets */; }; + BDA061082447F3F2009C72CE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BDA061062447F3F2009C72CE /* LaunchScreen.storyboard */; }; + BDA061132447F3F3009C72CE /* grandfatherrockTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDA061122447F3F3009C72CE /* grandfatherrockTests.swift */; }; + BDA0611E2447F3F3009C72CE /* grandfatherrockUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDA0611D2447F3F3009C72CE /* grandfatherrockUITests.swift */; }; + BDB53FCE250765A2004E9788 /* FinkHeavy.ttf in Resources */ = {isa = PBXBuildFile; fileRef = BDB53FCC250765A1004E9788 /* FinkHeavy.ttf */; }; + BDE8138F2507422100371570 /* ThirdViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDE8138E2507422100371570 /* ThirdViewController.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + BDA0610F2447F3F3009C72CE /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BDA060EE2447F3E5009C72CE /* Project object */; + proxyType = 1; + remoteGlobalIDString = BDA060F52447F3E6009C72CE; + remoteInfo = grandfatherrock; + }; + BDA0611A2447F3F3009C72CE /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BDA060EE2447F3E5009C72CE /* Project object */; + proxyType = 1; + remoteGlobalIDString = BDA060F52447F3E6009C72CE; + remoteInfo = grandfatherrock; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + BD7A5E332510173A003E992C /* day.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = day.gif; sourceTree = ""; }; + BD7D35D52510042D00A61B6B /* night.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = night.gif; sourceTree = ""; }; + BDA060F62447F3E6009C72CE /* Nook Music.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Nook Music.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + BDA060F92447F3E6009C72CE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + BDA060FB2447F3E6009C72CE /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + BDA060FD2447F3E6009C72CE /* FirstViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstViewController.swift; sourceTree = ""; }; + BDA060FF2447F3E6009C72CE /* SecondViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondViewController.swift; sourceTree = ""; }; + BDA061022447F3E6009C72CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + BDA061042447F3F2009C72CE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + BDA061072447F3F2009C72CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + BDA061092447F3F2009C72CE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + BDA0610E2447F3F3009C72CE /* grandfatherrockTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = grandfatherrockTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + BDA061122447F3F3009C72CE /* grandfatherrockTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = grandfatherrockTests.swift; sourceTree = ""; }; + BDA061142447F3F3009C72CE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + BDA061192447F3F3009C72CE /* grandfatherrockUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = grandfatherrockUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + BDA0611D2447F3F3009C72CE /* grandfatherrockUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = grandfatherrockUITests.swift; sourceTree = ""; }; + BDA0611F2447F3F3009C72CE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + BDA0618A244826DB009C72CE /* grandfatherrock.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = grandfatherrock.entitlements; sourceTree = ""; }; + BDB53FCC250765A1004E9788 /* FinkHeavy.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = FinkHeavy.ttf; sourceTree = ""; }; + BDE8138E2507422100371570 /* ThirdViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThirdViewController.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + BDA060F32447F3E6009C72CE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + BD7D35DB2510111700A61B6B /* SwiftyGif in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BDA0610B2447F3F3009C72CE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BDA061162447F3F3009C72CE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + BD7D35D42510042D00A61B6B /* gifs */ = { + isa = PBXGroup; + children = ( + BD7A5E332510173A003E992C /* day.gif */, + BD7D35D52510042D00A61B6B /* night.gif */, + ); + path = gifs; + sourceTree = ""; + }; + BDA060ED2447F3E5009C72CE = { + isa = PBXGroup; + children = ( + BDA060F82447F3E6009C72CE /* grandfatherrock */, + BDA061112447F3F3009C72CE /* grandfatherrockTests */, + BDA0611C2447F3F3009C72CE /* grandfatherrockUITests */, + BDA060F72447F3E6009C72CE /* Products */, + ); + sourceTree = ""; + }; + BDA060F72447F3E6009C72CE /* Products */ = { + isa = PBXGroup; + children = ( + BDA060F62447F3E6009C72CE /* Nook Music.app */, + BDA0610E2447F3F3009C72CE /* grandfatherrockTests.xctest */, + BDA061192447F3F3009C72CE /* grandfatherrockUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + BDA060F82447F3E6009C72CE /* grandfatherrock */ = { + isa = PBXGroup; + children = ( + BDA0618A244826DB009C72CE /* grandfatherrock.entitlements */, + BDA060F92447F3E6009C72CE /* AppDelegate.swift */, + BDA060FB2447F3E6009C72CE /* SceneDelegate.swift */, + BDA060FD2447F3E6009C72CE /* FirstViewController.swift */, + BDA060FF2447F3E6009C72CE /* SecondViewController.swift */, + BDE8138E2507422100371570 /* ThirdViewController.swift */, + BDA061012447F3E6009C72CE /* Main.storyboard */, + BDA061042447F3F2009C72CE /* Assets.xcassets */, + BD7D35D42510042D00A61B6B /* gifs */, + BDB53FCA250765A1004E9788 /* fonts */, + BDA061062447F3F2009C72CE /* LaunchScreen.storyboard */, + BDA061092447F3F2009C72CE /* Info.plist */, + ); + path = grandfatherrock; + sourceTree = ""; + }; + BDA061112447F3F3009C72CE /* grandfatherrockTests */ = { + isa = PBXGroup; + children = ( + BDA061122447F3F3009C72CE /* grandfatherrockTests.swift */, + BDA061142447F3F3009C72CE /* Info.plist */, + ); + path = grandfatherrockTests; + sourceTree = ""; + }; + BDA0611C2447F3F3009C72CE /* grandfatherrockUITests */ = { + isa = PBXGroup; + children = ( + BDA0611D2447F3F3009C72CE /* grandfatherrockUITests.swift */, + BDA0611F2447F3F3009C72CE /* Info.plist */, + ); + path = grandfatherrockUITests; + sourceTree = ""; + }; + BDB53FCA250765A1004E9788 /* fonts */ = { + isa = PBXGroup; + children = ( + BDB53FCC250765A1004E9788 /* FinkHeavy.ttf */, + ); + path = fonts; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + BDA060F52447F3E6009C72CE /* grandfatherrock */ = { + isa = PBXNativeTarget; + buildConfigurationList = BDA061222447F3F3009C72CE /* Build configuration list for PBXNativeTarget "grandfatherrock" */; + buildPhases = ( + BDA060F22447F3E6009C72CE /* Sources */, + BDA060F32447F3E6009C72CE /* Frameworks */, + BDA060F42447F3E6009C72CE /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = grandfatherrock; + packageProductDependencies = ( + BD7D35DA2510111700A61B6B /* SwiftyGif */, + ); + productName = grandfatherrock; + productReference = BDA060F62447F3E6009C72CE /* Nook Music.app */; + productType = "com.apple.product-type.application"; + }; + BDA0610D2447F3F3009C72CE /* grandfatherrockTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = BDA061252447F3F3009C72CE /* Build configuration list for PBXNativeTarget "grandfatherrockTests" */; + buildPhases = ( + BDA0610A2447F3F3009C72CE /* Sources */, + BDA0610B2447F3F3009C72CE /* Frameworks */, + BDA0610C2447F3F3009C72CE /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + BDA061102447F3F3009C72CE /* PBXTargetDependency */, + ); + name = grandfatherrockTests; + productName = grandfatherrockTests; + productReference = BDA0610E2447F3F3009C72CE /* grandfatherrockTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + BDA061182447F3F3009C72CE /* grandfatherrockUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = BDA061282447F3F3009C72CE /* Build configuration list for PBXNativeTarget "grandfatherrockUITests" */; + buildPhases = ( + BDA061152447F3F3009C72CE /* Sources */, + BDA061162447F3F3009C72CE /* Frameworks */, + BDA061172447F3F3009C72CE /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + BDA0611B2447F3F3009C72CE /* PBXTargetDependency */, + ); + name = grandfatherrockUITests; + productName = grandfatherrockUITests; + productReference = BDA061192447F3F3009C72CE /* grandfatherrockUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + BDA060EE2447F3E5009C72CE /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1140; + LastUpgradeCheck = 1200; + ORGANIZATIONNAME = "Micah Gomez"; + TargetAttributes = { + BDA060F52447F3E6009C72CE = { + CreatedOnToolsVersion = 11.4.1; + }; + BDA0610D2447F3F3009C72CE = { + CreatedOnToolsVersion = 11.4.1; + TestTargetID = BDA060F52447F3E6009C72CE; + }; + BDA061182447F3F3009C72CE = { + CreatedOnToolsVersion = 11.4.1; + TestTargetID = BDA060F52447F3E6009C72CE; + }; + }; + }; + buildConfigurationList = BDA060F12447F3E5009C72CE /* Build configuration list for PBXProject "TapeDeck" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = BDA060ED2447F3E5009C72CE; + packageReferences = ( + BD7D35D92510111700A61B6B /* XCRemoteSwiftPackageReference "SwiftyGif" */, + ); + productRefGroup = BDA060F72447F3E6009C72CE /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + BDA060F52447F3E6009C72CE /* grandfatherrock */, + BDA0610D2447F3F3009C72CE /* grandfatherrockTests */, + BDA061182447F3F3009C72CE /* grandfatherrockUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + BDA060F42447F3E6009C72CE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BDA061082447F3F2009C72CE /* LaunchScreen.storyboard in Resources */, + BDA061052447F3F2009C72CE /* Assets.xcassets in Resources */, + BD7D35D72510042D00A61B6B /* night.gif in Resources */, + BD7A5E342510173A003E992C /* day.gif in Resources */, + BDA061032447F3E6009C72CE /* Main.storyboard in Resources */, + BDB53FCE250765A2004E9788 /* FinkHeavy.ttf in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BDA0610C2447F3F3009C72CE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BDA061172447F3F3009C72CE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + BDA060F22447F3E6009C72CE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BDA061002447F3E6009C72CE /* SecondViewController.swift in Sources */, + BDA060FE2447F3E6009C72CE /* FirstViewController.swift in Sources */, + BDE8138F2507422100371570 /* ThirdViewController.swift in Sources */, + BDA060FA2447F3E6009C72CE /* AppDelegate.swift in Sources */, + BDA060FC2447F3E6009C72CE /* SceneDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BDA0610A2447F3F3009C72CE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BDA061132447F3F3009C72CE /* grandfatherrockTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BDA061152447F3F3009C72CE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BDA0611E2447F3F3009C72CE /* grandfatherrockUITests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + BDA061102447F3F3009C72CE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = BDA060F52447F3E6009C72CE /* grandfatherrock */; + targetProxy = BDA0610F2447F3F3009C72CE /* PBXContainerItemProxy */; + }; + BDA0611B2447F3F3009C72CE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = BDA060F52447F3E6009C72CE /* grandfatherrock */; + targetProxy = BDA0611A2447F3F3009C72CE /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + BDA061012447F3E6009C72CE /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + BDA061022447F3E6009C72CE /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + BDA061062447F3F2009C72CE /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + BDA061072447F3F2009C72CE /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + BDA061202447F3F3009C72CE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.4; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + BDA061212447F3F3009C72CE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.4; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + BDA061232447F3F3009C72CE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = grandfatherrock/grandfatherrock.entitlements; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 4; + DEVELOPMENT_TEAM = PRBH2T6668; + INFOPLIST_FILE = grandfatherrock/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = dev.mpg13.grandfatherrock; + PRODUCT_NAME = "Nook Music"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + BDA061242447F3F3009C72CE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = grandfatherrock/grandfatherrock.entitlements; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 4; + DEVELOPMENT_TEAM = PRBH2T6668; + INFOPLIST_FILE = grandfatherrock/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = dev.mpg13.grandfatherrock; + PRODUCT_NAME = "Nook Music"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + BDA061262447F3F3009C72CE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = PRBH2T6668; + INFOPLIST_FILE = grandfatherrockTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.4; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = dev.mpg13.grandfatherrockTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/grandfatherrock.app/grandfatherrock"; + }; + name = Debug; + }; + BDA061272447F3F3009C72CE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = PRBH2T6668; + INFOPLIST_FILE = grandfatherrockTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.4; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = dev.mpg13.grandfatherrockTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/grandfatherrock.app/grandfatherrock"; + }; + name = Release; + }; + BDA061292447F3F3009C72CE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = PRBH2T6668; + INFOPLIST_FILE = grandfatherrockUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = dev.mpg13.grandfatherrockUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = grandfatherrock; + }; + name = Debug; + }; + BDA0612A2447F3F3009C72CE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = PRBH2T6668; + INFOPLIST_FILE = grandfatherrockUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = dev.mpg13.grandfatherrockUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = grandfatherrock; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + BDA060F12447F3E5009C72CE /* Build configuration list for PBXProject "TapeDeck" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BDA061202447F3F3009C72CE /* Debug */, + BDA061212447F3F3009C72CE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + BDA061222447F3F3009C72CE /* Build configuration list for PBXNativeTarget "grandfatherrock" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BDA061232447F3F3009C72CE /* Debug */, + BDA061242447F3F3009C72CE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + BDA061252447F3F3009C72CE /* Build configuration list for PBXNativeTarget "grandfatherrockTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BDA061262447F3F3009C72CE /* Debug */, + BDA061272447F3F3009C72CE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + BDA061282447F3F3009C72CE /* Build configuration list for PBXNativeTarget "grandfatherrockUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BDA061292447F3F3009C72CE /* Debug */, + BDA0612A2447F3F3009C72CE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + BD7D35D92510111700A61B6B /* XCRemoteSwiftPackageReference "SwiftyGif" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/kirualex/SwiftyGif.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 5.3.0; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + BD7D35DA2510111700A61B6B /* SwiftyGif */ = { + isa = XCSwiftPackageProductDependency; + package = BD7D35D92510111700A61B6B /* XCRemoteSwiftPackageReference "SwiftyGif" */; + productName = SwiftyGif; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = BDA060EE2447F3E5009C72CE /* Project object */; +} diff --git a/TapeDeck.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/TapeDeck.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/TapeDeck.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/TapeDeck.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/TapeDeck.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/TapeDeck.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/TapeDeck.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/TapeDeck.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..deab0db --- /dev/null +++ b/TapeDeck.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,16 @@ +{ + "object": { + "pins": [ + { + "package": "SwiftyGif", + "repositoryURL": "https://github.com/kirualex/SwiftyGif.git", + "state": { + "branch": null, + "revision": "420d12cba8338b03993f73a72c1f6b70d5273cf2", + "version": "5.3.0" + } + } + ] + }, + "version": 1 +} diff --git a/TapeDeck.xcodeproj/project.xcworkspace/xcuserdata/micahgomez.xcuserdatad/UserInterfaceState.xcuserstate b/TapeDeck.xcodeproj/project.xcworkspace/xcuserdata/micahgomez.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..8d3f618 Binary files /dev/null and b/TapeDeck.xcodeproj/project.xcworkspace/xcuserdata/micahgomez.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/TapeDeck.xcodeproj/xcuserdata/micahgomez.xcuserdatad/xcschemes/xcschememanagement.plist b/TapeDeck.xcodeproj/xcuserdata/micahgomez.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..d4ace7b --- /dev/null +++ b/TapeDeck.xcodeproj/xcuserdata/micahgomez.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + grandfatherrock.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/TapeDeck.xcworkspace/contents.xcworkspacedata b/TapeDeck.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..e1a7ae3 --- /dev/null +++ b/TapeDeck.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/grandfatherrock/.DS_Store b/grandfatherrock/.DS_Store new file mode 100644 index 0000000..aa6d45c Binary files /dev/null and b/grandfatherrock/.DS_Store differ diff --git a/grandfatherrock/AppDelegate.swift b/grandfatherrock/AppDelegate.swift new file mode 100644 index 0000000..f10493a --- /dev/null +++ b/grandfatherrock/AppDelegate.swift @@ -0,0 +1,37 @@ +// +// AppDelegate.swift +// grandfatherrock +// +// Created by Micah Gomez on 4/15/20. +// Copyright © 2020 Micah Gomez. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + // MARK: UISceneSession Lifecycle + + func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) + } + + func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { + // Called when the user discards a scene session. + // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. + // Use this method to release any resources that were specific to the discarded scenes, as they will not return. + } + + +} + diff --git a/grandfatherrock/Assets.xcassets/.DS_Store b/grandfatherrock/Assets.xcassets/.DS_Store new file mode 100644 index 0000000..808f139 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/.DS_Store differ diff --git a/grandfatherrock/Assets.xcassets/ACBackgroundDay.imageset/ACBackgroundNightLarge-1.png b/grandfatherrock/Assets.xcassets/ACBackgroundDay.imageset/ACBackgroundNightLarge-1.png new file mode 100644 index 0000000..b97d971 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/ACBackgroundDay.imageset/ACBackgroundNightLarge-1.png differ diff --git a/grandfatherrock/Assets.xcassets/ACBackgroundDay.imageset/ACBackgroundNightLarge-2.png b/grandfatherrock/Assets.xcassets/ACBackgroundDay.imageset/ACBackgroundNightLarge-2.png new file mode 100644 index 0000000..b97d971 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/ACBackgroundDay.imageset/ACBackgroundNightLarge-2.png differ diff --git a/grandfatherrock/Assets.xcassets/ACBackgroundDay.imageset/ACBackgroundNightLarge.png b/grandfatherrock/Assets.xcassets/ACBackgroundDay.imageset/ACBackgroundNightLarge.png new file mode 100644 index 0000000..b97d971 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/ACBackgroundDay.imageset/ACBackgroundNightLarge.png differ diff --git a/grandfatherrock/Assets.xcassets/ACBackgroundDay.imageset/Contents.json b/grandfatherrock/Assets.xcassets/ACBackgroundDay.imageset/Contents.json new file mode 100644 index 0000000..6479c2e --- /dev/null +++ b/grandfatherrock/Assets.xcassets/ACBackgroundDay.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "ACBackgroundNightLarge.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "ACBackgroundNightLarge-1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "ACBackgroundNightLarge-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/grandfatherrock/Assets.xcassets/ACBackgroundNight.imageset/ACBackgroundDayLarge-1.png b/grandfatherrock/Assets.xcassets/ACBackgroundNight.imageset/ACBackgroundDayLarge-1.png new file mode 100644 index 0000000..914fbe2 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/ACBackgroundNight.imageset/ACBackgroundDayLarge-1.png differ diff --git a/grandfatherrock/Assets.xcassets/ACBackgroundNight.imageset/ACBackgroundDayLarge-2.png b/grandfatherrock/Assets.xcassets/ACBackgroundNight.imageset/ACBackgroundDayLarge-2.png new file mode 100644 index 0000000..914fbe2 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/ACBackgroundNight.imageset/ACBackgroundDayLarge-2.png differ diff --git a/grandfatherrock/Assets.xcassets/ACBackgroundNight.imageset/ACBackgroundDayLarge.png b/grandfatherrock/Assets.xcassets/ACBackgroundNight.imageset/ACBackgroundDayLarge.png new file mode 100644 index 0000000..914fbe2 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/ACBackgroundNight.imageset/ACBackgroundDayLarge.png differ diff --git a/grandfatherrock/Assets.xcassets/ACBackgroundNight.imageset/Contents.json b/grandfatherrock/Assets.xcassets/ACBackgroundNight.imageset/Contents.json new file mode 100644 index 0000000..225853a --- /dev/null +++ b/grandfatherrock/Assets.xcassets/ACBackgroundNight.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "ACBackgroundDayLarge.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "ACBackgroundDayLarge-1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "ACBackgroundDayLarge-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Contents.json b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..1e2d708 --- /dev/null +++ b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "filename" : "Icon-App-20x20@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "filename" : "Icon-App-20x20@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "filename" : "Icon-App-29x29@1x.png", + "idiom" : "iphone", + "scale" : "1x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-29x29@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-29x29@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-40x40@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "filename" : "Icon-App-40x40@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "filename" : "Icon-App-60x60@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "filename" : "Icon-App-60x60@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "filename" : "Icon-App-20x20@1x.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "filename" : "Icon-App-20x20@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "filename" : "Icon-App-29x29@1x.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-29x29@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-40x40@1x.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "filename" : "Icon-App-40x40@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "filename" : "Icon-App-76x76@1x.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "filename" : "Icon-App-76x76@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "filename" : "Icon-App-83.5x83.5@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "filename" : "ItunesArtwork@2x.png", + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..2affa1d Binary files /dev/null and b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..89d324e Binary files /dev/null and b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..5c846c6 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..e372a86 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..11a4420 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..5541ec9 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..89d324e Binary files /dev/null and b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..bee4085 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..d8f18ff Binary files /dev/null and b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..d8f18ff Binary files /dev/null and b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..56fcbdd Binary files /dev/null and b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..56a621e Binary files /dev/null and b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..b295548 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..9cb69c1 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/grandfatherrock/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png new file mode 100644 index 0000000..f28b7d9 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png differ diff --git a/grandfatherrock/Assets.xcassets/Contents.json b/grandfatherrock/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/grandfatherrock/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/grandfatherrock/Assets.xcassets/LaunchImage.imageset/Contents.json b/grandfatherrock/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..54400ae --- /dev/null +++ b/grandfatherrock/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "output-onlineimagetools.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "output-onlineimagetools-1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "output-onlineimagetools-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/grandfatherrock/Assets.xcassets/LaunchImage.imageset/output-onlineimagetools-1.png b/grandfatherrock/Assets.xcassets/LaunchImage.imageset/output-onlineimagetools-1.png new file mode 100644 index 0000000..9fe67c2 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/LaunchImage.imageset/output-onlineimagetools-1.png differ diff --git a/grandfatherrock/Assets.xcassets/LaunchImage.imageset/output-onlineimagetools-2.png b/grandfatherrock/Assets.xcassets/LaunchImage.imageset/output-onlineimagetools-2.png new file mode 100644 index 0000000..9fe67c2 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/LaunchImage.imageset/output-onlineimagetools-2.png differ diff --git a/grandfatherrock/Assets.xcassets/LaunchImage.imageset/output-onlineimagetools.png b/grandfatherrock/Assets.xcassets/LaunchImage.imageset/output-onlineimagetools.png new file mode 100644 index 0000000..9fe67c2 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/LaunchImage.imageset/output-onlineimagetools.png differ diff --git a/grandfatherrock/Assets.xcassets/grass.imageset/Contents.json b/grandfatherrock/Assets.xcassets/grass.imageset/Contents.json new file mode 100644 index 0000000..6cb8919 --- /dev/null +++ b/grandfatherrock/Assets.xcassets/grass.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "Screen Shot 2020-09-13 at 6.28.42 PM.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Screen Shot 2020-09-13 at 6.28.42 PM-1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Screen Shot 2020-09-13 at 6.28.42 PM-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/grandfatherrock/Assets.xcassets/grass.imageset/Screen Shot 2020-09-13 at 6.28.42 PM-1.png b/grandfatherrock/Assets.xcassets/grass.imageset/Screen Shot 2020-09-13 at 6.28.42 PM-1.png new file mode 100644 index 0000000..99df79c Binary files /dev/null and b/grandfatherrock/Assets.xcassets/grass.imageset/Screen Shot 2020-09-13 at 6.28.42 PM-1.png differ diff --git a/grandfatherrock/Assets.xcassets/grass.imageset/Screen Shot 2020-09-13 at 6.28.42 PM-2.png b/grandfatherrock/Assets.xcassets/grass.imageset/Screen Shot 2020-09-13 at 6.28.42 PM-2.png new file mode 100644 index 0000000..99df79c Binary files /dev/null and b/grandfatherrock/Assets.xcassets/grass.imageset/Screen Shot 2020-09-13 at 6.28.42 PM-2.png differ diff --git a/grandfatherrock/Assets.xcassets/grass.imageset/Screen Shot 2020-09-13 at 6.28.42 PM.png b/grandfatherrock/Assets.xcassets/grass.imageset/Screen Shot 2020-09-13 at 6.28.42 PM.png new file mode 100644 index 0000000..99df79c Binary files /dev/null and b/grandfatherrock/Assets.xcassets/grass.imageset/Screen Shot 2020-09-13 at 6.28.42 PM.png differ diff --git a/grandfatherrock/Assets.xcassets/pause.imageset/Contents.json b/grandfatherrock/Assets.xcassets/pause.imageset/Contents.json new file mode 100644 index 0000000..f9710cc --- /dev/null +++ b/grandfatherrock/Assets.xcassets/pause.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "woodpause-2.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "woodpause-1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "woodpause.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/grandfatherrock/Assets.xcassets/pause.imageset/woodpause-1.png b/grandfatherrock/Assets.xcassets/pause.imageset/woodpause-1.png new file mode 100644 index 0000000..ecccb93 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/pause.imageset/woodpause-1.png differ diff --git a/grandfatherrock/Assets.xcassets/pause.imageset/woodpause-2.png b/grandfatherrock/Assets.xcassets/pause.imageset/woodpause-2.png new file mode 100644 index 0000000..ecccb93 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/pause.imageset/woodpause-2.png differ diff --git a/grandfatherrock/Assets.xcassets/pause.imageset/woodpause.png b/grandfatherrock/Assets.xcassets/pause.imageset/woodpause.png new file mode 100644 index 0000000..ecccb93 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/pause.imageset/woodpause.png differ diff --git a/grandfatherrock/Assets.xcassets/play.imageset/Contents.json b/grandfatherrock/Assets.xcassets/play.imageset/Contents.json new file mode 100644 index 0000000..0bb2db1 --- /dev/null +++ b/grandfatherrock/Assets.xcassets/play.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "woodplay-2.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "woodplay-1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "woodplay.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/grandfatherrock/Assets.xcassets/play.imageset/woodplay-1.png b/grandfatherrock/Assets.xcassets/play.imageset/woodplay-1.png new file mode 100644 index 0000000..09c0b54 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/play.imageset/woodplay-1.png differ diff --git a/grandfatherrock/Assets.xcassets/play.imageset/woodplay-2.png b/grandfatherrock/Assets.xcassets/play.imageset/woodplay-2.png new file mode 100644 index 0000000..09c0b54 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/play.imageset/woodplay-2.png differ diff --git a/grandfatherrock/Assets.xcassets/play.imageset/woodplay.png b/grandfatherrock/Assets.xcassets/play.imageset/woodplay.png new file mode 100644 index 0000000..09c0b54 Binary files /dev/null and b/grandfatherrock/Assets.xcassets/play.imageset/woodplay.png differ diff --git a/grandfatherrock/Base.lproj/LaunchScreen.storyboard b/grandfatherrock/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..e2ca5f6 --- /dev/null +++ b/grandfatherrock/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/grandfatherrock/Base.lproj/Main.storyboard b/grandfatherrock/Base.lproj/Main.storyboard new file mode 100644 index 0000000..117abdd --- /dev/null +++ b/grandfatherrock/Base.lproj/Main.storyboard @@ -0,0 +1,393 @@ + + + + + + + + + + + + + FinkHeavy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/grandfatherrock/FirstViewController.swift b/grandfatherrock/FirstViewController.swift new file mode 100644 index 0000000..2dde085 --- /dev/null +++ b/grandfatherrock/FirstViewController.swift @@ -0,0 +1,1405 @@ +// +// FirstViewController.swift +// grandfatherrock +// +// Created by Micah Gomez on 4/15/20. +// Copyright © 2020 Micah Gomez. All rights reserved. +// + +import UIKit +import AVFoundation +import MediaPlayer +import StoreKit +import SwiftyGif + +protocol ObjectSavable { + func setObject(_ object: Object, forKey: String) throws where Object: Encodable + func getObject(forKey: String, castTo type: Object.Type) throws -> Object where Object: Decodable +} +enum ObjectSavableError: String, LocalizedError { + case unableToEncode = "Unable to encode object into data" + case noValue = "No data object found for the given key" + case unableToDecode = "Unable to decode object into given type" + + var errorDescription: String? { + rawValue + } +} + +extension UserDefaults: ObjectSavable { + func setObject(_ object: Object, forKey: String) throws where Object: Encodable { + let encoder = JSONEncoder() + do { + let data = try encoder.encode(object) + set(data, forKey: forKey) + } catch { + throw ObjectSavableError.unableToEncode + } + } + + func getObject(forKey: String, castTo type: Object.Type) throws -> Object where Object: Decodable { + guard let data = data(forKey: forKey) else { throw ObjectSavableError.noValue } + let decoder = JSONDecoder() + do { + let object = try decoder.decode(type, from: data) + return object + } catch { + throw ObjectSavableError.unableToDecode + } + } +} + +public class musicHandler{ + @objc class func updateMusic(){ + + timer.invalidate() + + //print("updating song") + + GlobalVars.hour = Calendar.current.component(.hour, from: Date()) + + //song = GlobalVars.titleCode + hourPadding + String(GlobalVars.hour) + ////print(song) + let musicPlayer = MPMusicPlayerController.applicationMusicPlayer + + do{ + + var mediaPredicate = MPMediaPredicate() + switch GlobalVars.selectedMusicList { + case 0: + if(GlobalVars.musicSelectionID0[GlobalVars.hour] != 0){ + mediaPredicate = MPMediaPropertyPredicate(value: GlobalVars.musicSelectionID0[GlobalVars.hour], forProperty: "persistentID") + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID0[searchHour] + + //print(searchID) + } + //print("Song Found!") + mediaPredicate = MPMediaPropertyPredicate(value: GlobalVars.musicSelectionID0[searchHour], forProperty: "persistentID") + } + case 1: + if(GlobalVars.musicSelectionID1[GlobalVars.hour] != 0){ + mediaPredicate = MPMediaPropertyPredicate(value: GlobalVars.musicSelectionID1[GlobalVars.hour], forProperty: "persistentID") + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID1[searchHour] + + //print(searchID) + } + //print("Song Found!") + mediaPredicate = MPMediaPropertyPredicate(value: GlobalVars.musicSelectionID1[searchHour], forProperty: "persistentID") + } + case 2: + if(GlobalVars.musicSelectionID2[GlobalVars.hour] != 0){ + mediaPredicate = MPMediaPropertyPredicate(value: GlobalVars.musicSelectionID2[GlobalVars.hour], forProperty: "persistentID") + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID2[searchHour] + + //print(searchID) + } + //print("Song Found!") + mediaPredicate = MPMediaPropertyPredicate(value: GlobalVars.musicSelectionID2[searchHour], forProperty: "persistentID") + } + case 3: + if(GlobalVars.musicSelectionID3[GlobalVars.hour] != 0){ + mediaPredicate = MPMediaPropertyPredicate(value: GlobalVars.musicSelectionID3[GlobalVars.hour], forProperty: "persistentID") + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID3[searchHour] + + //print(searchID) + } + //print("Song Found!") + mediaPredicate = MPMediaPropertyPredicate(value: GlobalVars.musicSelectionID3[searchHour], forProperty: "persistentID") + } + case 4: + if(GlobalVars.musicSelectionID4[GlobalVars.hour] != 0){ + mediaPredicate = MPMediaPropertyPredicate(value: GlobalVars.musicSelectionID4[GlobalVars.hour], forProperty: "persistentID") + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID4[searchHour] + + //print(searchID) + } + //print("Song Found!") + mediaPredicate = MPMediaPropertyPredicate(value: GlobalVars.musicSelectionID4[searchHour], forProperty: "persistentID") + } + default: + if(GlobalVars.musicSelectionID0[GlobalVars.hour] != 0){ + mediaPredicate = MPMediaPropertyPredicate(value: GlobalVars.musicSelectionID0[GlobalVars.hour], forProperty: "persistentID") + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID0[searchHour] + + //print(searchID) + } + //print("Song Found!") + mediaPredicate = MPMediaPropertyPredicate(value: GlobalVars.musicSelectionID0[searchHour], forProperty: "persistentID") + } + } + + //let mediaPredicate = MPMediaPropertyPredicate(value: GlobalVars.musicSelectionID1[GlobalVars.hour], forProperty: "persistentID") + + let mediaQuery = MPMediaQuery() + + mediaQuery.addFilterPredicate(mediaPredicate) + + + //let mediaItemCollection: MPMediaItemCollection = MPMediaItemCollection() + + musicPlayer.setQueue(with: mediaQuery) + musicPlayer.repeatMode = .one + //print(mediaQuery) + //musicPlayer.play() + } + if(MPMusicPlayerController.applicationMusicPlayer.playbackState == MPMusicPlaybackState.playing){ + musicPlayer.play() + } + + if(Calendar.current.component(.minute, from: Date()) == 0){ + date = Date().addingTimeInterval(3600) + } else{ + let currentMinute = Calendar.current.component(.minute, from: Date()) + let currentSeconds = Calendar.current.component(.second, from: Date()) + let timeTillTopOfTheHour = 3600 - currentSeconds - (currentMinute * 60) + date = Date().addingTimeInterval(TimeInterval(timeTillTopOfTheHour)) + } + + //print(date) + + timer = Timer(fireAt: date, interval: 0, target: self, selector: #selector(updateMusic), userInfo: nil, repeats: false) + RunLoop.main.add(timer, forMode: RunLoop.Mode.common) + + } +} + +struct GlobalVars { + static var musicSelectionID0:[UInt64] = [UInt64]() + static var musicSelection0:[String] = [String]() + static var musicSelectionID1:[UInt64] = [UInt64]() + static var musicSelection1:[String] = [String]() + static var musicSelectionID2:[UInt64] = [UInt64]() + static var musicSelection2:[String] = [String]() + static var musicSelectionID3:[UInt64] = [UInt64]() + static var musicSelection3:[String] = [String]() + static var musicSelectionID4:[UInt64] = [UInt64]() + static var musicSelection4:[String] = [String]() + static var selectedMusicList:Int = 0 + static var musicStarted = false + static var titleName = UserDefaults.standard.string(forKey: "selectedTitle") + static var hour = Calendar.current.component(.hour, from: Date()) +} + +var i = 0 + +var date = Date() +var timer = Timer() +let currentSeconds = Calendar.current.component(.second, from: Date()) +let currentMinute = Calendar.current.component(.minute, from: Date()) +let timeTillTopOfTheHour = 3600 - currentSeconds - (currentMinute * 60) +var hourPadding = "" +var prevVol = 0.0 + +class FirstViewController: UIViewController{ + + let defaults = UserDefaults.standard + let musicPlayer = MPMusicPlayerController.applicationMusicPlayer + + //@IBOutlet weak var dateLabel: UILabel! + @IBOutlet weak var timeLabel: UILabel! + @IBOutlet weak var songLabel: UILabel! + + var labelTimer = Timer() + + @objc func tick() { + //dateLabel.text = DateFormatter.localizedString(from: Date(), dateStyle: .long, timeStyle: .none) + timeLabel.text = DateFormatter.localizedString(from: Date(), dateStyle: .none, timeStyle: .short) + var nowPlayingString:String = "Now Playing: " + if (MPMusicPlayerController.applicationMusicPlayer.playbackState == MPMusicPlaybackState.playing) { + switch GlobalVars.selectedMusicList { + case 0: + if GlobalVars.musicSelectionID0[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection0[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID0[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection0[searchHour]) + } + case 1: + if GlobalVars.musicSelectionID1[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection1[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID1[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection1[searchHour]) + } + case 2: + if GlobalVars.musicSelectionID2[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection2[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID2[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection2[searchHour]) + } + case 3: + if GlobalVars.musicSelectionID3[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection3[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID3[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection3[searchHour]) + } + case 4: + if GlobalVars.musicSelectionID4[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection4[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID4[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection4[searchHour]) + } + default: + if GlobalVars.musicSelectionID0[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection0[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID0[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection0[searchHour]) + } + } + songLabel.text = nowPlayingString + } else { + songLabel.text = "" + } + + } + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view. + + musicPlayer.stop() + GlobalVars.musicStarted = false + IAPHandler.shared.fetchAvailableProducts() + + IAPHandler.shared.purchaseStatusBlock = {[weak self] (type) in + guard let strongSelf = self else{ return } + if type == .purchased { + let alertView = UIAlertController(title: "", message: type.message(), preferredStyle: .alert) + let action = UIAlertAction(title: "OK", style: .default, handler: { (alert) in + + }) + alertView.addAction(action) + strongSelf.present(alertView, animated: true, completion: nil) + } + } + + if(!defaults.bool(forKey: "didRun")){ + defaults.set("New Horizons", forKey: "selectedTitle") + defaults.set(0, forKey: "titleNo") + //defaults.set(true, forKey: "didRun") + GlobalVars.musicSelectionID0 = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + GlobalVars.musicSelection0 = ["","","","","","","","","","","","","","","","","","","","","","","",""] + GlobalVars.musicSelectionID1 = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + GlobalVars.musicSelection1 = ["","","","","","","","","","","","","","","","","","","","","","","",""] + GlobalVars.musicSelectionID2 = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + GlobalVars.musicSelection2 = ["","","","","","","","","","","","","","","","","","","","","","","",""] + GlobalVars.musicSelectionID3 = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + GlobalVars.musicSelection3 = ["","","","","","","","","","","","","","","","","","","","","","","",""] + GlobalVars.musicSelectionID4 = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + GlobalVars.musicSelection4 = ["","","","","","","","","","","","","","","","","","","","","","","",""] + do { + try defaults.setObject(GlobalVars.musicSelection0, forKey: "savedMusicSelection0") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelectionID0, forKey: "savedMusicSelectionID0") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelection1, forKey: "savedMusicSelection1") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelectionID1, forKey: "savedMusicSelectionID1") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelection2, forKey: "savedMusicSelection2") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelectionID2, forKey: "savedMusicSelectionID2") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelection3, forKey: "savedMusicSelection3") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelectionID3, forKey: "savedMusicSelectionID3") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelection4, forKey: "savedMusicSelection4") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelectionID4, forKey: "savedMusicSelectionID4") + } catch { + //print(error.localizedDescription) + } + //print("First App run") + } else { + do { + GlobalVars.musicSelection0 = try defaults.getObject(forKey: "savedMusicSelection0", castTo: [String].self) + //print(GlobalVars.musicSelection0) + } catch { + //print(error.localizedDescription) + } + do { + GlobalVars.musicSelectionID0 = try defaults.getObject(forKey: "savedMusicSelectionID0", castTo: [UInt64].self) + //print(GlobalVars.musicSelectionID0) + } catch { + //print(error.localizedDescription) + } + do { + GlobalVars.musicSelection1 = try defaults.getObject(forKey: "savedMusicSelection1", castTo: [String].self) + //print(GlobalVars.musicSelection1) + } catch { + //print(error.localizedDescription) + } + do { + GlobalVars.musicSelectionID1 = try defaults.getObject(forKey: "savedMusicSelectionID1", castTo: [UInt64].self) + //print(GlobalVars.musicSelectionID1) + } catch { + //print(error.localizedDescription) + } + do { + GlobalVars.musicSelection2 = try defaults.getObject(forKey: "savedMusicSelection2", castTo: [String].self) + //print(GlobalVars.musicSelection2) + } catch { + //print(error.localizedDescription) + } + do { + GlobalVars.musicSelectionID2 = try defaults.getObject(forKey: "savedMusicSelectionID2", castTo: [UInt64].self) + //print(GlobalVars.musicSelectionID2) + } catch { + //print(error.localizedDescription) + } + do { + GlobalVars.musicSelection3 = try defaults.getObject(forKey: "savedMusicSelection3", castTo: [String].self) + //print(GlobalVars.musicSelection3) + } catch { + //print(error.localizedDescription) + } + do { + GlobalVars.musicSelectionID3 = try defaults.getObject(forKey: "savedMusicSelectionID3", castTo: [UInt64].self) + //print(GlobalVars.musicSelectionID3) + } catch { + //print(error.localizedDescription) + } + do { + GlobalVars.musicSelection4 = try defaults.getObject(forKey: "savedMusicSelection4", castTo: [String].self) + //print(GlobalVars.musicSelection4) + } catch { + //print(error.localizedDescription) + } + do { + GlobalVars.musicSelectionID4 = try defaults.getObject(forKey: "savedMusicSelectionID4", castTo: [UInt64].self) + //print(GlobalVars.musicSelectionID4) + } catch { + //print(error.localizedDescription) + } + + do { + GlobalVars.selectedMusicList = try defaults.getObject(forKey: "savedSelectedMusicList", castTo: Int.self) + //print(GlobalVars.selectedMusicList) + } catch { + //print(error.localizedDescription) + } + //print("App Ran Before") + } + + //print(currentSeconds) + //print(currentMinute) + + //print(timeTillTopOfTheHour) + + ////print(GlobalVars.selectedSong) + + GlobalVars.hour = Calendar.current.component(.hour, from: Date()) + date = Date().addingTimeInterval(TimeInterval(timeTillTopOfTheHour)) + //print(date) + timer = Timer(fireAt: date, interval: 0, target: musicHandler.self, selector: #selector(musicHandler.updateMusic), userInfo: nil, repeats: false) + RunLoop.main.add(timer, forMode: .common) + + //dateLabel.text = DateFormatter.localizedString(from: Date(), dateStyle: .long, timeStyle: .none) + timeLabel.text = DateFormatter.localizedString(from: Date(), dateStyle: .none, timeStyle: .short) + labelTimer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector:#selector(self.tick) , userInfo: nil, repeats: true) + + if((GlobalVars.hour >= 8) && (GlobalVars.hour <= 19)){ //Daytime + do{ + let gif = try UIImage(gifName: "day.gif") + sceneryImageView.setGifImage(gif, loopCount: -1) + }catch{print(error)} + } else if((GlobalVars.hour >= 20) && (GlobalVars.hour <= 21)){//Sunset + //print("sunset") + do{ + let gif = try UIImage(gifName: "day.gif") + sceneryImageView.setGifImage(gif, loopCount: -1) + }catch{print(error)} + } else if((GlobalVars.hour >= 22) || (GlobalVars.hour <= 5)){//Night + //print("night") + do{ + let gif = try UIImage(gifName: "night.gif") + sceneryImageView.setGifImage(gif, loopCount: -1) + }catch{print(error)} + } else if((GlobalVars.hour >= 6) && (GlobalVars.hour <= 7)){//Sunrise + //print("sunrise") + do{ + let gif = try UIImage(gifName: "day.gif") + sceneryImageView.setGifImage(gif, loopCount: -1) + }catch{print(error)} + } + + /*do{ + + audioPlayer = try AVAudioPlayer(contentsOf: URL.init(fileURLWithPath: Bundle.main.path(forResource: song, ofType: "mp3")!)) + audioPlayer.prepareToPlay() + audioPlayer.numberOfLoops = -1 + + let audioSession = AVAudioSession.sharedInstance() + do{ + try audioSession.setCategory(.playback, mode: .default) + try audioSession.setActive(true) + } + + + } + catch{ + //print(error) + }*/ + + } + + @IBOutlet var sceneryImageView: UIImageView! + + @IBOutlet var gradientView: UIView! + + override func viewDidAppear(_ animated: Bool) { + + //print("fuck!") + let prevHour = GlobalVars.hour + GlobalVars.hour = Calendar.current.component(.hour, from: Date()) + if GlobalVars.hour != prevHour { + musicHandler.updateMusic() + } + + if (!defaults.bool(forKey: "didRun")){ + let fuckAlert = UIAlertController(title: "Welcome!", message: "Please visit the 'Select Music' tab to set your hourly playlist, and come back here and hit play once it's ready!", preferredStyle: .alert) + + // Create OK button + let OKAction = UIAlertAction(title: "OK", style: .default) { (action:UIAlertAction!) in + + let helpAlert = UIAlertController(title: "Need Help Importing Music?", message: "A tutorial is available to help with importing music to use with this app. Would you like to view it?", preferredStyle: .alert) + + // Create OK button + let HelpAction = UIAlertAction(title: "Yes Please!", style: .default) { (action:UIAlertAction!) in + if let url = URL(string: "https://youtu.be/YtOC5YFCt7E") { + UIApplication.shared.open(url) + } + } + helpAlert.addAction(HelpAction) + let NoHelpAction = UIAlertAction(title: "No Thanks", style: .default) { (action:UIAlertAction!) in + //print("Ok button tapped"); + } + helpAlert.addAction(NoHelpAction) + + // Present Dialog message + self.present(helpAlert, animated: true, completion:nil) + + } + fuckAlert.addAction(OKAction) + + // Present Dialog message + self.present(fuckAlert, animated: true, completion:nil) + + defaults.set(true, forKey: "didRun") + + } + + if (MPMusicPlayerController.applicationMusicPlayer.playbackState == MPMusicPlaybackState.playing) { + GlobalVars.musicStarted = true + controlButton.setBackgroundImage(UIImage(systemName: "pause.circle"), for: UIControl.State.normal) + UIView.animate(withDuration: 0.4, delay: 0,usingSpringWithDamping: 0.5,initialSpringVelocity: 0){ + self.PlayButtonSize.constant = 130 + } + } else { + GlobalVars.musicStarted = false + controlButton.setBackgroundImage(UIImage(systemName: "play.circle"), for: UIControl.State.normal) + UIView.animate(withDuration: 0.4, delay: 0,usingSpringWithDamping: 0.5,initialSpringVelocity: 0){ + self.PlayButtonSize.constant = 90 + } + } + + var foundSong = false + switch GlobalVars.selectedMusicList { + case 0: + for i in GlobalVars.musicSelectionID0 { + if (i != 0){ + foundSong = true + } + } + case 1: + for i in GlobalVars.musicSelectionID1 { + if (i != 0){ + foundSong = true + } + } + case 2: + for i in GlobalVars.musicSelectionID2 { + if (i != 0){ + foundSong = true + } + } + case 3: + for i in GlobalVars.musicSelectionID3 { + if (i != 0){ + foundSong = true + } + } + case 4: + for i in GlobalVars.musicSelectionID4 { + if (i != 0){ + foundSong = true + } + } + default: + for i in GlobalVars.musicSelectionID0 { + if (i != 0){ + foundSong = true + } + } + } + + if !foundSong && defaults.bool(forKey: "didRun") { + let errorAlert = UIAlertController(title: "Song Error", message: "No songs found in this track. Please visit the 'Select Music' tab to set a song and get started!", preferredStyle: .alert) + + // Create OK button + let OKAction = UIAlertAction(title: "OK", style: .default) { (action:UIAlertAction!) in + + let helpAlert = UIAlertController(title: "Need Help Importing Music?", message: "A tutorial is available to help with importing music to use with this app. Would you like to view it?", preferredStyle: .alert) + + // Create OK button + let HelpAction = UIAlertAction(title: "Yes Please!", style: .default) { (action:UIAlertAction!) in + if let url = URL(string: "https://youtu.be/YtOC5YFCt7E") { + UIApplication.shared.open(url) + } + } + helpAlert.addAction(HelpAction) + let NoHelpAction = UIAlertAction(title: "No Thanks", style: .default) { (action:UIAlertAction!) in + //print("Ok button tapped"); + } + helpAlert.addAction(NoHelpAction) + + // Present Dialog message + self.present(helpAlert, animated: true, completion:nil) + + } + errorAlert.addAction(OKAction) + + // Present Dialog message + self.present(errorAlert, animated: true, completion:nil) + //print("Song is missing for at one hour") + controlButton.isEnabled = false + } else { + controlButton.isEnabled = true + } + self.view.layoutIfNeeded() + + var nowPlayingString:String = "Now Playing: " + if (MPMusicPlayerController.applicationMusicPlayer.playbackState == MPMusicPlaybackState.playing) { + switch GlobalVars.selectedMusicList { + case 0: + if GlobalVars.musicSelectionID0[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection0[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID0[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection0[searchHour]) + } + case 1: + if GlobalVars.musicSelectionID1[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection1[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID1[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection1[searchHour]) + } + case 2: + if GlobalVars.musicSelectionID2[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection2[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID2[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection2[searchHour]) + } + case 3: + if GlobalVars.musicSelectionID3[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection3[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID3[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection3[searchHour]) + } + case 4: + if GlobalVars.musicSelectionID4[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection4[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID4[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection4[searchHour]) + } + default: + if GlobalVars.musicSelectionID0[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection0[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID0[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection0[searchHour]) + } + } + songLabel.text = nowPlayingString + } else { + songLabel.text = "" + } + } + + override func viewWillAppear(_ animated: Bool) { + + // create the gradient layer + let gradient = CAGradientLayer() + gradient.frame = self.view.bounds + //print("time: ", GlobalVars.hour) + if((GlobalVars.hour >= 8) && (GlobalVars.hour <= 19)){ //Daytime + //print("day") + do{ + let gif = try UIImage(gifName: "day.gif") + sceneryImageView.setGifImage(gif, loopCount: -1) + }catch{print(error)} + //sceneryImageView.image = UIImage(named: "ACBackgroundDay", in: Bundle(for: type(of: self)), compatibleWith: nil) + gradient.colors = [UIColor(red: 0.39, green: 0.69, blue: 1.00, alpha: 1).cgColor, UIColor(red: 0.07, green: 0.45, blue: 0.87, alpha: 1).cgColor] + } else if((GlobalVars.hour >= 20) && (GlobalVars.hour <= 21)){//Sunset + //print("sunset") + do{ + let gif = try UIImage(gifName: "day.gif") + sceneryImageView.setGifImage(gif, loopCount: -1) + }catch{print(error)} + //sceneryImageView.image = UIImage(named: "ACBackgroundDay", in: Bundle(for: type(of: self)), compatibleWith: nil) + gradient.colors = [UIColor(red: 0.00, green: 0.31, blue: 0.59, alpha: 1).cgColor, UIColor(red: 1.00, green: 0.78, blue: 0.88, alpha: 1).cgColor] + } else if((GlobalVars.hour >= 22) || (GlobalVars.hour <= 5)){//Night + //print("night") + do{ + let gif = try UIImage(gifName: "night.gif") + sceneryImageView.setGifImage(gif, loopCount: -1) + }catch{print(error)} + //sceneryImageView.image = UIImage(named: "ACBackgroundNight", in: Bundle(for: type(of: self)), compatibleWith: nil) + gradient.colors = [UIColor(red: 0.08, green: 0.27, blue: 0.59, alpha: 1).cgColor, UIColor(red: 0.00, green: 0.20, blue: 0.29, alpha: 1).cgColor] + } else if((GlobalVars.hour >= 6) && (GlobalVars.hour <= 7)){//Sunrise + //print("sunrise") + do{ + let gif = try UIImage(gifName: "day.gif") + sceneryImageView.setGifImage(gif, loopCount: -1) + }catch{print(error)} + //sceneryImageView.image = UIImage(named: "ACBackgroundDay", in: Bundle(for: type(of: self)), compatibleWith: nil) + gradient.colors = [UIColor(red: 0.02, green: 0.26, blue: 0.49, alpha: 1).cgColor, UIColor(red: 0.89, green: 0.68, blue: 0.60, alpha: 1).cgColor] + } + + gradient.locations = [0.00, 1.00] + + /*let gradientChangeAnimation = CABasicAnimation(keyPath: "colors") + gradientChangeAnimation.duration = 5.0 + if((GlobalVars.hour >= 8) && (GlobalVars.hour <= 19)){ //Daytime + //print("day") + gradientChangeAnimation.toValue = [UIColor(red: 0.00, green: 0.31, blue: 0.59, alpha: 1).cgColor, UIColor(red: 0.07, green: 0.45, blue: 0.87, alpha: 1).cgColor] + } else if((GlobalVars.hour >= 20) && (GlobalVars.hour <= 21)){//Sunset + //print("sunset") + gradientChangeAnimation.toValue = [UIColor(red: 0.00, green: 0.31, blue: 0.59, alpha: 1).cgColor, UIColor(red: 1.00, green: 0.61, blue: 0.43, alpha: 1).cgColor] + } else if((GlobalVars.hour >= 22) || (GlobalVars.hour <= 5)){//Night + //print("night") + gradientChangeAnimation.toValue = [ + UIColor(red: 0.68, green: 0.67, blue: 1.0, alpha: 1).cgColor, + UIColor(red: 1.00, green: 0.00, blue: 0.09, alpha: 1).cgColor + ] + } else if((GlobalVars.hour >= 6) && (GlobalVars.hour <= 7)){//Sunrise + //print("sunrise") + gradientChangeAnimation.toValue = [UIColor(red: 0.02, green: 0.26, blue: 0.49, alpha: 1).cgColor, UIColor(red: 0.89, green: 0.68, blue: 0.60, alpha: 1).cgColor] + } + gradientChangeAnimation.autoreverses = true + gradientChangeAnimation.fillMode = CAMediaTimingFillMode.forwards + gradientChangeAnimation.isRemovedOnCompletion = false + gradient.add(gradientChangeAnimation, forKey: "colorChange") + */ + // add the gradient to the view + gradientView.layer.addSublayer(gradient) + + + } + + override func viewWillDisappear(_ animated: Bool) { + gradientView.layer.sublayers?.forEach { $0.removeFromSuperlayer() } + do { + try defaults.setObject(GlobalVars.musicSelection0, forKey: "savedMusicSelection0") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelectionID0, forKey: "savedMusicSelectionID0") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelection1, forKey: "savedMusicSelection1") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelectionID1, forKey: "savedMusicSelectionID1") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelection2, forKey: "savedMusicSelection2") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelectionID2, forKey: "savedMusicSelectionID2") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelection3, forKey: "savedMusicSelection3") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelectionID3, forKey: "savedMusicSelectionID3") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelection4, forKey: "savedMusicSelection4") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelectionID4, forKey: "savedMusicSelectionID4") + } catch { + //print(error.localizedDescription) + } + } + + @IBOutlet weak var controlButton: UIButton! + + @IBOutlet var PlayButtonSize: NSLayoutConstraint! + + + @IBAction func play(_ sender: Any) { + if(!GlobalVars.musicStarted){ + + + GlobalVars.musicStarted = true + musicHandler.updateMusic() + let musicPlayer = MPMusicPlayerController.applicationMusicPlayer + musicPlayer.play() + GlobalVars.musicStarted = true + controlButton.setBackgroundImage(UIImage(systemName: "pause.circle"), for: UIControl.State.normal) + UIView.animate(withDuration: 0.4,delay:0,usingSpringWithDamping: 0.5,initialSpringVelocity: 0){ + self.PlayButtonSize.constant = 130 + self.view.layoutIfNeeded() + } + } + else{ + let musicPlayer = MPMusicPlayerController.applicationMusicPlayer + musicPlayer.pause() + GlobalVars.musicStarted = false + controlButton.setBackgroundImage(UIImage(systemName: "play.circle"), for: UIControl.State.normal) + UIView.animate(withDuration: 0.4, delay: 0,usingSpringWithDamping: 0.5,initialSpringVelocity: 0){ + self.PlayButtonSize.constant = 90 + self.view.layoutIfNeeded() + } + } + var nowPlayingString:String = "Now Playing: " + if (MPMusicPlayerController.applicationMusicPlayer.playbackState == MPMusicPlaybackState.playing) { + switch GlobalVars.selectedMusicList { + case 0: + if GlobalVars.musicSelectionID0[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection0[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID0[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection0[searchHour]) + } + case 1: + if GlobalVars.musicSelectionID1[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection1[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID1[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection1[searchHour]) + } + case 2: + if GlobalVars.musicSelectionID2[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection2[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID2[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection2[searchHour]) + } + case 3: + if GlobalVars.musicSelectionID3[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection3[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID3[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection3[searchHour]) + } + case 4: + if GlobalVars.musicSelectionID4[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection4[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID4[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection4[searchHour]) + } + default: + if GlobalVars.musicSelectionID0[GlobalVars.hour] != 0 { + nowPlayingString.append(GlobalVars.musicSelection0[GlobalVars.hour]) + } else { + var searchID:UInt64 = 0 + var searchHour:Int = GlobalVars.hour + while (searchID == 0) { + if(searchHour > 0){ + searchHour -= 1 + } else { + searchHour = 23 + } + if(searchHour == GlobalVars.hour){ + //print("no songs found!") + break + } + //print("searching ", searchHour) + searchID = GlobalVars.musicSelectionID0[searchHour] + + //print(searchID) + } + nowPlayingString.append(GlobalVars.musicSelection0[searchHour]) + } + } + songLabel.text = nowPlayingString + } else { + songLabel.text = "" + } + } + + /*@objc func updateMusic(){ + + //timer.invalidate() + + prevVol = Double(audioPlayer.volume) + audioPlayer.setVolume(0, fadeDuration: 3) + //print("updating song") + + hour = Calendar.current.component(.hour, from: date) + if(hour<10){ + hourPadding = "0" + } + else{ + hourPadding = "" + } + + song = "acnh" + hourPadding + String(hour) + //print(song) + + do{ + + audioPlayer = try AVAudioPlayer(contentsOf: URL.init(fileURLWithPath: Bundle.main.path(forResource: song, ofType: "mp3")!)) + audioPlayer.prepareToPlay() + audioPlayer.numberOfLoops = -1 + + let audioSession = AVAudioSession.sharedInstance() + do{ + try audioSession.setCategory(.playback, mode: .default) + try audioSession.setActive(true) + } + + + } + catch{ + //print(error) + } + if(GlobalVars.musicStarted){ + audioPlayer.play() + } + audioPlayer.setVolume(Float(prevVol), fadeDuration: 1) + date = date.addingTimeInterval(3600) + //print(date) + timer = Timer(fireAt: date, interval: 0, target: self, selector: #selector(updateMusic), userInfo: nil, repeats: false) + RunLoop.main.add(timer, forMode: RunLoop.Mode.common) + + }*/ + + + +} + +enum IAPHandlerAlertType{ + case disabled + case restored + case purchased + + func message() -> String{ + switch self { + case .disabled: return "Purchases are disabled in your device!" + case .restored: return "You've successfully restored your purchase!" + case .purchased: return "You've successfully bought this purchase!" + } + } +} + +class IAPHandler: NSObject { + static let shared = IAPHandler() + + let SMALL_TIP_PRODUCT_ID = "smalltip" + let MEDIUM_TIP_PRODUCT_ID = "mediumtip" + let LARGE_TIP_PRODUCT_ID = "largetip" + + fileprivate var productID = "" + fileprivate var productsRequest = SKProductsRequest() + fileprivate var iapProducts = [SKProduct]() + + var purchaseStatusBlock: ((IAPHandlerAlertType) -> Void)? + + // MARK: - MAKE PURCHASE OF A PRODUCT + func canMakePurchases() -> Bool { return SKPaymentQueue.canMakePayments() } + + func purchaseMyProduct(index: Int){ + if iapProducts.count == 0 { return } + + if self.canMakePurchases() { + let product = iapProducts[index] + let payment = SKPayment(product: product) + SKPaymentQueue.default().add(self) + SKPaymentQueue.default().add(payment) + + //print("PRODUCT TO PURCHASE: \(product.productIdentifier)") + productID = product.productIdentifier + } else { + purchaseStatusBlock?(.disabled) + } + } + + // MARK: - RESTORE PURCHASE + func restorePurchase(){ + SKPaymentQueue.default().add(self) + SKPaymentQueue.default().restoreCompletedTransactions() + } + + + // MARK: - FETCH AVAILABLE IAP PRODUCTS + func fetchAvailableProducts(){ + + // Put here your IAP Products ID's + let productIdentifiers = NSSet(objects: SMALL_TIP_PRODUCT_ID,MEDIUM_TIP_PRODUCT_ID,LARGE_TIP_PRODUCT_ID + ) + + productsRequest = SKProductsRequest(productIdentifiers: productIdentifiers as! Set) + productsRequest.delegate = self + productsRequest.start() + } +} + +extension IAPHandler: SKProductsRequestDelegate, SKPaymentTransactionObserver{ + // MARK: - REQUEST IAP PRODUCTS + func productsRequest (_ request:SKProductsRequest, didReceive response:SKProductsResponse) { + + if (response.products.count > 0) { + iapProducts = response.products + for product in iapProducts{ + let numberFormatter = NumberFormatter() + numberFormatter.formatterBehavior = .behavior10_4 + numberFormatter.numberStyle = .currency + numberFormatter.locale = product.priceLocale + let price1Str = numberFormatter.string(from: product.price) + //print(product.localizedDescription + "\nfor just \(price1Str!)") + } + } + } + + func paymentQueueRestoreCompletedTransactionsFinished(_ queue: SKPaymentQueue) { + purchaseStatusBlock?(.restored) + } + + // MARK:- IAP PAYMENT QUEUE + func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) { + for transaction:AnyObject in transactions { + if let trans = transaction as? SKPaymentTransaction { + switch trans.transactionState { + case .purchased: + //print("purchased") + SKPaymentQueue.default().finishTransaction(transaction as! SKPaymentTransaction) + purchaseStatusBlock?(.purchased) + break + + case .failed: + //print("failed") + SKPaymentQueue.default().finishTransaction(transaction as! SKPaymentTransaction) + break + case .restored: + //print("restored") + SKPaymentQueue.default().finishTransaction(transaction as! SKPaymentTransaction) + break + + default: break + }}} + } +} diff --git a/grandfatherrock/Info.plist b/grandfatherrock/Info.plist new file mode 100644 index 0000000..249e0ee --- /dev/null +++ b/grandfatherrock/Info.plist @@ -0,0 +1,86 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + AC Tape Deck + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + $(MARKETING_VERSION) + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + LSApplicationCategoryType + public.app-category.music + LSRequiresIPhoneOS + + NSAppleMusicUsageDescription + To select songs for each hour + UIAppFonts + + FinkHeavyttf + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + Main + + + + + UIBackgroundModes + + audio + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UIStatusBarTintParameters + + UINavigationBar + + Style + UIBarStyleDefault + Translucent + + + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/grandfatherrock/SceneDelegate.swift b/grandfatherrock/SceneDelegate.swift new file mode 100644 index 0000000..edf55cc --- /dev/null +++ b/grandfatherrock/SceneDelegate.swift @@ -0,0 +1,53 @@ +// +// SceneDelegate.swift +// grandfatherrock +// +// Created by Micah Gomez on 4/15/20. +// Copyright © 2020 Micah Gomez. All rights reserved. +// + +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). + guard let _ = (scene as? UIWindowScene) else { return } + } + + func sceneDidDisconnect(_ scene: UIScene) { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). + } + + func sceneDidBecomeActive(_ scene: UIScene) { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. + } + + func sceneWillResignActive(_ scene: UIScene) { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). + } + + func sceneWillEnterForeground(_ scene: UIScene) { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. + } + + func sceneDidEnterBackground(_ scene: UIScene) { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. + } + + +} + diff --git a/grandfatherrock/SecondViewController.swift b/grandfatherrock/SecondViewController.swift new file mode 100644 index 0000000..7239a72 --- /dev/null +++ b/grandfatherrock/SecondViewController.swift @@ -0,0 +1,485 @@ +// +// SecondViewController.swift +// grandfatherrock +// +// Created by Micah Gomez on 4/15/20. +// Copyright © 2020 Micah Gomez. All rights reserved. +// + +import UIKit +import MediaPlayer + +class hourDataCell : UITableViewCell { + + @IBOutlet weak var hourLabel: UILabel! + @IBOutlet weak var songLabel : UILabel! + +} + +class SecondViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, MPMediaPickerControllerDelegate { + + var selectedSong: String = "" + var tableHour: Int = 0 + let mediaPicker = MPMediaPickerController(mediaTypes: MPMediaType.music) + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return 24 + } + + func tableView(_ tableView: UITableView, + accessoryButtonTappedForRowWith indexPath: IndexPath){ + let errorAlert = UIAlertController(title: "Song Error", message: "This song doesn't seem to be available. Please make sure that you've properly selected a song and that it is in your music library.", preferredStyle: .alert) + + // Create OK button + let OKAction = UIAlertAction(title: "OK", style: .default) { (action:UIAlertAction!) in + + let helpAlert = UIAlertController(title: "Need Help Importing Music?", message: "A tutorial is available to help with importing music to use with this app. Would you like to view it?", preferredStyle: .alert) + + // Create OK button + let HelpAction = UIAlertAction(title: "Yes Please!", style: .default) { (action:UIAlertAction!) in + if let url = URL(string: "https://youtu.be/YtOC5YFCt7E") { + UIApplication.shared.open(url) + } + } + helpAlert.addAction(HelpAction) + let NoHelpAction = UIAlertAction(title: "No Thanks", style: .default) { (action:UIAlertAction!) in + //print("Ok button tapped"); + } + helpAlert.addAction(NoHelpAction) + + // Present Dialog message + self.present(helpAlert, animated: true, completion:nil) + + } + errorAlert.addAction(OKAction) + + // Present Dialog message + self.present(errorAlert, animated: true, completion:nil) + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "hourcell", for: indexPath) as! hourDataCell + + var rowHour:Int = 12 + var hourString = String(rowHour) + hourString.append(" AM") + + if (indexPath.row < 12) && (indexPath.row > 0) { + rowHour = indexPath.row + hourString = String(rowHour) + hourString.append(" AM") + } else if (indexPath.row > 11) { + rowHour = indexPath.row + if (indexPath.row > 12){ + rowHour = rowHour - 12 + } + hourString = String(rowHour) + hourString.append(" PM") + } + + cell.hourLabel?.text = hourString + + switch GlobalVars.selectedMusicList { + case 0: + cell.songLabel?.text = GlobalVars.musicSelection0[indexPath.row] + if (GlobalVars.musicSelectionID0[indexPath.row] == 0){ + cell.accessoryType = .detailButton + } else { + cell.accessoryType = .none + } + case 1: + cell.songLabel?.text = GlobalVars.musicSelection1[indexPath.row] + if (GlobalVars.musicSelectionID1[indexPath.row] == 0){ + cell.accessoryType = .detailButton + } else { + cell.accessoryType = .none + } + case 2: + cell.songLabel?.text = GlobalVars.musicSelection2[indexPath.row] + if (GlobalVars.musicSelectionID2[indexPath.row] == 0){ + cell.accessoryType = .detailButton + } else { + cell.accessoryType = .none + } + case 3: + cell.songLabel?.text = GlobalVars.musicSelection3[indexPath.row] + if (GlobalVars.musicSelectionID3[indexPath.row] == 0){ + cell.accessoryType = .detailButton + } else { + cell.accessoryType = .none + } + case 4: + cell.songLabel?.text = GlobalVars.musicSelection4[indexPath.row] + if (GlobalVars.musicSelectionID4[indexPath.row] == 0){ + cell.accessoryType = .detailButton + } else { + cell.accessoryType = .none + } + default: + cell.songLabel?.text = "uh oh!" + cell.accessoryType = .detailButton + } + + return cell + } + + func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool + { + return true + } + + func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath){ + if editingStyle == .delete + { + switch GlobalVars.selectedMusicList { + case 0: + GlobalVars.musicSelection0[indexPath.row] = "" + GlobalVars.musicSelectionID0[indexPath.row] = 0 + case 1: + GlobalVars.musicSelection1[indexPath.row] = "" + GlobalVars.musicSelectionID1[indexPath.row] = 0 + case 2: + GlobalVars.musicSelection2[indexPath.row] = "" + GlobalVars.musicSelectionID2[indexPath.row] = 0 + case 3: + GlobalVars.musicSelection3[indexPath.row] = "" + GlobalVars.musicSelectionID3[indexPath.row] = 0 + case 4: + GlobalVars.musicSelection4[indexPath.row] = "" + GlobalVars.musicSelectionID4[indexPath.row] = 0 + default: + GlobalVars.musicSelection0[indexPath.row] = "" + GlobalVars.musicSelectionID0[indexPath.row] = 0 + } + + hoursTable.reloadData() + + if ((MPMusicPlayerController.applicationMusicPlayer.playbackState == MPMusicPlaybackState.playing) && (tableHour == GlobalVars.hour)){ + musicHandler.updateMusic() + } + } + } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath){ + + //let mediaPicker = MPMediaPickerController(mediaTypes: MPMediaType.music) + tableHour = indexPath.row + //print(tableHour) + present(mediaPicker, animated: true, completion: nil) + /*if (selectedSong != "") { + GlobalVars.musicSelection[indexPath.row] = selectedSong + selectedSong = "" + } + self.hoursTable.reloadData()*/ + } + + + let defaults = UserDefaults.standard + + + /*func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { + + return type.count + } + func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { + return type[row] + } + func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { + //print(type[row]) + //print(row) + defaults.set(type[row], forKey: "selectedTitle") + defaults.set(row, forKey: "titleNo") + GlobalVars.selectedGame = type[row] + GlobalVars.selectedGameNo = row + GlobalVars.titleName = type[row] + musicHandler.updateMusic() + nowPlaying.text = GlobalVars.titleName! + " - " + String(GlobalVars.hour) + } + func numberOfComponents(in pickerView: UIPickerView) -> Int { + return 1 + }*/ + + func mediaPicker(_ mediaPicker: MPMediaPickerController, didPickMediaItems mediaItemCollection: MPMediaItemCollection){ + //let musicPlayer = MPMusicPlayerController.applicationMusicPlayer + + //musicPlayer.setQueue(with: mediaItemCollection) + ////print(mediaItemCollection) + //musicPlayer.play() + //print("selected song") + selectedSong = String(mediaItemCollection.items[0].title ?? "NOTHING") + //print(selectedSong) + + //print(GlobalVars.selectedMusicList) + switch GlobalVars.selectedMusicList { + case 0: + GlobalVars.musicSelectionID0[tableHour] = mediaItemCollection.items[0].persistentID + GlobalVars.musicSelection0[tableHour] = selectedSong + case 1: + GlobalVars.musicSelectionID1[tableHour] = mediaItemCollection.items[0].persistentID + GlobalVars.musicSelection1[tableHour] = selectedSong + case 2: + GlobalVars.musicSelectionID2[tableHour] = mediaItemCollection.items[0].persistentID + GlobalVars.musicSelection2[tableHour] = selectedSong + case 3: + GlobalVars.musicSelectionID3[tableHour] = mediaItemCollection.items[0].persistentID + GlobalVars.musicSelection3[tableHour] = selectedSong + case 4: + GlobalVars.musicSelectionID4[tableHour] = mediaItemCollection.items[0].persistentID + GlobalVars.musicSelection4[tableHour] = selectedSong + default: + GlobalVars.musicSelectionID0[tableHour] = mediaItemCollection.items[0].persistentID + GlobalVars.musicSelection0[tableHour] = selectedSong + } + + //GlobalVars.musicSelectionID1[tableHour] = mediaItemCollection.items[0].persistentID + //GlobalVars.musicSelection1[tableHour] = selectedSong + + if ((MPMusicPlayerController.applicationMusicPlayer.playbackState == MPMusicPlaybackState.playing) && (tableHour == GlobalVars.hour)){ + musicHandler.updateMusic() + } + + hoursTable.reloadData() + dismiss(animated: true, completion: nil) + } + + func mediaPickerDidCancel(_ mediaPicker: MPMediaPickerController) { + dismiss(animated: true, completion: nil) + hoursTable.reloadData() + } + + @IBOutlet var hoursTable: UITableView! + + @IBOutlet var gradientView: UIView! + + @IBOutlet var selectListControl: UISegmentedControl! + + @IBAction func selectListControlChanged(_ sender: Any) { + + MPMusicPlayerController.applicationMusicPlayer.stop() + + GlobalVars.selectedMusicList = selectListControl.selectedSegmentIndex + //print(GlobalVars.selectedMusicList) + hoursTable.reloadData() + /*var noSongs = false + switch GlobalVars.selectedMusicList { + case 0: + for i in GlobalVars.musicSelectionID0 { + if (i == 0){ + noSongs = true + } + } + case 1: + for i in GlobalVars.musicSelectionID1 { + if (i == 0){ + noSongs = true + } + } + case 2: + for i in GlobalVars.musicSelectionID2 { + if (i == 0){ + noSongs = true + } + } + case 3: + for i in GlobalVars.musicSelectionID3 { + if (i == 0){ + noSongs = true + } + } + case 4: + for i in GlobalVars.musicSelectionID4 { + if (i == 0){ + noSongs = true + } + } + default: + for i in GlobalVars.musicSelectionID0 { + if (i == 0){ + noSongs = true + } + } + } + + if noSongs { + MPMusicPlayerController.applicationMusicPlayer.pause() + //print("pausing") + }*/ + + musicHandler.updateMusic() + //print("updating") + } + + + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view. + + // TODO REQUEST PERMISSION FIRST + + mediaPicker.delegate = self + mediaPicker.allowsPickingMultipleItems = false + + //present(mediaPicker, animated: true, completion: nil) + //selectedSong = "" + + //pickerView.selectRow(2, inComponent: 0, animated: true) + //pickerView.dataSource = self + //pickerView.delegate = self + hoursTable.delegate = self + hoursTable.dataSource = self + + selectListControl.selectedSegmentIndex = GlobalVars.selectedMusicList + + } + + override func viewWillAppear(_ animated: Bool) { + + let prevHour = GlobalVars.hour + GlobalVars.hour = Calendar.current.component(.hour, from: Date()) + if GlobalVars.hour != prevHour { + musicHandler.updateMusic() + } + + // create the gradient layer + let gradient = CAGradientLayer() + gradient.frame = self.view.bounds + //print("time: ", GlobalVars.hour) + if((GlobalVars.hour >= 8) && (GlobalVars.hour <= 19)){ //Daytime + //print("day") + gradient.colors = [UIColor(red: 0.39, green: 0.69, blue: 1.00, alpha: 1).cgColor, UIColor(red: 0.07, green: 0.45, blue: 0.87, alpha: 1).cgColor] + } else if((GlobalVars.hour >= 20) && (GlobalVars.hour <= 21)){//Sunset + //print("sunset") + gradient.colors = [UIColor(red: 0.00, green: 0.31, blue: 0.59, alpha: 1).cgColor, UIColor(red: 1.00, green: 0.78, blue: 0.88, alpha: 1).cgColor] + } else if((GlobalVars.hour >= 22) || (GlobalVars.hour <= 5)){//Night + //print("night") + gradient.colors = [UIColor(red: 0.08, green: 0.27, blue: 0.59, alpha: 1).cgColor, UIColor(red: 0.00, green: 0.20, blue: 0.29, alpha: 1).cgColor] + } else if((GlobalVars.hour >= 6) && (GlobalVars.hour <= 7)){//Sunrise + //print("sunrise") + gradient.colors = [UIColor(red: 0.02, green: 0.26, blue: 0.49, alpha: 1).cgColor, UIColor(red: 0.89, green: 0.68, blue: 0.60, alpha: 1).cgColor] + } + + gradient.locations = [0.00, 1.00] + + /*let gradientChangeAnimation = CABasicAnimation(keyPath: "colors") + gradientChangeAnimation.duration = 5.0 + if((GlobalVars.hour >= 8) && (GlobalVars.hour <= 19)){ //Daytime + //print("day") + gradientChangeAnimation.toValue = [UIColor(red: 0.00, green: 0.31, blue: 0.59, alpha: 1).cgColor, UIColor(red: 0.07, green: 0.45, blue: 0.87, alpha: 1).cgColor] + } else if((GlobalVars.hour >= 20) && (GlobalVars.hour <= 21)){//Sunset + //print("sunset") + gradientChangeAnimation.toValue = [UIColor(red: 0.00, green: 0.31, blue: 0.59, alpha: 1).cgColor, UIColor(red: 1.00, green: 0.61, blue: 0.43, alpha: 1).cgColor] + } else if((GlobalVars.hour >= 22) || (GlobalVars.hour <= 5)){//Night + //print("night") + gradientChangeAnimation.toValue = [ + UIColor(red: 0.68, green: 0.67, blue: 1.0, alpha: 1).cgColor, + UIColor(red: 1.00, green: 0.00, blue: 0.09, alpha: 1).cgColor + ] + } else if((GlobalVars.hour >= 6) && (GlobalVars.hour <= 7)){//Sunrise + //print("sunrise") + gradientChangeAnimation.toValue = [UIColor(red: 0.02, green: 0.26, blue: 0.49, alpha: 1).cgColor, UIColor(red: 0.89, green: 0.68, blue: 0.60, alpha: 1).cgColor] + } + gradientChangeAnimation.autoreverses = true + gradientChangeAnimation.fillMode = CAMediaTimingFillMode.forwards + gradientChangeAnimation.isRemovedOnCompletion = false + gradient.add(gradientChangeAnimation, forKey: "colorChange") + */ + // add the gradient to the view + gradientView.layer.addSublayer(gradient) + + switch GlobalVars.selectedMusicList { + case 0: + //print(GlobalVars.musicSelectionID0) + print(GlobalVars.musicSelection0) + case 1: + //print(GlobalVars.musicSelectionID1) + print(GlobalVars.musicSelection1) + case 2: + //print(GlobalVars.musicSelectionID2) + print(GlobalVars.musicSelection2) + case 3: + //print(GlobalVars.musicSelectionID3) + print(GlobalVars.musicSelection3) + case 4: + //print(GlobalVars.musicSelectionID4) + print(GlobalVars.musicSelection4) + default: + //print(GlobalVars.musicSelectionID0) + print(GlobalVars.musicSelection0) + } + } + + override func viewWillDisappear(_ animated: Bool) { + do { + try defaults.setObject(GlobalVars.musicSelection0, forKey: "savedMusicSelection0") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelectionID0, forKey: "savedMusicSelectionID0") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelection1, forKey: "savedMusicSelection1") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelectionID1, forKey: "savedMusicSelectionID1") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelection2, forKey: "savedMusicSelection2") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelectionID2, forKey: "savedMusicSelectionID2") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelection3, forKey: "savedMusicSelection3") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelectionID3, forKey: "savedMusicSelectionID3") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelection4, forKey: "savedMusicSelection4") + } catch { + //print(error.localizedDescription) + } + do { + try defaults.setObject(GlobalVars.musicSelectionID4, forKey: "savedMusicSelectionID4") + } catch { + //print(error.localizedDescription) + } + + do { + try defaults.setObject(GlobalVars.selectedMusicList, forKey: "savedSelectedMusicList") + } catch { + //print(error.localizedDescription) + } + } + + override func viewDidDisappear(_ animated: Bool) { + gradientView.layer.sublayers?.forEach { $0.removeFromSuperlayer() } + } + + @IBAction func visitWebsite(_ sender: Any) { + + let NotificationVC = self.storyboard?.instantiateViewController(withIdentifier: "ThirdViewController") as! UIViewController + + self.present(NotificationVC, animated: true, completion: nil) + + } + + +} + diff --git a/grandfatherrock/ThirdViewController.swift b/grandfatherrock/ThirdViewController.swift new file mode 100644 index 0000000..0a86e0c --- /dev/null +++ b/grandfatherrock/ThirdViewController.swift @@ -0,0 +1,50 @@ +// +// SecondViewController.swift +// grandfatherrock +// +// Created by Micah Gomez on 4/15/20. +// Copyright © 2020 Micah Gomez. All rights reserved. +// + +import UIKit +import MediaPlayer + +class ThirdViewController: UIViewController { + + @IBAction func websiteButton(_ sender: Any) { + if let url = URL(string: "https://micahpgomez.dev") { + UIApplication.shared.open(url) + } + } + + @IBAction func supportEmail(_ sender: Any) { + if let url = URL(string: "mailto:support@micahpgomez.dev") { + UIApplication.shared.open(url) + } + } + + @IBAction func smallTipButton(_ sender: Any) { + IAPHandler.shared.purchaseMyProduct(index: 0) + } + + @IBAction func mediumTipButton(_ sender: Any) { + IAPHandler.shared.purchaseMyProduct(index: 1) + } + + @IBAction func largeTipButton(_ sender: Any) { + IAPHandler.shared.purchaseMyProduct(index: 2) + } + + let defaults = UserDefaults.standard + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view. + //print("view loaded!") + + } + + + +} + diff --git a/grandfatherrock/fonts/FinkHeavy.ttf b/grandfatherrock/fonts/FinkHeavy.ttf new file mode 100644 index 0000000..efbea3c Binary files /dev/null and b/grandfatherrock/fonts/FinkHeavy.ttf differ diff --git a/grandfatherrock/gifs/day.gif b/grandfatherrock/gifs/day.gif new file mode 100644 index 0000000..76537e4 Binary files /dev/null and b/grandfatherrock/gifs/day.gif differ diff --git a/grandfatherrock/gifs/night.gif b/grandfatherrock/gifs/night.gif new file mode 100644 index 0000000..cdf9465 Binary files /dev/null and b/grandfatherrock/gifs/night.gif differ diff --git a/grandfatherrock/grandfatherrock.entitlements b/grandfatherrock/grandfatherrock.entitlements new file mode 100644 index 0000000..ee95ab7 --- /dev/null +++ b/grandfatherrock/grandfatherrock.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.network.client + + + diff --git a/grandfatherrockTests/Info.plist b/grandfatherrockTests/Info.plist new file mode 100644 index 0000000..64d65ca --- /dev/null +++ b/grandfatherrockTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/grandfatherrockTests/grandfatherrockTests.swift b/grandfatherrockTests/grandfatherrockTests.swift new file mode 100644 index 0000000..b6abc17 --- /dev/null +++ b/grandfatherrockTests/grandfatherrockTests.swift @@ -0,0 +1,34 @@ +// +// grandfatherrockTests.swift +// grandfatherrockTests +// +// Created by Micah Gomez on 4/15/20. +// Copyright © 2020 Micah Gomez. All rights reserved. +// + +import XCTest +@testable import grandfatherrock + +class grandfatherrockTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testPerformanceExample() throws { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/grandfatherrockUITests/Info.plist b/grandfatherrockUITests/Info.plist new file mode 100644 index 0000000..64d65ca --- /dev/null +++ b/grandfatherrockUITests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/grandfatherrockUITests/grandfatherrockUITests.swift b/grandfatherrockUITests/grandfatherrockUITests.swift new file mode 100644 index 0000000..c005e89 --- /dev/null +++ b/grandfatherrockUITests/grandfatherrockUITests.swift @@ -0,0 +1,43 @@ +// +// grandfatherrockUITests.swift +// grandfatherrockUITests +// +// Created by Micah Gomez on 4/15/20. +// Copyright © 2020 Micah Gomez. All rights reserved. +// + +import XCTest + +class grandfatherrockUITests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use recording to get started writing UI tests. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testLaunchPerformance() throws { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { + // This measures how long it takes to launch your application. + measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) { + XCUIApplication().launch() + } + } + } +}