Skip to content

Commit

Permalink
Merge pull request #30 from SentulAsia/develop
Browse files Browse the repository at this point in the history
done unit test for all public method
  • Loading branch information
ricardopereira authored Jun 2, 2019
2 parents da797d5 + df4cac4 commit fce59cf
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 48 deletions.
8 changes: 0 additions & 8 deletions ColiseuPlayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,6 @@
D788F7A819E69E5600C04099 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
Expand All @@ -422,10 +418,6 @@
D788F7A919E69E5600C04099 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
INFOPLIST_FILE = ColiseuPlayerTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "eu.ricardopereira.$(PRODUCT_NAME:rfc1034identifier)";
Expand Down
23 changes: 14 additions & 9 deletions ColiseuPlayer/ColiseuPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,14 @@ public protocol ColiseuPlayerDataSource: class
/// Specifies the repeat type of an audio player.
public enum ColiseuPlayerRepeat: Int
{
case none = 0, one, all
/// Represents will not repeat.
case none = 0

/// Represents will repeat once.
case one

/// Represents will always repeat.
case all
}

/// An audio player builder, to make it mockable by test
Expand Down Expand Up @@ -206,7 +213,7 @@ public class ColiseuPlayer: NSObject
return false
}

// MARK: - Init
// MARK: - Initializers

public override init()
{
Expand All @@ -226,7 +233,7 @@ public class ColiseuPlayer: NSObject

// MARK: - Session

/// Activates your app’s audio session using the specified options.
/// Activates your app’s audio session.
public func startSession()
{
do {
Expand All @@ -243,7 +250,7 @@ public class ColiseuPlayer: NSObject
}
}

/// Deactivates your app’s audio session using the specified options.
/// Deactivates your app’s audio session.
public func stopSession()
{
do {
Expand Down Expand Up @@ -389,11 +396,9 @@ public class ColiseuPlayer: NSObject
/// Stops playback and undoes the setup needed for playback.
public func stopSong()
{
if self.audioPlayer == nil || !self.isPlaying {
return
}
guard let audioPlayer = self.audioPlayer, self.isPlaying else { return }

self.audioPlayer!.stop()
audioPlayer.stop()
if let event = self.playerDidStop {
event()
}
Expand Down Expand Up @@ -442,7 +447,7 @@ public class ColiseuPlayer: NSObject
}

// MARK: - ColiseuPlayerDelegate

/// Tells the object when a remote-control event is received.
///
/// - Parameter event: An event object encapsulating a remote-control command. Remote-control events have a type of UIEvent.EventType.remoteControl.
Expand Down
Loading

0 comments on commit fce59cf

Please sign in to comment.