1
1
mirror of https://github.com/danbee/persephone synced 2025-03-04 08:39:11 +00:00

Wire up play/queue buttons and display disc no

This commit is contained in:
Daniel Barber 2020-03-31 21:59:51 -04:00
parent ec67a19f54
commit d9caf538ee
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8
7 changed files with 108 additions and 32 deletions

View File

@ -300,6 +300,8 @@
E4B5AE7E22F4C49600CCEC65 /* MPDServerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4B5AE7D22F4C49600CCEC65 /* MPDServerDelegate.swift */; }; E4B5AE7E22F4C49600CCEC65 /* MPDServerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4B5AE7D22F4C49600CCEC65 /* MPDServerDelegate.swift */; };
E4BB7F8F23E5E7BC00906E2F /* MPDAlbumArtImageDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4BB7F8E23E5E7BC00906E2F /* MPDAlbumArtImageDataProvider.swift */; }; E4BB7F8F23E5E7BC00906E2F /* MPDAlbumArtImageDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4BB7F8E23E5E7BC00906E2F /* MPDAlbumArtImageDataProvider.swift */; };
E4BB7F9323E9150A00906E2F /* CoverArtService.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4BB7F9223E9150A00906E2F /* CoverArtService.swift */; }; E4BB7F9323E9150A00906E2F /* CoverArtService.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4BB7F9223E9150A00906E2F /* CoverArtService.swift */; };
E4C51F08243422380093FB31 /* AlbumDiscCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4C51F07243422380093FB31 /* AlbumDiscCell.swift */; };
E4C51F0A243428B60093FB31 /* UIFont.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4C51F09243428B60093FB31 /* UIFont.swift */; };
E4C8B53C22342005009A20F3 /* PreferencesWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4C8B53B22342005009A20F3 /* PreferencesWindowController.swift */; }; E4C8B53C22342005009A20F3 /* PreferencesWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4C8B53B22342005009A20F3 /* PreferencesWindowController.swift */; };
E4C8B53E22349002009A20F3 /* MPDIdle.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4C8B53D22349002009A20F3 /* MPDIdle.swift */; }; E4C8B53E22349002009A20F3 /* MPDIdle.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4C8B53D22349002009A20F3 /* MPDIdle.swift */; };
E4D3BFA622B419C000C56F48 /* QueueViewController+NSOutlineViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4D3BFA522B419C000C56F48 /* QueueViewController+NSOutlineViewDelegate.swift */; }; E4D3BFA622B419C000C56F48 /* QueueViewController+NSOutlineViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4D3BFA522B419C000C56F48 /* QueueViewController+NSOutlineViewDelegate.swift */; };
@ -657,6 +659,8 @@
E4B5AE7D22F4C49600CCEC65 /* MPDServerDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPDServerDelegate.swift; sourceTree = "<group>"; }; E4B5AE7D22F4C49600CCEC65 /* MPDServerDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPDServerDelegate.swift; sourceTree = "<group>"; };
E4BB7F8E23E5E7BC00906E2F /* MPDAlbumArtImageDataProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPDAlbumArtImageDataProvider.swift; sourceTree = "<group>"; }; E4BB7F8E23E5E7BC00906E2F /* MPDAlbumArtImageDataProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPDAlbumArtImageDataProvider.swift; sourceTree = "<group>"; };
E4BB7F9223E9150A00906E2F /* CoverArtService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoverArtService.swift; sourceTree = "<group>"; }; E4BB7F9223E9150A00906E2F /* CoverArtService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoverArtService.swift; sourceTree = "<group>"; };
E4C51F07243422380093FB31 /* AlbumDiscCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlbumDiscCell.swift; sourceTree = "<group>"; };
E4C51F09243428B60093FB31 /* UIFont.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIFont.swift; sourceTree = "<group>"; };
E4C8B53B22342005009A20F3 /* PreferencesWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesWindowController.swift; sourceTree = "<group>"; }; E4C8B53B22342005009A20F3 /* PreferencesWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesWindowController.swift; sourceTree = "<group>"; };
E4C8B53D22349002009A20F3 /* MPDIdle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPDIdle.swift; sourceTree = "<group>"; }; E4C8B53D22349002009A20F3 /* MPDIdle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPDIdle.swift; sourceTree = "<group>"; };
E4D3BFA522B419C000C56F48 /* QueueViewController+NSOutlineViewDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "QueueViewController+NSOutlineViewDelegate.swift"; sourceTree = "<group>"; }; E4D3BFA522B419C000C56F48 /* QueueViewController+NSOutlineViewDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "QueueViewController+NSOutlineViewDelegate.swift"; sourceTree = "<group>"; };
@ -943,6 +947,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
E41222272431539800473C1D /* CGSize.swift */, E41222272431539800473C1D /* CGSize.swift */,
E4C51F09243428B60093FB31 /* UIFont.swift */,
); );
path = Extensions; path = Extensions;
sourceTree = "<group>"; sourceTree = "<group>";
@ -950,9 +955,10 @@
E412222A243182F700473C1D /* Album Detail */ = { E412222A243182F700473C1D /* Album Detail */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
E412222F2432B0A300473C1D /* AlbumTracksDataSource.swift */, E4C51F07243422380093FB31 /* AlbumDiscCell.swift */,
E4B3B3622432DA4B007E25D2 /* AlbumSongCell.swift */, E4B3B3622432DA4B007E25D2 /* AlbumSongCell.swift */,
E4B3B3652432DEDB007E25D2 /* AlbumSongListViewController.swift */, E4B3B3652432DEDB007E25D2 /* AlbumSongListViewController.swift */,
E412222F2432B0A300473C1D /* AlbumTracksDataSource.swift */,
); );
path = "Album Detail"; path = "Album Detail";
sourceTree = "<group>"; sourceTree = "<group>";
@ -1986,6 +1992,7 @@
E4805A132426D73600362CF3 /* rplaylist.c in Sources */, E4805A132426D73600362CF3 /* rplaylist.c in Sources */,
E480513024255BDF00362CF3 /* MPDSong.swift in Sources */, E480513024255BDF00362CF3 /* MPDSong.swift in Sources */,
E4B3B3642432DB7A007E25D2 /* AlbumSongCell.swift in Sources */, E4B3B3642432DB7A007E25D2 /* AlbumSongCell.swift in Sources */,
E4C51F0A243428B60093FB31 /* UIFont.swift in Sources */,
E480511524255BAF00362CF3 /* DraggedSongType.swift in Sources */, E480511524255BAF00362CF3 /* DraggedSongType.swift in Sources */,
E480512B24255BDF00362CF3 /* MPDAlbum.swift in Sources */, E480512B24255BDF00362CF3 /* MPDAlbum.swift in Sources */,
E412221A2431425400473C1D /* AlbumViewController+UICollectionViewDataSource.swift in Sources */, E412221A2431425400473C1D /* AlbumViewController+UICollectionViewDataSource.swift in Sources */,
@ -2003,6 +2010,7 @@
E4805A1B2426D73600362CF3 /* cmessage.c in Sources */, E4805A1B2426D73600362CF3 /* cmessage.c in Sources */,
E48059E52426D73600362CF3 /* run.c in Sources */, E48059E52426D73600362CF3 /* run.c in Sources */,
E480514D24255E7D00362CF3 /* ServerActions.swift in Sources */, E480514D24255E7D00362CF3 /* ServerActions.swift in Sources */,
E4C51F08243422380093FB31 /* AlbumDiscCell.swift in Sources */,
E480511C24255BBF00362CF3 /* MPDClient.swift in Sources */, E480511C24255BBF00362CF3 /* MPDClient.swift in Sources */,
E480513B24255E7200362CF3 /* AlbumListState.swift in Sources */, E480513B24255E7200362CF3 /* AlbumListState.swift in Sources */,
E480512224255BDB00362CF3 /* MPDClient+Connection.swift in Sources */, E480512224255BDB00362CF3 /* MPDClient+Connection.swift in Sources */,

