Skip to content

Commit

Permalink
RC-38: merged dev to RC-38
Browse files Browse the repository at this point in the history
  • Loading branch information
James Park authored and James Park committed Nov 6, 2016
1 parent bfaee7e commit b68c3c3
Show file tree
Hide file tree
Showing 20 changed files with 375 additions and 232 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ xcode_project: RocketCast.xcodeproj
xcode_scheme: RocketCast
xcode_sdk: iphonesimulator10.0
script:
- xcodebuild -project RocketCast.xcodeproj -scheme RocketCast -sdk iphonesimulator
- xcodebuild -project RocketCast.xcodeproj -scheme RocketCast -sdk iphonesimulator
- xcodebuild test -project RocketCast.xcodeproj -scheme RocketCastTests -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.0'
- xcodebuild test -project RocketCast.xcodeproj -scheme "RocketCastUITests" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.0'
notifications:
slack: ubclaunchpad:9yrC0XnC8DqCSlAJbLewhEPG
14 changes: 9 additions & 5 deletions RocketCast.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@
children = (
D00F6C8E1DC8468C00C3B2A4 /* PodcastModel */,
D00F6C8F1DC8469500C3B2A4 /* EpisodeModel */,
D05CC4D11D791D2F009C4B19 /* ModelBridge.swift */,
D03CB6ED1DC8680300819865 /* AudioEpisodeTracker.swift */,
C8D601A61D793E05003512FE /* Log.swift */,
D03CB6ED1DC8680300819865 /* AudioEpisodeTracker.swift */,
D05CC4D11D791D2F009C4B19 /* ModelBridge.swift */,
Expand Down Expand Up @@ -431,7 +433,7 @@
TargetAttributes = {
C80FAE6A1D72376600C806C1 = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = L822HFXC5L;
DevelopmentTeam = 69C5F6WEA5;
LastSwiftMigration = 0810;
SystemCapabilities = {
com.apple.BackgroundModes = {
Expand Down Expand Up @@ -694,14 +696,15 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = L822HFXC5L;
DEVELOPMENT_TEAM = 69C5F6WEA5;
INFOPLIST_FILE = RocketCast/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ubclaunchpad.RocketCast;
PRODUCT_BUNDLE_IDENTIFIER = rocketCast;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
};
Expand All @@ -711,13 +714,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = L822HFXC5L;
DEVELOPMENT_TEAM = 69C5F6WEA5;
INFOPLIST_FILE = RocketCast/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ubclaunchpad.RocketCast;
PRODUCT_BUNDLE_IDENTIFIER = rocketCast;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
};
Expand Down
4 changes: 3 additions & 1 deletion RocketCast/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<connections>
<segue destination="mE7-6p-V3x" kind="show" identifier="segueFromPodcastToEpisode" id="sPe-Yf-iBH"/>
<segue destination="qYa-7O-Oef" kind="show" identifier="segueFromPodcastListToAddUrl" id="uDr-br-kDS"/>
<segue destination="8h2-9e-1cc" kind="show" identifier="segueFromPodcastListToPlayer" id="7qt-w5-QPL"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
Expand All @@ -69,7 +70,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="xiD-Kp-hFf" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1876" y="442.12893553223392"/>
<point key="canvasLocation" x="1959" y="386"/>
</scene>
<!--Player-->
<scene sceneID="kRq-P8-ljN">
Expand Down Expand Up @@ -113,5 +114,6 @@
</scenes>
<inferredMetricsTieBreakers>
<segue reference="sPe-Yf-iBH"/>
<segue reference="7qt-w5-QPL"/>
</inferredMetricsTieBreakers>
</document>
1 change: 1 addition & 0 deletions RocketCast/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ enum Segues {
static let segueToBackEpisodes = "segueToBackEpisodes"
static let segueFromAddUrlToPodcastList = "segueFromAddUrlToPodcastList"
static let segueFromPodcastListToAddUrl = "segueFromPodcastListToAddUrl"
static let segueFromPodcastListToPlayer = "segueFromPodcastListToPlayer"
}

enum EpisodeViewConstants {
Expand Down
55 changes: 46 additions & 9 deletions RocketCast/EpisodeController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,24 @@ class EpisodeController: UIViewController {
var podcastTitle = ""
var shouldReloadNewEpisodeTrack = true
var mainView: EpisodeView?
override func viewDidLoad() {
super.viewDidLoad()
setupView()

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(true)
if AudioEpisodeTracker.isPlaying {
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .play, target: self, action: #selector(segueToPlayer) )
}
setupView()
}

fileprivate func setupView() {
let viewSize = CGRect(x: 0, y: 0, width: view.bounds.width, height: view.bounds.height)
mainView = EpisodeView.instancefromNib(viewSize)
if (shouldReloadNewEpisodeTrack) {
AudioEpisodeTracker.currentEpisodesInTrack = episodesInPodcast
}
}

mainView?.episodesToView = AudioEpisodeTracker.currentEpisodesInTrack

view.addSubview(mainView!)
self.mainView?.viewDelegate = self
}
Expand All @@ -51,20 +57,51 @@ class EpisodeController: UIViewController {
AudioEpisodeTracker.isPlaying = false
} else if AudioEpisodeTracker.episodeIndex == sendIndex {
AudioEpisodeTracker.isPlaying = true

}
}
}
}
}

