Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
import WebRTC
import PhotoGetherDomainInterface
import Combine
import PhotoGetherDomainInterface

public final class ConnectionClientImpl: ConnectionClient {
private let signalingClient: SignalingClient
Expand Down Expand Up @@ -55,7 +55,7 @@ public final class ConnectionClientImpl: ConnectionClient {
}

// MARK: SignalingClientDelegate
extension ConnectionClientImpl {
extension ConnectionClientImpl: SignalingClientDelegate {
public func signalClientDidConnect(
_ signalingClient: SignalingClient
) {
Expand Down Expand Up @@ -95,7 +95,7 @@ extension ConnectionClientImpl {
}

// MARK: WebRTCClientDelegate
extension ConnectionClientImpl {
extension ConnectionClientImpl: WebRTCClientDelegate {
/// SDP 가 생성되면 LocalCandidate 가 생성되기 시작 (가능한 경로만큼 생성됨)
public func webRTCClient(
_ client: WebRTCClient,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Foundation
import PhotoGetherDomainInterface

public final class ConnectionRepositoryImpl: ConnectionRepository {
public var clients: [ConnectionClient]

public init(clients: [ConnectionClient]) {
self.clients = clients
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Foundation
import WebRTC
import PhotoGetherNetwork

public protocol SignalingClient: WebSocketClientDelegate {
var delegate: SignalingClientDelegate? { get set }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation
import WebRTC
import PhotoGetherDomainInterface
import PhotoGetherNetwork

final public class SignalingClientImpl: SignalingClient {
private let decoder = JSONDecoder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Foundation
import WebRTC
import PhotoGetherDomainInterface

public final class WebRTCClientImpl: NSObject, WebRTCClient {
private static let peerConnectionFactory: RTCPeerConnectionFactory = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import XCTest
import PhotoGetherDomainInterface
import PhotoGetherDomainTesting

final class CountClientsUseCaseTests: XCTestCase {
var sut: CountClientsUseCase!

func test_클라이언트_수를_잘_가져오는지() {
for count in 0..<10 {
sut = CountClientsUseCaseMock(clientCount: count)
XCTAssertEqual(sut.execute(), count)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
603C68CF2CEC51EC00BE7AF9 /* PhotoGetherDomain.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B5951872CDB647A00B89C85 /* PhotoGetherDomain.framework */; platformFilter = ios; };
603C68D52CEC529000BE7AF9 /* PhotoGetherDomainTesting.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B5951A72CDB64F800B89C85 /* PhotoGetherDomainTesting.framework */; platformFilter = ios; };
603C68D62CEC529000BE7AF9 /* PhotoGetherDomainTesting.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7B5951A72CDB64F800B89C85 /* PhotoGetherDomainTesting.framework */; platformFilter = ios; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
60B05BCF2CEDAEF500843377 /* PhotoGetherDomainInterface.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B59519A2CDB64E000B89C85 /* PhotoGetherDomainInterface.framework */; platformFilter = ios; };
60B05BD02CEDAEF500843377 /* PhotoGetherDomainInterface.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7B59519A2CDB64E000B89C85 /* PhotoGetherDomainInterface.framework */; platformFilter = ios; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
7B1745512CE35CD500E01D1A /* WebRTC in Frameworks */ = {isa = PBXBuildFile; productRef = 7B1745502CE35CD500E01D1A /* WebRTC */; };
7B5951BE2CDB655500B89C85 /* PhotoGetherDomainInterface.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B59519A2CDB64E000B89C85 /* PhotoGetherDomainInterface.framework */; };
7B5951BF2CDB655500B89C85 /* PhotoGetherDomainInterface.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7B59519A2CDB64E000B89C85 /* PhotoGetherDomainInterface.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
Expand All @@ -32,6 +34,13 @@
remoteGlobalIDString = 7B5951A62CDB64F800B89C85;
remoteInfo = PhotoGetherDomainTesting;
};
60B05BD12CEDAEF500843377 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 7B59517E2CDB647A00B89C85 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 7B5951992CDB64E000B89C85;
remoteInfo = PhotoGetherDomainInterface;
};
7B5951C02CDB655500B89C85 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 7B59517E2CDB647A00B89C85 /* Project object */;
Expand Down Expand Up @@ -60,6 +69,17 @@
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
60B05BD32CEDAEF500843377 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
60B05BD02CEDAEF500843377 /* PhotoGetherDomainInterface.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
7B5951C22CDB655500B89C85 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -88,6 +108,7 @@
05E553E92CDB9C4A00B70645 /* DomainUtility.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = DomainUtility.framework; sourceTree = BUILT_PRODUCTS_DIR; };
603C68C02CEC4C3400BE7AF9 /* DesignSystem.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = DesignSystem.framework; sourceTree = BUILT_PRODUCTS_DIR; };
603C68CB2CEC51EC00BE7AF9 /* FetchStickerListUseCaseTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FetchStickerListUseCaseTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
60B05BC52CEDAEE600843377 /* CountClientsUseCaseTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CountClientsUseCaseTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
7B5951872CDB647A00B89C85 /* PhotoGetherDomain.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PhotoGetherDomain.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7B59519A2CDB64E000B89C85 /* PhotoGetherDomainInterface.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PhotoGetherDomainInterface.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7B5951A72CDB64F800B89C85 /* PhotoGetherDomainTesting.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PhotoGetherDomainTesting.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -99,6 +120,11 @@
path = FetchStickerListUseCaseTests;
sourceTree = "<group>";
};
60B05BC62CEDAEE600843377 /* CountClientsUseCaseTests */ = {
isa = PBXFileSystemSynchronizedRootGroup;
path = CountClientsUseCaseTests;
sourceTree = "<group>";
};
7B1746352CE8E97000E01D1A /* PhotoGetherDomain */ = {
isa = PBXFileSystemSynchronizedRootGroup;
path = PhotoGetherDomain;
Expand Down Expand Up @@ -126,6 +152,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
60B05BC22CEDAEE600843377 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
60B05BCF2CEDAEF500843377 /* PhotoGetherDomainInterface.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
7B5951842CDB647A00B89C85 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -160,6 +194,7 @@
7B1746472CE8E97300E01D1A /* PhotoGetherDomainInterface */,
7B1746542CE8E97A00E01D1A /* PhotoGetherDomainTesting */,
603C68CC2CEC51EC00BE7AF9 /* FetchStickerListUseCaseTests */,
60B05BC62CEDAEE600843377 /* CountClientsUseCaseTests */,
7B5951BD2CDB655500B89C85 /* Frameworks */,
7B5951882CDB647A00B89C85 /* Products */,
);
Expand All @@ -172,6 +207,7 @@
7B59519A2CDB64E000B89C85 /* PhotoGetherDomainInterface.framework */,
7B5951A72CDB64F800B89C85 /* PhotoGetherDomainTesting.framework */,
603C68CB2CEC51EC00BE7AF9 /* FetchStickerListUseCaseTests.xctest */,
60B05BC52CEDAEE600843377 /* CountClientsUseCaseTests.xctest */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -237,6 +273,30 @@
productReference = 603C68CB2CEC51EC00BE7AF9 /* FetchStickerListUseCaseTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
60B05BC42CEDAEE600843377 /* CountClientsUseCaseTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 60B05BCC2CEDAEE600843377 /* Build configuration list for PBXNativeTarget "CountClientsUseCaseTests" */;
buildPhases = (
60B05BC12CEDAEE600843377 /* Sources */,
60B05BC22CEDAEE600843377 /* Frameworks */,
60B05BC32CEDAEE600843377 /* Resources */,
60B05BD32CEDAEF500843377 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
60B05BD22CEDAEF500843377 /* PBXTargetDependency */,
);
fileSystemSynchronizedGroups = (
60B05BC62CEDAEE600843377 /* CountClientsUseCaseTests */,
);
name = CountClientsUseCaseTests;
packageProductDependencies = (
);
productName = CountClientsUseCaseTests;
productReference = 60B05BC52CEDAEE600843377 /* CountClientsUseCaseTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
7B5951862CDB647A00B89C85 /* PhotoGetherDomain */ = {
isa = PBXNativeTarget;
buildConfigurationList = 7B59518D2CDB647A00B89C85 /* Build configuration list for PBXNativeTarget "PhotoGetherDomain" */;
Expand Down Expand Up @@ -324,6 +384,9 @@
603C68CA2CEC51EC00BE7AF9 = {
CreatedOnToolsVersion = 16.0;
};
60B05BC42CEDAEE600843377 = {
CreatedOnToolsVersion = 16.0;
};
7B5951862CDB647A00B89C85 = {
CreatedOnToolsVersion = 16.0;
};
Expand Down Expand Up @@ -358,6 +421,7 @@
7B5951992CDB64E000B89C85 /* PhotoGetherDomainInterface */,
7B5951A62CDB64F800B89C85 /* PhotoGetherDomainTesting */,
603C68CA2CEC51EC00BE7AF9 /* FetchStickerListUseCaseTests */,
60B05BC42CEDAEE600843377 /* CountClientsUseCaseTests */,
);
};
/* End PBXProject section */
Expand All @@ -370,6 +434,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
60B05BC32CEDAEE600843377 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
7B5951852CDB647A00B89C85 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -401,6 +472,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
60B05BC12CEDAEE600843377 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
7B5951832CDB647A00B89C85 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -437,6 +515,12 @@
target = 7B5951A62CDB64F800B89C85 /* PhotoGetherDomainTesting */;
targetProxy = 603C68D72CEC529000BE7AF9 /* PBXContainerItemProxy */;
};
60B05BD22CEDAEF500843377 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
platformFilter = ios;
target = 7B5951992CDB64E000B89C85 /* PhotoGetherDomainInterface */;
targetProxy = 60B05BD12CEDAEF500843377 /* PBXContainerItemProxy */;
};
7B5951C12CDB655500B89C85 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 7B5951992CDB64E000B89C85 /* PhotoGetherDomainInterface */;
Expand Down Expand Up @@ -492,6 +576,38 @@
};
name = Release;
};
60B05BCD2CEDAEE600843377 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = B3PWYBKFUK;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = kr.codesquad.boostcamp9.CountClientsUseCaseTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
60B05BCE2CEDAEE600843377 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = B3PWYBKFUK;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = kr.codesquad.boostcamp9.CountClientsUseCaseTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
7B59518E2CDB647A00B89C85 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
Expand Down Expand Up @@ -863,6 +979,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
60B05BCC2CEDAEE600843377 /* Build configuration list for PBXNativeTarget "CountClientsUseCaseTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
60B05BCD2CEDAEE600843377 /* Debug */,
60B05BCE2CEDAEE600843377 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
7B5951812CDB647A00B89C85 /* Build configuration list for PBXProject "PhotoGetherDomain" */ = {
isa = XCConfigurationList;
buildConfigurations = (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Foundation
import PhotoGetherDomainInterface

public final class CountClientsUseCaseImpl: CountClientsUseCase {
public func execute() -> Int { repository.clients.count }

private let repository: ConnectionRepository

init(repository: ConnectionRepository) {
self.repository = repository
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation
import WebRTC
import Combine

public protocol ConnectionClient: SignalingClientDelegate, WebRTCClientDelegate {
public protocol ConnectionClient {
var remoteVideoView: UIView { get }
var localVideoView: UIView { get }

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

public protocol ConnectionRepository {
var clients: [ConnectionClient] { get }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

public protocol CountClientsUseCase {
func execute() -> Int
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import UIKit
import Combine
import PhotoGetherDomainInterface

public final class ConnectionClientMock: ConnectionClient {
public var remoteVideoView: UIView = UIView()

public var localVideoView: UIView = UIView()

public var receivedDataPublisher: PassthroughSubject<Data, Never> = PassthroughSubject()

public func sendOffer() { }

public func sendData(data: Data) { }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Foundation
import PhotoGetherDomainInterface

public final class ConnectionRepositoryMock: ConnectionRepository {
public var clients: [ConnectionClient] = []

public init(count: Int) {
for _ in 0..<count {
self.clients.append(ConnectionClientMock())
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Foundation
import PhotoGetherDomainInterface

public final class CountClientsUseCaseMock: CountClientsUseCase {
public func execute() -> Int { repository.clients.count }

public init(clientCount: Int) {
self.repository = ConnectionRepositoryMock(count: clientCount)
}

private let repository: ConnectionRepository
}
Loading
Loading