Skip to content

Commit

Permalink
Add DJ name and LIVE fields
Browse files Browse the repository at this point in the history
 - Added labels to stack
 - added code to set PLAYING LIVE label
  • Loading branch information
joemcmahon committed Dec 23, 2023
1 parent 5655b25 commit 2ed0ee0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
2 changes: 2 additions & 0 deletions RadioSpiral.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
6258DCD822D93A3500166C65 /* LogoShareView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6258DCD722D93A3500166C65 /* LogoShareView.swift */; };
6258DCDA22D93A5400166C65 /* LogoShareView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6258DCD922D93A5400166C65 /* LogoShareView.xib */; };
715C87A62B23E141003FC57A /* SnapshotHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 715C87A52B23E141003FC57A /* SnapshotHelper.swift */; };
7165121C2B35519B00473770 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CF72ACE621F714D000461EED /* Main.storyboard */; };
9409E11C1ABF6FEA00312E2B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9409E11B1ABF6FEA00312E2B /* AppDelegate.swift */; };
9409E1261ABF6FEA00312E2B /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9409E1251ABF6FEA00312E2B /* Images.xcassets */; };
9409E1401ABF78B000312E2B /* NowPlayingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9409E13F1ABF78B000312E2B /* NowPlayingViewController.swift */; };
Expand Down Expand Up @@ -446,6 +447,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7165121C2B35519B00473770 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
26 changes: 23 additions & 3 deletions RadioSpiral/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="dark"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
<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"/>
Expand Down Expand Up @@ -263,7 +263,7 @@
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="8xJ-4F-WCE" userLabel="Labels Stack View">
<rect key="frame" x="12" y="518" width="390" height="65.5"/>
<rect key="frame" x="12" y="518" width="390" height="151"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Song Name" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="KC8-ZG-rx5" userLabel="Song Label" customClass="SpringLabel" customModule="Spring">
<rect key="frame" x="124.5" y="0.0" width="141" height="33.5"/>
Expand All @@ -277,6 +277,24 @@
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vcb-RP-Q8K">
<rect key="frame" x="193" y="73.5" width="4.5" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="DJ" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hfL-H2-Ntj">
<rect key="frame" x="184.5" y="102" width="21" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PLAYING LIVE" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FfM-GM-gNj">
<rect key="frame" x="141.5" y="130.5" width="107.5" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RA9-OX-Xr1" userLabel="Station Desc Label">
Expand Down Expand Up @@ -382,8 +400,10 @@
<outlet property="albumHeightConstraint" destination="hCD-tK-vVP" id="VlU-n5-VPe"/>
<outlet property="albumImageView" destination="obn-8m-awZ" id="13r-WO-VAs"/>
<outlet property="artistLabel" destination="v3l-q6-g0h" id="s0B-6Y-MWu"/>
<outlet property="djName" destination="hfL-H2-Ntj" id="DUM-BO-dBv"/>
<outlet property="nextButton" destination="rdn-tm-QKv" id="VHQ-xc-bpl"/>
<outlet property="playingButton" destination="k7t-tN-2wp" id="ZOi-KR-veF"/>
<outlet property="playingLive" destination="FfM-GM-gNj" id="dEQ-Xw-khI"/>
<outlet property="previousButton" destination="W6n-gy-z3a" id="bKE-rg-HPb"/>
<outlet property="songLabel" destination="KC8-ZG-rx5" id="tNh-3K-qWW"/>
<outlet property="stationDescLabel" destination="RA9-OX-Xr1" id="uAM-NB-RRM"/>
Expand Down
12 changes: 10 additions & 2 deletions RadioSpiral/ViewControllers/NowPlayingViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class NowPlayingViewController: UIViewController {
@IBOutlet weak var previousButton: UIButton!
@IBOutlet weak var nextButton: UIButton!
@IBOutlet weak var airPlayView: UIView!
@IBOutlet weak var djName: UILabel!
@IBOutlet weak var playingLive: UILabel!

// MARK: - Properties

Expand Down Expand Up @@ -68,6 +70,8 @@ class NowPlayingViewController: UIViewController {

stationDescLabel.text = manager.currentStation?.desc
stationDescLabel.isHidden = player.currentMetadata != nil
playingLive.text = ""
djName.text = ""

// Check for station change
if isNewStation {
Expand Down Expand Up @@ -200,14 +204,13 @@ class NowPlayingViewController: UIViewController {
case .loading:
message = "Loading Station ..."
case .urlNotSet:
message = "Station URL not valide"
message = "Station URL not valid"
case .readyToPlay, .loadingFinished:
playbackStateDidChange(player.playbackState, animate: animate)
return
case .error:
message = "Error Playing"
}

updateLabels(with: message, animate: animate)
}

Expand Down Expand Up @@ -236,6 +239,11 @@ class NowPlayingViewController: UIViewController {
// Radio is (hopefully) streaming properly
songLabel.text = manager.currentStation?.trackName
artistLabel.text = manager.currentStation?.artistName
if ((songLabel.text!.hasSuffix("[LIVE]"))) {
playingLive.text = "PLAYING LIVE"
} else {
playingLive.text = ""
}
shouldAnimateSongLabel(animate)
return
}
Expand Down

0 comments on commit 2ed0ee0

Please sign in to comment.