View File

@ -105,23 +105,33 @@
<constraint firstAttribute="width" secondItem="vMd-mZ-iq2" secondAttribute="height" multiplier="1:1" id="X9u-bs-kD7"/> <constraint firstAttribute="width" secondItem="vMd-mZ-iq2" secondAttribute="height" multiplier="1:1" id="X9u-bs-kD7"/>
</constraints> </constraints>
</imageView> </imageView>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5gg-Nm-qeI"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5gg-Nm-qeI">
<rect key="frame" x="19" y="470" width="177" height="45"/> <rect key="frame" x="20" y="470" width="177" height="45"/>
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" systemColor="secondarySystemBackgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="45" id="Czc-2v-b16"/> <constraint firstAttribute="height" constant="45" id="Czc-2v-b16"/>
</constraints> </constraints>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/> <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="18"/>
<state key="normal" title="Play"/> <state key="normal" title="Play" image="playButtonLarge">
<color key="titleColor" systemColor="linkColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="playAlbumAction:" destination="PiR-R2-zGX" eventType="touchUpInside" id="ZnV-tU-n45"/>
</connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Lvw-rf-UJc"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Lvw-rf-UJc">
<rect key="frame" x="217" y="470" width="177" height="45"/> <rect key="frame" x="217" y="470" width="177" height="45"/>
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" systemColor="secondarySystemBackgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="45" id="me8-vL-evB"/> <constraint firstAttribute="height" constant="45" id="me8-vL-evB"/>
</constraints> </constraints>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/> <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="18"/>
<state key="normal" title="Queue"/> <state key="normal" title="Queue" image="plus" catalog="system">
<color key="titleColor" systemColor="linkColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="addAlbumToQueueAction:" destination="PiR-R2-zGX" eventType="touchUpInside" id="OHR-k8-Cob"/>
</connections>
</button> </button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Metadata" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LH5-iT-vfZ"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Metadata" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LH5-iT-vfZ">
<rect key="frame" x="20" y="55" width="374" height="21"/> <rect key="frame" x="20" y="55" width="374" height="21"/>
@ -152,7 +162,7 @@
</constraints> </constraints>
</view> </view>
<prototypes> <prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="albumDiscCell" id="Cgr-Ay-PN6" customClass="AlbumTrackCell" customModule="Persephone" customModuleProvider="target"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="albumDiscCell" id="Cgr-Ay-PN6" customClass="AlbumDiscCell" customModule="Persephone" customModuleProvider="target">
<rect key="frame" x="0.0" y="551" width="414" height="43.5"/> <rect key="frame" x="0.0" y="551" width="414" height="43.5"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Cgr-Ay-PN6" id="QJR-Pt-aua"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Cgr-Ay-PN6" id="QJR-Pt-aua">
@ -171,6 +181,9 @@
<constraint firstItem="KZU-KX-MTh" firstAttribute="centerY" secondItem="QJR-Pt-aua" secondAttribute="centerY" id="w9Y-0V-gJb"/> <constraint firstItem="KZU-KX-MTh" firstAttribute="centerY" secondItem="QJR-Pt-aua" secondAttribute="centerY" id="w9Y-0V-gJb"/>
</constraints> </constraints>
</tableViewCellContentView> </tableViewCellContentView>
<connections>
<outlet property="albumDisc" destination="KZU-KX-MTh" id="62Y-Au-3KS"/>
</connections>
</tableViewCell> </tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="albumSongCell" id="mPK-LP-7dy" customClass="AlbumSongCell" customModule="Persephone" customModuleProvider="target"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="albumSongCell" id="mPK-LP-7dy" customClass="AlbumSongCell" customModule="Persephone" customModuleProvider="target">
<rect key="frame" x="0.0" y="594.5" width="414" height="43.5"/> <rect key="frame" x="0.0" y="594.5" width="414" height="43.5"/>
@ -186,9 +199,9 @@
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00:00" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bOC-cU-wMA"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00:00" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bOC-cU-wMA">
<rect key="frame" x="348" y="11.5" width="46" height="20.5"/> <rect key="frame" x="350.5" y="12" width="43.5" height="19.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/> <fontDescription key="fontDescription" type="system" pointSize="16"/>
<nil key="textColor"/> <color key="textColor" systemColor="secondaryLabelColor" red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0." lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wVS-im-RKW"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0." lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wVS-im-RKW">
@ -274,6 +287,8 @@
</scenes> </scenes>
<resources> <resources>
<image name="defaultCoverArt" width="128" height="128"/> <image name="defaultCoverArt" width="128" height="128"/>
<image name="playButtonLarge" width="22" height="22"/>
<image name="plus" catalog="system" width="128" height="113"/>
<image name="square.grid.2x2.fill" catalog="system" width="128" height="114"/> <image name="square.grid.2x2.fill" catalog="system" width="128" height="114"/>
</resources> </resources>
</document> </document>