extension EpisodeController: EpisodeViewDelegate{
extension EpisodeController: EpisodeViewDelegate, EpisodeViewTableViewCellDelegate{
func segueToPlayer () {
performSegue(withIdentifier: Segues.segueFromEpisodeToPlayer, sender: self)
}

func setSelectedEpisode (selectedEpisode: Episode, index: Int) {
performSegue(withIdentifier: Segues.segueFromEpisodeToPlayer, sender: index)
func setSelectedEpisode(selectedEpisode: Episode, index: Int, indexPathForEpisode: IndexPath) {
guard selectedEpisode.doucmentaudioURL == nil else {
performSegue(withIdentifier: Segues.segueFromEpisodeToPlayer, sender: index)
return
}

guard let episodeCell = self.mainView?.EpisodeTable.cellForRow(at: indexPathForEpisode) as? EpisodeViewTableViewCell else {
return
}
episodeCell.downloadAnimation.isHidden = false
episodeCell.downloadAnimation.startAnimating()
episodeCell.downloadStatus.text = "Downloading ..."
ModelBridge.sharedInstance.downloadAudio((selectedEpisode.audioURL)!, result: { (downloadedPodcast) in

guard downloadedPodcast != nil else {
DispatchQueue.main.async {
print("DOWNLOAD ERRRRROOOOORRRRRRRRR")
episodeCell.downloadAnimation.isHidden = true
episodeCell.downloadStatus.text = "Failed To Download"
}
return
}

let episode = DatabaseController.getEpisode((selectedEpisode.title)!)
episode?.setValue(downloadedPodcast!, forKey: "doucmentaudioURL")
DatabaseController.saveContext()
print("DONE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
DispatchQueue.main.async {
episodeCell.downloadAnimation.stopAnimating()
episodeCell.downloadStatus.text = "Downloaded"
episodeCell.downloadAnimation.isHidden = true
episodeCell.downloadStatus.isHidden = true
episodeCell.accessoryType = .checkmark
}
})
}

}
13 changes: 12 additions & 1 deletion RocketCast/EpisodeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ class EpisodeView: UIView, UITableViewDelegate, UITableViewDataSource {
cell.episodeHeader.text = episodesToView[indexPath.row].title
cell.tag = (indexPath as NSIndexPath).row
cell.selectionStyle = UITableViewCellSelectionStyle.none
if episodesToView[indexPath.row].doucmentaudioURL != nil {
cell.downloadAnimation.isHidden = true
cell.accessoryType = .checkmark
cell.downloadStatus.isHidden = true
} else {
cell.downloadStatus.isHidden = false
cell.accessoryType = .none
}

return cell

}
Expand All @@ -66,8 +75,10 @@ class EpisodeView: UIView, UITableViewDelegate, UITableViewDataSource {
}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
viewDelegate?.setSelectedEpisode(selectedEpisode: episodesToView[indexPath.row], index: indexPath.row)
viewDelegate?.setSelectedEpisode(selectedEpisode: episodesToView[indexPath.row], index: indexPath.row, indexPathForEpisode: indexPath)

}


}

2 changes: 1 addition & 1 deletion RocketCast/EpisodeViewDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import Foundation

protocol EpisodeViewDelegate {
func segueToPlayer()
func setSelectedEpisode(selectedEpisode: Episode, index:Int)
func setSelectedEpisode(selectedEpisode: Episode, index:Int, indexPathForEpisode: IndexPath)

}
4 changes: 4 additions & 0 deletions RocketCast/EpisodeViewTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
import UIKit

protocol EpisodeViewTableViewCellDelegate{
// func updateAnimation()
}

class EpisodeViewTableViewCell: UITableViewCell {
@IBOutlet weak var episodeHeader: UILabel!
@IBOutlet weak var downloadAnimation: UIActivityIndicatorView!

@IBOutlet weak var downloadStatus: UILabel!
var delegate: EpisodeViewTableViewCellDelegate?

override func awakeFromNib() {
Expand Down
44 changes: 34 additions & 10 deletions RocketCast/EpisodeViewTableViewCell.xib
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,48 @@
<frame key="frameInset" width="518" height="67"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="u0a-an-CCo">
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="sL9-vy-bYe">
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="u0a-an-CCo">
<frame key="frameInset" width="461" height="55"/>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="450" ambiguous="YES" text="Tap to Download" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VaN-2Q-2vL">
<frame key="frameInset" minY="55" width="461" height="12"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="VaN-2Q-2vL" firstAttribute="top" secondItem="u0a-an-CCo" secondAttribute="bottom" id="Gco-Cz-727"/>
<constraint firstItem="u0a-an-CCo" firstAttribute="top" secondItem="sL9-vy-bYe" secondAttribute="top" id="Qdd-Qu-KTd"/>
<constraint firstItem="u0a-an-CCo" firstAttribute="leading" secondItem="sL9-vy-bYe" secondAttribute="leading" id="da6-Cl-jSU"/>
<constraint firstItem="VaN-2Q-2vL" firstAttribute="leading" secondItem="u0a-an-CCo" secondAttribute="leading" id="dqk-Mn-7NR"/>
<constraint firstAttribute="trailing" secondItem="u0a-an-CCo" secondAttribute="trailing" id="zfx-lc-Oqa"/>
</constraints>
</stackView>
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="MWe-Gy-G4L"/>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="bottomMargin" secondItem="u0a-an-CCo" secondAttribute="bottom" id="8Gu-nW-Ee7"/>
<constraint firstAttribute="trailingMargin" secondItem="u0a-an-CCo" secondAttribute="trailing" id="f5x-kR-etb"/>
<constraint firstItem="u0a-an-CCo" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" id="hUy-4a-I0E"/>
<constraint firstItem="u0a-an-CCo" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" id="swL-hR-rt8"/>
<constraint firstItem="MWe-Gy-G4L" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" constant="15" id="0ME-Zt-Fxs"/>
<constraint firstItem="MWe-Gy-G4L" firstAttribute="leading" secondItem="sL9-vy-bYe" secondAttribute="trailing" constant="20" id="DPo-PM-gqF"/>
<constraint firstAttribute="trailingMargin" secondItem="MWe-Gy-G4L" secondAttribute="trailing" constant="9" id="Hwf-Jx-d2C"/>
<constraint firstItem="sL9-vy-bYe" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="cnd-YB-a7c"/>
<constraint firstAttribute="bottom" secondItem="sL9-vy-bYe" secondAttribute="bottom" id="gwn-wH-9ms"/>
<constraint firstAttribute="bottomMargin" secondItem="MWe-Gy-G4L" secondAttribute="bottom" constant="16" id="qyD-v4-JDH"/>
<constraint firstItem="sL9-vy-bYe" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="1" id="rMy-0r-G2W"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="downloadAnimation" destination="MWe-Gy-G4L" id="5rh-ij-Pa5"/>
<outlet property="downloadStatus" destination="VaN-2Q-2vL" id="RY6-CV-dKx"/>
<outlet property="episodeHeader" destination="u0a-an-CCo" id="SEs-hQ-2RJ"/>
</connections>
<point key="canvasLocation" x="-17" y="174"/>
<point key="canvasLocation" x="-356" y="175"/>
</tableViewCell>
</objects>
</document>
Loading

0 comments on commit b68c3c3

Please sign in to comment.