1.3 initial push

TODO: add support code to prevent app from crashing upon launch after update
This commit is contained in:
Micah Gomez 2021-08-05 12:03:15 -07:00
parent e41a7d419b
commit f2f85f14b5
12 changed files with 224 additions and 165 deletions

BIN
.DS_Store vendored

Binary file not shown.

View file

@ -613,7 +613,7 @@
CODE_SIGN_ENTITLEMENTS = grandfatherrock/grandfatherrock.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = PRBH2T6668;
INFOPLIST_FILE = grandfatherrock/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
@ -621,7 +621,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.1;
MARKETING_VERSION = 1.3;
PRODUCT_BUNDLE_IDENTIFIER = dev.mpg13.grandfatherrock;
PRODUCT_NAME = "Nook Music";
SUPPORTS_MACCATALYST = NO;
@ -639,7 +639,7 @@
CODE_SIGN_ENTITLEMENTS = grandfatherrock/grandfatherrock.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = PRBH2T6668;
INFOPLIST_FILE = grandfatherrock/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
@ -647,7 +647,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.1;
MARKETING_VERSION = 1.3;
PRODUCT_BUNDLE_IDENTIFIER = dev.mpg13.grandfatherrock;
PRODUCT_NAME = "Nook Music";
SUPPORTS_MACCATALYST = NO;
@ -749,7 +749,7 @@
CODE_SIGN_ENTITLEMENTS = hssceneExtension.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = PRBH2T6668;
INFOPLIST_FILE = hsscene/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
@ -758,7 +758,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.2.1;
MARKETING_VERSION = 1.3;
PRODUCT_BUNDLE_IDENTIFIER = dev.mpg13.grandfatherrock.hsscene;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@ -777,7 +777,7 @@
CODE_SIGN_ENTITLEMENTS = hssceneExtension.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = PRBH2T6668;
INFOPLIST_FILE = hsscene/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
@ -786,7 +786,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.2.1;
MARKETING_VERSION = 1.3;
PRODUCT_BUNDLE_IDENTIFIER = dev.mpg13.grandfatherrock.hsscene;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "grasssnow.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "grasssnow-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "grasssnow-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -4,7 +4,6 @@
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="Image references" minToolsVersion="12.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@ -47,6 +46,17 @@
<action selector="play:" destination="9pv-A4-QxB" eventType="touchUpInside" id="3Tt-QE-VYp"/>
</connections>
</button>
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="EB1-zK-bx6">
<rect key="frame" x="30" y="344.5" width="260" height="32"/>
<segments>
<segment title="☀️"/>
<segment title="🌧"/>
<segment title="❄️"/>
</segments>
<connections>
<action selector="weatherControlChanged:" destination="9pv-A4-QxB" eventType="valueChanged" id="xx5-0I-9LA"/>
</connections>
</segmentedControl>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="hh:mm am" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ERT-d4-fi5">
<rect key="frame" x="8" y="20" width="304" height="100"/>
<constraints>
@ -79,21 +89,28 @@
<constraint firstItem="Ujw-y3-bt3" firstAttribute="leading" secondItem="PQr-Ze-W5v" secondAttribute="leading" constant="-2" id="M4e-yJ-sli"/>
<constraint firstItem="gBq-iQ-6kU" firstAttribute="trailing" secondItem="ERT-d4-fi5" secondAttribute="trailing" id="Qlw-5S-SBe"/>
<constraint firstItem="ERT-d4-fi5" firstAttribute="top" secondItem="PQr-Ze-W5v" secondAttribute="top" constant="20" id="abF-4H-3Jo"/>
<constraint firstItem="EB1-zK-bx6" firstAttribute="width" secondItem="Nou-CB-qnJ" secondAttribute="width" multiplier="3" priority="750" id="cSO-Rz-LDp"/>
<constraint firstItem="gBq-iQ-6kU" firstAttribute="leading" secondItem="ERT-d4-fi5" secondAttribute="leading" id="e83-8N-8nC"/>
<constraint firstItem="EB1-zK-bx6" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="PQr-Ze-W5v" secondAttribute="leading" constant="30" id="flf-Mt-dRH"/>
<constraint firstItem="EB1-zK-bx6" firstAttribute="centerX" secondItem="tsR-hK-woN" secondAttribute="centerX" id="hmh-4c-xiW"/>
<constraint firstItem="Nou-CB-qnJ" firstAttribute="centerX" secondItem="tsR-hK-woN" secondAttribute="centerX" id="iDP-6C-9Nk"/>
<constraint firstItem="PQr-Ze-W5v" firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="EB1-zK-bx6" secondAttribute="trailing" constant="30" id="oyN-uE-9KT"/>
<constraint firstItem="gBq-iQ-6kU" firstAttribute="top" secondItem="ERT-d4-fi5" secondAttribute="bottom" constant="8" symbolic="YES" id="suB-Xs-y8e"/>
<constraint firstItem="1nc-vR-sG8" firstAttribute="top" secondItem="tsR-hK-woN" secondAttribute="top" id="uQw-4j-WKL"/>
<constraint firstItem="EB1-zK-bx6" firstAttribute="top" secondItem="Nou-CB-qnJ" secondAttribute="bottom" constant="20" id="yyd-CT-dqP"/>
<constraint firstItem="Ujw-y3-bt3" firstAttribute="trailing" secondItem="PQr-Ze-W5v" secondAttribute="trailing" constant="2" id="zIw-Ko-SKq"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" title="Home" image="play.fill" catalog="system" id="acW-dT-cKf"/>
<connections>
<outlet property="PlayButtonSize" destination="1c8-JO-es0" id="aFW-tJ-O5u"/>
<outlet property="barbutton" destination="acW-dT-cKf" id="k9q-7x-OVQ"/>
<outlet property="controlButton" destination="Nou-CB-qnJ" id="s10-cM-NWa"/>
<outlet property="gradientView" destination="1nc-vR-sG8" id="bJA-Q5-DBR"/>
<outlet property="sceneryImageView" destination="Ujw-y3-bt3" id="zJN-5h-eRp"/>
<outlet property="songLabel" destination="gBq-iQ-6kU" id="SyO-qx-0Rf"/>
<outlet property="timeLabel" destination="ERT-d4-fi5" id="pOH-To-ihA"/>
<outlet property="weatherControl" destination="EB1-zK-bx6" id="s7V-bH-dQX"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="W5J-7L-Pyd" sceneMemberID="firstResponder"/>
@ -113,8 +130,19 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="jWY-Sn-qfF">
<rect key="frame" x="16" y="47" width="288" height="32"/>
<segments>
<segment title="☀️"/>
<segment title="🌧"/>
<segment title="❄️"/>
</segments>
<connections>
<action selector="selectListControlChanged:" destination="8rJ-Kc-sve" eventType="valueChanged" id="gUl-S3-X1i"/>
</connections>
</segmentedControl>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="EyG-9P-mxm">
<rect key="frame" x="16" y="47" width="288" height="392"/>
<rect key="frame" x="16" y="86" width="288" height="353"/>
<color key="backgroundColor" systemColor="systemFillColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleAspectFit" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="hourcell" rowHeight="80" id="4WK-Bk-wob" customClass="hourDataCell" customModule="Nook_Music" customModuleProvider="target">
@ -168,11 +196,11 @@
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="tNe-0A-XZP">
<rect key="frame" x="16" y="8" width="288" height="32"/>
<segments>
<segment title="First"/>
<segment title="Second"/>
<segment title="Third"/>
<segment title="Fourth"/>
<segment title="Fifth"/>
<segment title="1"/>
<segment title="2"/>
<segment title="3"/>
<segment title="4"/>
<segment title="5"/>
</segments>
<color key="selectedSegmentTintColor" systemColor="systemFillColor"/>
<connections>
@ -204,15 +232,19 @@
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="EyG-9P-mxm" firstAttribute="leading" secondItem="tNe-0A-XZP" secondAttribute="leading" id="0Ug-kD-Es8"/>
<constraint firstItem="jWY-Sn-qfF" firstAttribute="centerX" secondItem="tNe-0A-XZP" secondAttribute="centerX" id="4n2-JS-CXX"/>
<constraint firstItem="O1u-W8-tvY" firstAttribute="trailing" secondItem="tNe-0A-XZP" secondAttribute="trailing" constant="16" id="7D2-6v-kz9"/>
<constraint firstItem="jWY-Sn-qfF" firstAttribute="leading" secondItem="tNe-0A-XZP" secondAttribute="leading" id="ARZ-oO-8c6"/>
<constraint firstItem="jWY-Sn-qfF" firstAttribute="top" secondItem="tNe-0A-XZP" secondAttribute="bottom" constant="8" symbolic="YES" id="ASB-XD-Lbh"/>
<constraint firstItem="EyG-9P-mxm" firstAttribute="trailing" secondItem="tNe-0A-XZP" secondAttribute="trailing" id="D5N-RQ-J49"/>
<constraint firstItem="vLK-eh-BHE" firstAttribute="leading" secondItem="tNe-0A-XZP" secondAttribute="leading" id="MYc-UO-KEr"/>
<constraint firstItem="EyG-9P-mxm" firstAttribute="top" secondItem="tNe-0A-XZP" secondAttribute="bottom" constant="8" id="Y8x-0r-NO8"/>
<constraint firstItem="tNe-0A-XZP" firstAttribute="leading" secondItem="O1u-W8-tvY" secondAttribute="leading" constant="16" id="ZzX-JZ-R7L"/>
<constraint firstItem="tNe-0A-XZP" firstAttribute="top" secondItem="O1u-W8-tvY" secondAttribute="top" constant="8" id="cBr-Ja-CsG"/>
<constraint firstItem="jWY-Sn-qfF" firstAttribute="trailing" secondItem="tNe-0A-XZP" secondAttribute="trailing" id="end-xj-tPH"/>
<constraint firstItem="vLK-eh-BHE" firstAttribute="bottom" secondItem="O1u-W8-tvY" secondAttribute="bottom" constant="-20" id="imQ-3z-Lky"/>
<constraint firstItem="vLK-eh-BHE" firstAttribute="trailing" secondItem="tNe-0A-XZP" secondAttribute="trailing" id="jKU-me-vte"/>
<constraint firstItem="vLK-eh-BHE" firstAttribute="top" secondItem="EyG-9P-mxm" secondAttribute="bottom" constant="20" id="lRh-DA-wzr"/>
<constraint firstItem="EyG-9P-mxm" firstAttribute="top" secondItem="jWY-Sn-qfF" secondAttribute="bottom" constant="8" symbolic="YES" id="rv2-uM-8t6"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" title="Select Music" image="music.note.list" catalog="system" id="cPa-gy-q4n"/>
@ -220,25 +252,25 @@
<outlet property="gradientView" destination="MfW-5R-IkK" id="2mB-cs-cXs"/>
<outlet property="hoursTable" destination="EyG-9P-mxm" id="nKa-0x-NrF"/>
<outlet property="selectListControl" destination="tNe-0A-XZP" id="Y9A-1K-Qj9"/>
<outlet property="selectListWeatherControl" destination="jWY-Sn-qfF" id="2U4-v2-GSL"/>
<segue destination="8LK-WS-C3a" kind="presentation" modalPresentationStyle="automatic" id="4kl-sn-3de"/>
<segue destination="XMN-Ld-irO" kind="presentation" id="vuf-aN-ACY"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="4Nw-L8-lE0" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="748" y="358"/>
<point key="canvasLocation" x="746.25" y="357.04225352112678"/>
</scene>
<!--Tab Bar Controller-->
<scene sceneID="yl2-sM-qoP">
<objects>
<tabBarController id="49e-Tb-3d3" sceneMemberID="viewController">
<tabBar key="tabBar" contentMode="scaleToFill" barStyle="black" translucent="NO" itemPositioning="fill" id="W28-zg-YXA">
<tabBar key="tabBar" contentMode="scaleToFill" barStyle="black" translucent="NO" backgroundImage="grass" itemPositioning="fill" id="W28-zg-YXA">
<rect key="frame" x="0.0" y="975" width="768" height="49"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" red="0.86256664989999998" green="0.69524472950000005" blue="0.2422021627" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="selectedImageTintColor" red="0.86256664989999998" green="0.69524472950000005" blue="0.2422021627" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<imageReference key="backgroundImage" image="grass"/>
<color key="selectedImageTintColor" red="0.86274509799999999" green="0.69411764710000001" blue="0.24313725489999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</tabBar>
<connections>
<segue destination="9pv-A4-QxB" kind="relationship" relationship="viewControllers" id="u7Y-xg-7CH"/>