View File

@ -0,0 +1,21 @@
//
// AlbumDiscCell.swift
// Persephone-iOS
//
// Created by Daniel Barber on 2020-3-31.
// Copyright © 2020 Dan Barber. All rights reserved.
//
import UIKit
class AlbumDiscCell: UITableViewCell {
var albumSongItem: AlbumSongItem?
func setSongItem(songItem: AlbumSongItem) {
albumSongItem = songItem
albumDisc.text = "Disc \(songItem.disc ?? "0")"
}
@IBOutlet var albumDisc: UILabel!
}

View File

@ -1,6 +1,6 @@
// //
// AlbumSongCell.swift // AlbumSongCell.swift
// Persephone // Persephone-iOS
// //
// Created by Daniel Barber on 2020-3-30. // Created by Daniel Barber on 2020-3-30.
// Copyright © 2020 Dan Barber. All rights reserved. // Copyright © 2020 Dan Barber. All rights reserved.
@ -14,8 +14,13 @@ class AlbumSongCell: UITableViewCell {
func setSongItem(songItem: AlbumSongItem) { func setSongItem(songItem: AlbumSongItem) {
albumSongItem = songItem albumSongItem = songItem
trackNumber.text = songItem.song?.trackNumber guard let song = songItem.song else { return }
songTitle.text = songItem.song?.title
songDuration.font = .timerFont
trackNumber.text = song.trackNumber
songTitle.text = song.title
songDuration.text = song.duration.formattedTime
} }
@IBOutlet var trackNumber: UILabel! @IBOutlet var trackNumber: UILabel!

View File

@ -96,25 +96,26 @@ class AlbumSongListViewController: UITableViewController {
) )
} }
@IBAction func playAlbumAction(_ sender: Any) {
guard let album = album else { return }
App.mpdClient.playAlbum(album.mpdAlbum)
}
func setAppearance() { func setAppearance() {
let darkMode = traitCollection.userInterfaceStyle == .dark let darkMode = traitCollection.userInterfaceStyle == .dark
albumCoverView.layer.borderColor = darkMode ? CGColor.albumBorderColorDark : CGColor.albumBorderColorLight albumCoverView.layer.borderColor = darkMode ? CGColor.albumBorderColorDark : CGColor.albumBorderColorLight
} }
// @IBAction func addAlbumToQueueAction(_ sender: Any) { @IBAction func playAlbumAction(_ sender: Any) {
// guard let album = album else { return } guard let album = album else { return }
//
// let queueLength = App.store.state.queueState.queue.count App.mpdClient.playAlbum(album.mpdAlbum)
// }
// App.mpdClient.addAlbumToQueue(album: album.mpdAlbum, at: queueLength)
// } @IBAction func addAlbumToQueueAction(_ sender: Any) {
guard let album = album else { return }
let queueLength = App.store.state.queueState.queue.count
App.mpdClient.addAlbumToQueue(album: album.mpdAlbum, at: queueLength)
}
@IBOutlet var addAlbumToQueueButton: UIButton! @IBOutlet var addAlbumToQueueButton: UIButton!
@IBOutlet var playAlbumButton: UIButton! @IBOutlet var playAlbumButton: UIButton!
@IBOutlet var albumTitle: UILabel! @IBOutlet var albumTitle: UILabel!

