diff --git a/.travis.yml b/.travis.yml index b189cf4..1f50e82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,2 @@ language: objective-c osx_image: xcode7.1 - -script: xctool -workspace MobilePlayer.xcworkspace -scheme MobilePlayer build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO diff --git a/MobilePlayer.xcodeproj/project.pbxproj b/MobilePlayer.xcodeproj/project.pbxproj index 902162d..9d9233a 100644 --- a/MobilePlayer.xcodeproj/project.pbxproj +++ b/MobilePlayer.xcodeproj/project.pbxproj @@ -56,7 +56,6 @@ C361643D1B6725C2000CE00E /* Hulu.json in Resources */ = {isa = PBXBuildFile; fileRef = C361643C1B6725C2000CE00E /* Hulu.json */; }; C36164411B673D04000CE00E /* Netflix.json in Resources */ = {isa = PBXBuildFile; fileRef = C36164401B673D04000CE00E /* Netflix.json */; }; C38833C91B266C2500918C94 /* Skin.json in Resources */ = {isa = PBXBuildFile; fileRef = C38833C81B266C2500918C94 /* Skin.json */; }; - C38BEEA61B72DBD1009E4F64 /* PlayerStateTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38BEEA51B72DBD1009E4F64 /* PlayerStateTest.swift */; }; C38FA6511B33279600BE17E8 /* ADBannerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38FA6501B33279600BE17E8 /* ADBannerViewController.swift */; }; C38FA6531B33530C00BE17E8 /* PreRollViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38FA6521B33530C00BE17E8 /* PreRollViewController.swift */; }; C39C749F1B75400700E6CD21 /* KIF.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C39C749E1B75400700E6CD21 /* KIF.framework */; }; @@ -176,7 +175,6 @@ C361643C1B6725C2000CE00E /* Hulu.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Hulu.json; sourceTree = ""; }; C36164401B673D04000CE00E /* Netflix.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Netflix.json; sourceTree = ""; }; C38833C81B266C2500918C94 /* Skin.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Skin.json; sourceTree = ""; }; - C38BEEA51B72DBD1009E4F64 /* PlayerStateTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayerStateTest.swift; sourceTree = ""; }; C38FA6501B33279600BE17E8 /* ADBannerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ADBannerViewController.swift; sourceTree = ""; }; C38FA6521B33530C00BE17E8 /* PreRollViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreRollViewController.swift; sourceTree = ""; }; C39C749E1B75400700E6CD21 /* KIF.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = KIF.framework; path = "Pods/../build/Debug-iphoneos/KIF.framework"; sourceTree = ""; }; @@ -431,7 +429,6 @@ children = ( C3A406AC1B27A8DE00D1833D /* YoutubeTests.swift */, C35497A21B70007500FDDBFF /* SkinTests.swift */, - C38BEEA51B72DBD1009E4F64 /* PlayerStateTest.swift */, CE554D5F1AFE6CCD00DAC7E9 /* Supporting Files */, ); path = MobilePlayerTests; @@ -544,12 +541,9 @@ isa = PBXNativeTarget; buildConfigurationList = CE554D681AFE6CCD00DAC7E9 /* Build configuration list for PBXNativeTarget "MobilePlayerTests" */; buildPhases = ( - 39BE5A6F582542962733FA2B /* Check Pods Manifest.lock */, CE554D561AFE6CCD00DAC7E9 /* Sources */, CE554D571AFE6CCD00DAC7E9 /* Frameworks */, CE554D581AFE6CCD00DAC7E9 /* Resources */, - F40C37578BF721D3E7447872 /* Embed Pods Frameworks */, - 34FBA218D2E9EFA476A8CB14 /* Copy Pods Resources */, ); buildRules = ( ); @@ -668,54 +662,6 @@ }; /* End PBXResourcesBuildPhase section */ -/* Begin PBXShellScriptBuildPhase section */ - 34FBA218D2E9EFA476A8CB14 /* Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MobilePlayerTests/Pods-MobilePlayerTests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 39BE5A6F582542962733FA2B /* Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - F40C37578BF721D3E7447872 /* Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MobilePlayerTests/Pods-MobilePlayerTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - /* Begin PBXSourcesBuildPhase section */ C3A9AED51B048B5600D0C842 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -774,7 +720,6 @@ files = ( C3A406B01B27AA9500D1833D /* UIColor+Hex.swift in Sources */, C35497A31B70007500FDDBFF /* SkinTests.swift in Sources */, - C38BEEA61B72DBD1009E4F64 /* PlayerStateTest.swift in Sources */, C3A406AD1B27A8DE00D1833D /* YoutubeTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/MobilePlayer.xcworkspace/contents.xcworkspacedata b/MobilePlayer.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index aecda38..0000000 --- a/MobilePlayer.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/MobilePlayer/Extensions/UIImage+CocoaPods.swift b/MobilePlayer/Extensions/UIImage+CocoaPods.swift index 12320c3..833a071 100644 --- a/MobilePlayer/Extensions/UIImage+CocoaPods.swift +++ b/MobilePlayer/Extensions/UIImage+CocoaPods.swift @@ -11,7 +11,9 @@ import UIKit extension UIImage { convenience init?(podResourceNamed name: String) { - let bundleUrl = NSBundle(forClass: MobilePlayerViewController.self).URLForResource("MobilePlayer", withExtension: "bundle")! + let bundleUrl = + NSBundle(forClass: MobilePlayerViewController.self).URLForResource("MobilePlayer", withExtension: "bundle") ?? + NSBundle(forClass: MobilePlayerViewController.self).bundleURL let bundle = NSBundle(URL: bundleUrl) self.init(named: name, inBundle: bundle, compatibleWithTraitCollection:nil) } diff --git a/MobilePlayer/Views/MobilePlayerControlsView.swift b/MobilePlayer/Views/MobilePlayerControlsView.swift index 3ba0a3c..ec125ab 100644 --- a/MobilePlayer/Views/MobilePlayerControlsView.swift +++ b/MobilePlayer/Views/MobilePlayerControlsView.swift @@ -38,16 +38,16 @@ final class MobilePlayerControlsView: UIView { addSubview(activityIndicatorView) addSubview(overlayContainerView) if topBar.elements.count == 0 { - topBar.addElementUsingConfig(ElementConfig(dictionary: ["type": "button", "identifier": "close"])) - topBar.addElementUsingConfig(ElementConfig(dictionary: ["type": "label", "identifier": "title"])) - topBar.addElementUsingConfig(ElementConfig(dictionary: ["type": "button", "identifier": "action"])) + topBar.addElementUsingConfig(ButtonConfig(dictionary: ["type": "button", "identifier": "close"])) + topBar.addElementUsingConfig(LabelConfig(dictionary: ["type": "label", "identifier": "title"])) + topBar.addElementUsingConfig(ButtonConfig(dictionary: ["type": "button", "identifier": "action"])) } addSubview(topBar) if bottomBar.elements.count == 0 { - bottomBar.addElementUsingConfig(ElementConfig(dictionary: ["type": "toggleButton", "identifier": "play"])) - bottomBar.addElementUsingConfig(ElementConfig(dictionary: ["type": "label", "identifier": "currentTime"])) - bottomBar.addElementUsingConfig(ElementConfig(dictionary: ["type": "slider", "identifier": "playback"])) - bottomBar.addElementUsingConfig(ElementConfig(dictionary: ["type": "label", "identifier": "duration"])) + bottomBar.addElementUsingConfig(ToggleButtonConfig(dictionary: ["type": "toggleButton", "identifier": "play"])) + bottomBar.addElementUsingConfig(LabelConfig(dictionary: ["type": "label", "identifier": "currentTime"])) + bottomBar.addElementUsingConfig(SliderConfig(dictionary: ["type": "slider", "identifier": "playback"])) + bottomBar.addElementUsingConfig(LabelConfig(dictionary: ["type": "label", "identifier": "duration"])) } addSubview(bottomBar) } diff --git a/MobilePlayerTests/PlayerStateTest.swift b/MobilePlayerTests/PlayerStateTest.swift deleted file mode 100644 index a93e069..0000000 --- a/MobilePlayerTests/PlayerStateTest.swift +++ /dev/null @@ -1,121 +0,0 @@ -// -// PlayerStateTest.swift -// MobilePlayer -// -// Created by Toygar Dündaralp on 8/5/15. -// Copyright (c) 2015 MovieLaLa. All rights reserved. -// - -import UIKit -import MobilePlayer -import KIF - -class PlayerStateTest: KIFTestCase { - var tester: KIFUITestActor { - get { - return KIFUITestActor(inFile: __FILE__, atLine: __LINE__, delegate: self) - } - } - - override func setUp() { - super.setUp() - } - - override func tearDown() { - super.tearDown() - } - - override func beforeEach() { } - - override func afterEach() { } - - #if DEBUG - - func testloadingStateTest() { - let expectation: XCTestExpectation = expectationWithDescription("LoadingState") - expectation.fulfill() - if let player: UILabel = tester.waitForViewWithAccessibilityLabel("PlayerState") as? UILabel { - tester.waitForTimeInterval(1.5) - if let str = player.text as String? { - let items = componentsWithString(str) - var state = items.first?.toInt() - var previousState = items.last?.toInt() - if let previousState = previousState as Int? { - XCTAssertEqual(previousState, 6, "Not changed loading state") - seekingForwardTest() - } - } - } - } - - func seekingForwardTest() { - let expectation: XCTestExpectation = expectationWithDescription("ForwardState") - expectation.fulfill() - tester.waitForTimeInterval(0.01) - tester.tapViewWithAccessibilityLabel("Play") // playing - tester.swipeViewWithAccessibilityLabel("Thumb", inDirection: KIFSwipeDirection.Right) - if let player: UILabel = tester.waitForViewWithAccessibilityLabel("PlayerState") as? UILabel { - if let str = player.text as String? { - let items = componentsWithString(str) - var state = items.first?.toInt() - var previousState = items.last?.toInt() - if let previousState = previousState as Int? { - XCTAssertEqual(previousState, 10, "Not changed forward seeking state") - seekingBackwardTest() - } - } - } - } - - func seekingBackwardTest() { - let expectation: XCTestExpectation = expectationWithDescription("BackwardState") - expectation.fulfill() - tester.waitForTimeInterval(1) - tester.swipeViewWithAccessibilityLabel("Thumb", inDirection: KIFSwipeDirection.Left) - if let player: UILabel = tester.waitForViewWithAccessibilityLabel("PlayerState") as? UILabel { - if let str = player.text as String? { - let items = componentsWithString(str) - var state = items.first?.toInt() - var previousState = items.last?.toInt() - if let previousState = previousState as Int? { - XCTAssertEqual(previousState, 2, "Not changed backward seeking state") - playPauseStateTests() - } - } - } - } - - func playPauseStateTests() { - let expectation: XCTestExpectation = expectationWithDescription("PlayAndPauseState") - expectation.fulfill() - if let player: UILabel = tester.waitForViewWithAccessibilityLabel("PlayerState") as? UILabel { - tester.tapViewWithAccessibilityLabel("Play") // playing - tester.waitForTimeInterval(1) - tester.tapViewWithAccessibilityLabel("Play") // paused - tester.waitForTimeInterval(1) - tester.tapViewWithAccessibilityLabel("Play") // playing - tester.waitForTimeInterval(1) - tester.tapViewWithAccessibilityLabel("Play") // paused - tester.waitForTimeInterval(1) - if let str = player.text as String? { - let items = componentsWithString(str) - var state = items.first?.toInt() - var previousState = items.last?.toInt() - if let state = state as Int? { - XCTAssertEqual(state, 4, "Not changed playing state") - } - if let previousState = previousState as Int? { - XCTAssertEqual(previousState, 3, "Not changed paused state") - } - } - } - waitForExpectationsWithTimeout(10, handler: nil) - } - - func componentsWithString(str: String) -> [String] { - return str.componentsSeparatedByString("-") as [String] - } - - #endif - -} diff --git a/Podfile b/Podfile deleted file mode 100644 index f3ac7d2..0000000 --- a/Podfile +++ /dev/null @@ -1,7 +0,0 @@ -platform :ios, '8.0' - -use_frameworks! - -target 'MobilePlayerTests', :exclusive => true do - pod 'KIF', '~> 3.0', :configurations => ['Debug'] -end diff --git a/Podfile.lock b/Podfile.lock deleted file mode 100644 index 18320dc..0000000 --- a/Podfile.lock +++ /dev/null @@ -1,12 +0,0 @@ -PODS: - - KIF (3.2.3): - - KIF/XCTest (= 3.2.3) - - KIF/XCTest (3.2.3) - -DEPENDENCIES: - - KIF (~> 3.0) - -SPEC CHECKSUMS: - KIF: a94bffe9c97e449e44f8fa481c53243d21309e1e - -COCOAPODS: 0.38.2