View file

@ -166,8 +166,8 @@ public class musicHandler{
audioPlayer.play()
let mpic = MPNowPlayingInfoCenter.default()
mpic.nowPlayingInfo = [
MPMediaItemPropertyTitle:"This Is a Test",
MPMediaItemPropertyArtist:"Matt Neuburg"
MPMediaItemPropertyTitle:"AC Tape Deck",
MPMediaItemPropertyArtist:"Micah Gomez"
]
}
}
@ -196,14 +196,16 @@ public class musicHandler{
}
struct GlobalVars {
static var musicSelectionID:[[UInt64]] = [[UInt64]](repeating: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], count: 5)
static var musicSelection:[[String]] = [[String]](repeating: ["","","","","","","","","","","","","","","","","","","","","","","",""], count: 5)
static var musicFileURL:[[String]] = [[String]](repeating: ["","","","","","","","","","","","","","","","","","","","","","","",""], count: 5)
static var musicFormatType:[[Bool]] = [[Bool]](repeating: [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false], count: 5)
static var musicSelectionID:[[UInt64]] = [[UInt64]](repeating: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], count: 15)
static var musicSelection:[[String]] = [[String]](repeating: ["","","","","","","","","","","","","","","","","","","","","","","",""], count: 15)
static var musicFileURL:[[String]] = [[String]](repeating: ["","","","","","","","","","","","","","","","","","","","","","","",""], count: 15)
static var musicFormatType:[[Bool]] = [[Bool]](repeating: [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false], count: 15)
static var selectedCell:Int? = nil
static var selectedMusicList:Int = UserDefaults.standard.integer(forKey: "savedSelectedMusicList")
static var selectedList:Int = UserDefaults.standard.integer(forKey: "savedSelectedList")
static var weatherList:Int = UserDefaults.standard.integer(forKey: "savedWeatherList")
static var musicStarted = false
static var currentMusicFormat:Bool = false
static var titleName = UserDefaults.standard.string(forKey: "selectedTitle")
@ -349,7 +351,7 @@ class FirstViewController: UIViewController{
if(!defaults.bool(forKey: "didRun")){
defaults.set(0, forKey: "titleNo")
//defaults.set(true, forKey: "didRun")
for n in 0...4 {
for n in 0...14 {
print(n)
GlobalVars.musicSelectionID[n] = [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.musicSelection[n] = ["","","","","","","","","","","","","","","","","","","","","","","",""]
@ -364,7 +366,7 @@ class FirstViewController: UIViewController{
} else {
if(!defaults.bool(forKey: "didUpdate")){
for n in 0...4 {
for n in 0...14 {
print(n)
GlobalVars.musicFormatType[n] = [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]
GlobalVars.musicFileURL[n] = ["","","","","","","","","","","","","","","","","","","","","","","",""]
@ -372,10 +374,27 @@ class FirstViewController: UIViewController{
defaults.set(true, forKey: "didUpdate")
print("appjustupdated")
}
if(!defaults.bool(forKey: "didUpdate2")){
for n in 5...14 {
print(n)
GlobalVars.musicFormatType[n] = [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]
GlobalVars.musicFileURL[n] = ["","","","","","","","","","","","","","","","","","","","","","","",""]
GlobalVars.musicSelection[n] = ["","","","","","","","","","","","","","","","","","","","","","","",""]
GlobalVars.musicSelectionID[n] = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
}
do {try defaults.setObject(GlobalVars.musicSelection, forKey: "savedMusicSelection")} catch {/*print(error.localizedDescription)*/}
do {try defaults.setObject(GlobalVars.musicSelectionID, forKey: "savedMusicSelectionID")} catch {/*print(error.localizedDescription)*/}
do {try defaults.setObject(GlobalVars.musicFileURL, forKey: "savedMusicFileURL")} catch {/*print(error.localizedDescription)*/}
do {try defaults.setObject(GlobalVars.musicFormatType, forKey: "savedMusicFileType")} catch {/*print(error.localizedDescription)*/}
defaults.set(true, forKey: "didUpdate2")
print("appjustupdated")
}
do {GlobalVars.musicSelection = try defaults.getObject(forKey: "savedMusicSelection", castTo: [[String]].self)} catch {/*print(error.localizedDescription)*/}
do {GlobalVars.musicSelectionID = try defaults.getObject(forKey: "savedMusicSelectionID", castTo: [[UInt64]].self)} catch {/*print(error.localizedDescription)*/}
do {GlobalVars.musicFileURL = try defaults.getObject(forKey: "savedMusicFileURL", castTo: [[String]].self)} catch {/*print(error.localizedDescription)*/}
do {GlobalVars.musicFormatType = try defaults.getObject(forKey: "savedMusicFileType", castTo: [[Bool]].self)} catch {/*print(error.localizedDescription)*/}
do {GlobalVars.selectedMusicList = try defaults.getObject(forKey: "savedSelectedMusicList", castTo: Int.self)} catch {/*print(error.localizedDescription)*/}
do {GlobalVars.selectedList = try defaults.getObject(forKey: "savedSelectedList", castTo: Int.self)} catch {/*print(error.localizedDescription)*/}
//print("App Ran Before")
}
@ -513,45 +532,6 @@ class FirstViewController: UIViewController{
}
}
/*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)
@ -663,33 +643,28 @@ class FirstViewController: UIViewController{
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)
// MARK: CHANGE TAB BAR IMAGE
//navigationController?.navigationBar.setBackgroundImage(UIImage(imageLiteralResourceName: "snowgrass"), for: UIBarMetrics.default)
print("list is supposed to be \(GlobalVars.selectedList) in home screen")
print("weather list is supposed to be \(GlobalVars.weatherList) in home screen")
weatherControl.selectedSegmentIndex = GlobalVars.weatherList
if GlobalVars.weatherList == 0 {
let backImg: UIImage = UIImage(named: "grass")!
self.tabBarController?.tabBar.backgroundImage = backImg
self.tabBarController?.tabBar.tintColor = UIColor(red: 0.86, green: 0.69, blue: 0.24, alpha: 1.00)
} else if GlobalVars.weatherList == 1 {
let backImg: UIImage = UIImage(named: "grass")!
self.tabBarController?.tabBar.backgroundImage = backImg
self.tabBarController?.tabBar.tintColor = UIColor(red: 0.86, green: 0.69, blue: 0.24, alpha: 1.00)
} else if GlobalVars.weatherList == 2 {
let backImg: UIImage = UIImage(named: "grasssnow")!
self.tabBarController?.tabBar.backgroundImage = backImg
self.tabBarController?.tabBar.tintColor = UIColor(red: 0.12, green: 0.54, blue: 0.61, alpha: 1.00)
}
}
override func viewWillDisappear(_ animated: Bool) {
@ -725,8 +700,8 @@ class FirstViewController: UIViewController{
} else{
GlobalVars.musicStarted = false
musicPlayer.pause()
audioPlayer.pause()
audioPlayer.stop()
musicPlayer.stop()
controlButton.accessibilityLabel = "Play Button"
controlButton.setBackgroundImage(UIImage(systemName: "play.circle"), for: UIControl.State.normal)
@ -930,6 +905,48 @@ class FirstViewController: UIViewController{
}
}
@IBOutlet var weatherControl: UISegmentedControl!
@IBOutlet var barbutton: UITabBarItem!
@IBAction func weatherControlChanged(_ sender: Any) {
MPMusicPlayerController.applicationMusicPlayer.stop()
audioPlayer.stop()
musicPlayer.stop()
var list = GlobalVars.selectedList
if weatherControl.selectedSegmentIndex == 0 {
let backImg: UIImage = UIImage(named: "grass")!
self.tabBarController?.tabBar.backgroundImage = backImg
self.tabBarController?.tabBar.tintColor = UIColor(red: 0.86, green: 0.69, blue: 0.24, alpha: 1.00)
} else if weatherControl.selectedSegmentIndex == 1 {
list = list + 5
let backImg: UIImage = UIImage(named: "grass")!
self.tabBarController?.tabBar.backgroundImage = backImg
self.tabBarController?.tabBar.tintColor = UIColor(red: 0.86, green: 0.69, blue: 0.24, alpha: 1.00)
} else if weatherControl.selectedSegmentIndex == 2 {
list = list + 10
let backImg: UIImage = UIImage(named: "grasssnow")!
self.tabBarController?.tabBar.backgroundImage = backImg
self.tabBarController?.tabBar.tintColor = UIColor(red: 0.12, green: 0.54, blue: 0.61, alpha: 1.00)
}
GlobalVars.selectedMusicList = list
GlobalVars.weatherList = weatherControl.selectedSegmentIndex
print("selected playlist is \(list)")
//defaults.set(list, forKey: "savedSelectedList")
defaults.set(weatherControl.selectedSegmentIndex, forKey: "savedWeatherList")
//print(GlobalVars.selectedMusicList)
musicHandler.updateMusic()
//print("updating")
}
/*@objc func updateMusic(){
//timer.invalidate()

View file

@ -77,6 +77,17 @@ class SecondViewController: UIViewController, UITableViewDelegate, UITableViewDa
hourString.append(" PM")
}
var weather = ""
if GlobalVars.weatherList == 0 {
weather = "☀️ "
} else if GlobalVars.weatherList == 1 {
weather = "🌧 "
} else if GlobalVars.weatherList == 2 {
weather = "❄️ "
}
hourString = "\(weather)\(hourString)"
cell.hourLabel?.text = hourString
cell.accessibilityLabel = cell.hourLabel.text
cell.accessibilityLabel?.append(". ")
@ -308,60 +319,43 @@ class SecondViewController: UIViewController, UITableViewDelegate, UITableViewDa
@IBOutlet var selectListControl: UISegmentedControl!
@IBOutlet var selectListWeatherControl: UISegmentedControl!
@IBAction func selectListControlChanged(_ sender: Any) {
MPMusicPlayerController.applicationMusicPlayer.stop()
audioPlayer.stop()
musicPlayer.stop()
var list = selectListControl.selectedSegmentIndex
if selectListWeatherControl.selectedSegmentIndex == 0 {
let backImg: UIImage = UIImage(named: "grass")!
self.tabBarController?.tabBar.backgroundImage = backImg
self.tabBarController?.tabBar.tintColor = UIColor(red: 0.86, green: 0.69, blue: 0.24, alpha: 1.00)
} else if selectListWeatherControl.selectedSegmentIndex == 1 {
list = list + 5
let backImg: UIImage = UIImage(named: "grass")!
self.tabBarController?.tabBar.backgroundImage = backImg
self.tabBarController?.tabBar.tintColor = UIColor(red: 0.86, green: 0.69, blue: 0.24, alpha: 1.00)
} else if selectListWeatherControl.selectedSegmentIndex == 2 {
list = list + 10
let backImg: UIImage = UIImage(named: "grasssnow")!
self.tabBarController?.tabBar.backgroundImage = backImg
self.tabBarController?.tabBar.tintColor = UIColor(red: 0.12, green: 0.54, blue: 0.61, alpha: 1.00)
}
GlobalVars.selectedMusicList = selectListControl.selectedSegmentIndex
GlobalVars.selectedMusicList = list
GlobalVars.weatherList = selectListWeatherControl.selectedSegmentIndex
print("selected playlist is \(list)")
print("saving savedSelectedList to \(selectListControl.selectedSegmentIndex)")
defaults.set(selectListControl.selectedSegmentIndex, forKey: "savedSelectedList")
print("saving savedSelectedMusicList to \(selectListControl.selectedSegmentIndex)")
defaults.set(selectListControl.selectedSegmentIndex, forKey: "savedSelectedMusicList")
print("saving savedWeatherList to \(selectListWeatherControl.selectedSegmentIndex)")
defaults.set(selectListWeatherControl.selectedSegmentIndex, forKey: "savedWeatherList")
//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")
}
@ -419,32 +413,24 @@ class SecondViewController: UIViewController, UITableViewDelegate, UITableViewDa
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)
print("list is supposed to be \(GlobalVars.selectedList) in home screen")
print("weather list is supposed to be \(GlobalVars.weatherList) in music screen")
selectListWeatherControl.selectedSegmentIndex = GlobalVars.weatherList
if GlobalVars.weatherList == 0 {
let backImg: UIImage = UIImage(named: "grass")!
self.tabBarController?.tabBar.backgroundImage = backImg
self.tabBarController?.tabBar.tintColor = UIColor(red: 0.86, green: 0.69, blue: 0.24, alpha: 1.00)
} else if GlobalVars.weatherList == 1 {
let backImg: UIImage = UIImage(named: "grass")!
self.tabBarController?.tabBar.backgroundImage = backImg
self.tabBarController?.tabBar.tintColor = UIColor(red: 0.86, green: 0.69, blue: 0.24, alpha: 1.00)
} else if GlobalVars.weatherList == 2 {
let backImg: UIImage = UIImage(named: "grasssnow")!
self.tabBarController?.tabBar.backgroundImage = backImg
self.tabBarController?.tabBar.tintColor = UIColor(red: 0.12, green: 0.54, blue: 0.61, alpha: 1.00)
}
}
override func viewWillDisappear(_ animated: Bool) {
@ -452,6 +438,7 @@ class SecondViewController: UIViewController, UITableViewDelegate, UITableViewDa
do {try defaults.setObject(GlobalVars.musicSelectionID, forKey: "savedMusicSelectionID")} catch {/*print(error.localizedDescription)*/}
do {try defaults.setObject(GlobalVars.musicFileURL, forKey: "savedMusicFileURL")} catch {/*print(error.localizedDescription)*/}
do {try defaults.setObject(GlobalVars.musicFormatType, forKey: "savedMusicFileType")} catch {/*print(error.localizedDescription)*/}
do {try defaults.setObject(GlobalVars.weatherList, forKey: "savedWeatherList")} catch {/*print(error.localizedDescription)*/}
}
override func viewDidDisappear(_ animated: Bool) {