View File

@ -16,12 +16,25 @@ class AlbumTracksDataSource: NSObject, UITableViewDataSource {
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let albumSongCell = tableView.dequeueReusableCell(withIdentifier: "albumSongCell") as? AlbumSongCell let albumSongItem = albumSongs[indexPath.row]
else { return AlbumSongCell() }
albumSongCell.setSongItem(songItem: albumSongs[indexPath.row]) if let song = albumSongItem.song {
guard let albumSongCell = tableView.dequeueReusableCell(withIdentifier: "albumSongCell") as? AlbumSongCell
else { return AlbumSongCell() }
return albumSongCell albumSongCell.setSongItem(songItem: albumSongItem)
return albumSongCell
} else if let disc = albumSongItem.disc {
guard let albumDiscCell = tableView.dequeueReusableCell(withIdentifier: "albumDiscCell") as? AlbumDiscCell
else { return AlbumDiscCell() }
albumDiscCell.setSongItem(songItem: albumSongItem)
return albumDiscCell
}
return UITableViewCell()
} }
func setAlbumSongs(_ songs: [Song]) { func setAlbumSongs(_ songs: [Song]) {

View File

@ -0,0 +1,13 @@
//
// UIFont.swift
// Persephone-iOS
//
// Created by Daniel Barber on 2020-3-31.
// Copyright © 2020 Dan Barber. All rights reserved.
//
import UIKit
extension UIFont {
static let timerFont = monospacedDigitSystemFont(ofSize: 16, weight: .regular)
}