connect episode detail to listening history
MODIFY
Podcast/EpisodeDetailHeaderViewCell.swift
Podcast/EpisodeDetailHeaderViewCell.swift
@@ -75,8 +75,8 @@ class EpisodeDetailHeaderViewCell: UITableViewCell {
y: seriesTitleLabelYValue,
width: frame.width - marginSpacing - seriesTitleLabelXValue,
height: seriesTitleHeight))
- seriesTitleLabel.font = UIFont.boldSystemFont(ofSize: 16)
- seriesTitleLabel.textColor = UIColor.colorFromCode(0x4aaea9)
+ seriesTitleLabel.font = UIFont.boldSystemFont(ofSize: 20)
+ seriesTitleLabel.textColor = UIColor.colorFromCode(0x30303c)
addSubview(seriesTitleLabel)
publisherLabel = UILabel(frame: CGRect(x: publisherLabelXValue,
@@ -118,8 +118,8 @@ class EpisodeDetailHeaderViewCell: UITableViewCell {
addSubview(moreButton)
bookmarkButton = UIButton(frame: .zero)
- bookmarkButton.setImage(#imageLiteral(resourceName: "bookmark_unselected_icon"), for: .normal)
- bookmarkButton.setImage(#imageLiteral(resourceName: "bookmark_selected_icon"), for: .selected)
+ bookmarkButton.setImage(#imageLiteral(resourceName: "bookmark_feed_icon_unselected"), for: .normal)
+ bookmarkButton.setImage(#imageLiteral(resourceName: "bookmark_feed_icon_selected"), for: .selected)
bookmarkButton.addTarget(self, action: #selector(bookmarkButtonTapped), for: .touchUpInside)
addSubview(bookmarkButton)
@@ -184,14 +184,17 @@ class EpisodeDetailHeaderViewCell: UITableViewCell {
func bookmarkButtonTapped() {
delegate?.episodeDetailHeaderDidPressBookmarkButton(cell: self)
+ bookmarkButton.isSelected = !bookmarkButton.isSelected
}
func moreButtonTapped() {
delegate?.episodeDetailHeaderDidPressMoreButton(cell: self)
+ moreButton.isSelected = !moreButton.isSelected
}
func recommendedButtonTapped() {
delegate?.episodeDetailHeaderDidPressRecommendButton(cell: self)
+ recommendedButton.isSelected = !recommendedButton.isSelected
}
}

MODIFY
Podcast/EpisodeDetailViewController.swift
Podcast/EpisodeDetailViewController.swift
@@ -11,7 +11,7 @@ import UIKit
class EpisodeDetailViewController: UITableViewController, EpisodeDetailHeaderViewCellDelegate {
var episode: Episode?
var comments: [Comment] = Array.init(repeating: Comment(episodeId: "", creator: "Mark Bryan", text: "Great point here!!", creationDate: "5 months ago", time: "5:13"), count: 10)
- var episodeDetailViewHeaderHeight: CGFloat?
+ var episodeDetailViewHeaderHeight: CGFloat = 0
override func viewDidLoad() {
super.viewDidLoad()
@@ -32,20 +32,16 @@ class EpisodeDetailViewController: UITableViewController, EpisodeDetailHeaderVie
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- if indexPath.section == 0 {
- if let cell = tableView.dequeueReusableCell(withIdentifier: "EpisodeDetailHeaderViewCellIdentifier") as? EpisodeDetailHeaderViewCell, let episode = episode {
+ if indexPath.section == 0, let cell = tableView.dequeueReusableCell(withIdentifier: "EpisodeDetailHeaderViewCellIdentifier") as? EpisodeDetailHeaderViewCell, let episode = episode {
cell.setupForEpisode(episode: episode)
cell.delegate = self
cell.layoutSubviews()
episodeDetailViewHeaderHeight = cell.frame.height
return cell
- }
- } else {
- if let cell = tableView.dequeueReusableCell(withIdentifier: "CommentsTableViewCellIdentifier") as? CommentsTableViewCell {
+ } else if let cell = tableView.dequeueReusableCell(withIdentifier: "CommentsTableViewCellIdentifier") as? CommentsTableViewCell {
cell.setupForComment(comment: comments[indexPath.row])
return cell
}
- }
return UITableViewCell()
}
@@ -58,7 +54,7 @@ class EpisodeDetailViewController: UITableViewController, EpisodeDetailHeaderVie
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == 0 {
- return episodeDetailViewHeaderHeight ?? 0
+ return episodeDetailViewHeaderHeight
} else {
return CommentsTableViewCell.minimumHeight
}

MODIFY
Podcast/ListeningHistoryViewController.swift
Podcast/ListeningHistoryViewController.swift
@@ -61,9 +61,9 @@ class ListeningHistoryViewController: UIViewController, UITableViewDelegate, UIT
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
-// guard let cell = listeningHistoryTableView.cellForRow(at: indexPath) as? ListeningHistoryTableViewCell else { return }
-
- // Open Episode Detail View here
+ let episodeViewController = EpisodeDetailViewController()
+ episodeViewController.episode = episodes[indexPath.row]
+ navigationController?.pushViewController(episodeViewController, animated: true)
}

MODIFY
Podcast/MiniPlayerView.swift
Podcast/MiniPlayerView.swift
@@ -46,6 +46,7 @@ class MiniPlayerView: UIView {
arrowButton = UIButton(frame: CGRect(x: marginSpacing, y: arrowYValue, width: arrowWidth, height: arrowHeight))
arrowButton.setBackgroundImage(#imageLiteral(resourceName: "down_arrow_icon"), for: .normal)
+ arrowButton.addTarget(self, action: #selector(viewTapped), for: .touchUpInside)
addSubview(arrowButton)
playPauseButton = UIButton(frame: CGRect(x: frame.size.width - marginSpacing - buttonDimension, y: 17, width: buttonDimension, height: buttonDimension))

connect episode detail to listening history