Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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,24 +1,53 @@
import UIKit
import PhotoGetherDomainInterface
import DesignSystem

public final class CaptureVideosUseCaseImpl: CaptureVideosUseCase {
public func execute() -> [UIImage] {
guard let localImage = connectionRepository.capturedLocalVideo
else { return [
PTGImage.temp1.image,
PTGImage.temp2.image,
PTGImage.temp3.image,
PTGImage.temp4.image]
Comment on lines -9 to -12
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

디자인 시스템 의존성이 있을텐데 지워주시면 좋을것 같습니다 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6b6d7f4 오 감사합니다!!! 수정했습니다!

}
let remoteImages = connectionRepository.clients.map { $0.captureVideo() }
let localImage = connectionRepository.capturedLocalVideo ?? UIImage()

let localUserImageInfo = [(connectionRepository.localUserInfo?.viewPosition, localImage)]
let remoteUserImagesInfo = connectionRepository.clients
.map { ($0.remoteUserInfo?.viewPosition, $0.captureVideo()) }

return [localImage] + remoteImages
return sortImages(localUserImageInfo + remoteUserImagesInfo)
}

private let connectionRepository: ConnectionRepository

public init(connectionRepository: ConnectionRepository) {
self.connectionRepository = connectionRepository
}

private func sortImages(_ images: [(viewPosition: UserInfo.ViewPosition?, image: UIImage)]) -> [UIImage] {
let convertedArray = images.map {
(position: PositionOder(rawValue: $0.viewPosition?.rawValue ?? -1),
image: $0.image)
}

// 배열의 2번 인덱스가 마지막 자리이기 때문에 nil일 경우 2로 설정했습니다
let sortedByViewPosition = convertedArray.sorted {
let lhs = $0.position?.sequence ?? 2
let rhs = $1.position?.sequence ?? 2
return lhs < rhs
}

return sortedByViewPosition.map { $0.image }
}
}

/// case의 순서는 참가자의 참가 순서에 따른 화면 배치이고 sequence는 이미지 데이터 전달할 때의 배열 순서입니다
private enum PositionOder: Int {
case topLeading
case bottomTrailing
case topTrailing
case bottomLeading

var sequence: Int {
switch self {
case .topLeading: 0
case .topTrailing: 1
case .bottomLeading: 2
case .bottomTrailing: 3
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ final class PhotoRoomBottomView: UIView {
func stopCameraButtonTimer() {
cameraButton.stopTimer()
}

func highlightCameraButton() {
cameraButton.layer.borderColor = PTGColor.primaryGreen.color.cgColor
}
}

extension PhotoRoomBottomView {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public final class PhotoRoomViewController: BaseViewController, ViewControllerCo
switch $0 {
case .timer(let count):
self.photoRoomBottomView.setCameraButtonTimer(count)
self.photoRoomBottomView.highlightCameraButton()
case .timerCompleted(let images, let userInfo):
self.photoRoomBottomView.stopCameraButtonTimer()

Expand Down