Skip to content

Commit

Permalink
♻️ 리뷰 사항 반영1
Browse files Browse the repository at this point in the history
인환님 리뷰 사항 반영
  • Loading branch information
chopmozzi committed Dec 10, 2023
1 parent 5737a24 commit 48d2a7a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 29 deletions.
2 changes: 1 addition & 1 deletion iOS/Layover/Layover/DesignSystem/LODescriptionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import UIKit

final class LODescriptionView: UIView {
static let descriptionWidth: CGFloat = 104
static let descriptionWidth: CGFloat = 170
static let descriptionHeight: CGFloat = 63

// MARK: - View isTouched State
Expand Down
56 changes: 33 additions & 23 deletions iOS/Layover/Layover/Scenes/Playback/PlaybackInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -227,30 +227,40 @@ final class PlaybackInteractor: PlaybackBusinessLogic, PlaybackDataStore {
}

private func transPostToVideo(_ posts: [Post]) async -> [Models.PlaybackVideo] {
var videos: [Models.PlaybackVideo] = []
for post in posts {
guard let videoURL: URL = post.board.videoURL else { continue }
var imageData: Data?
if let url: URL = post.member.profileImageURL {
imageData = await userWorker?.fetchImageData(with: url)
return await withTaskGroup(of: Models.PlaybackVideo.self) { group -> [Models.PlaybackVideo] in
for post in posts {
guard let videoURL: URL = post.board.videoURL else { continue }
if let thumbnailImageURL = post.board.thumbnailImageURL {
group.addTask {
var profileImageData: Data?
let thumbnailImageData = await self.userWorker?.fetchImageData(with: thumbnailImageURL)
if let profileImageURL = post.member.profileImageURL {
profileImageData = await self.userWorker?.fetchImageData(with: profileImageURL)
}
let location: String? = await self.worker?.transLocation(latitude: post.board.latitude, longitude: post.board.longitude)
return Models.PlaybackVideo(
displayPost: Models.DisplayPost(
member: Models.Member(
memberID: post.member.identifier,
username: post.member.username,
profileImageData: profileImageData),
board: Models.Board(
boardID: post.board.identifier,
title: post.board.title,
description: post.board.description,
thumbnailImageData: thumbnailImageData,
videoURL: videoURL,
location: location),
tags: post.tag))
}
}
}
let location: String? = await worker?.transLocation(latitude: post.board.latitude, longitude: post.board.longitude)
videos.append(Models.PlaybackVideo(
displayPost: Models.DisplayPost(
member: Models.Member(
memberID: post.member.identifier,
username: post.member.username,
profileImageData: imageData),
board: Models.Board(
boardID: post.board.identifier,
title: post.board.title,
description: post.board.description,
// TODO: thumbnail관련 로직이 변경된다면 같이 변경
thumbnailImageURL: post.board.thumbnailImageURL,
vidieoURL: videoURL,
location: location),
tags: post.tag)))
var result = [Models.PlaybackVideo]()
for await post in group {
result.append(post)
}

return result
}
return videos
}
}
4 changes: 2 additions & 2 deletions iOS/Layover/Layover/Scenes/Playback/PlaybackModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ enum PlaybackModels {
let boardID: Int
let title: String
let description: String?
let thumbnailImageURL: URL?
let vidieoURL: URL
let thumbnailImageData: Data?
let videoURL: URL
let location: String?
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ extension PlaybackViewController: PlaybackDisplayLogic {
return cell
}
}
cell.addAVPlayer(url: playbackVideo.displayPost.board.vidieoURL)
cell.addAVPlayer(url: playbackVideo.displayPost.board.videoURL)
return cell
}
}
Expand Down
4 changes: 2 additions & 2 deletions iOS/Layover/Layover/Scenes/Playback/PlaybackWorker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ final class PlaybackWorker: PlaybackWorkerProtocol {
func transLocation(latitude: Double, longitude: Double) async -> String? {
let findLocation: CLLocation = CLLocation(latitude: latitude, longitude: longitude)
let geoCoder: CLGeocoder = CLGeocoder()
let local: Locale = Locale(identifier: "Ko-kr")

let identifier = Locale.current.identifier == "en_KR" ? "ko_kr" : Locale.current.identifier
let local: Locale = Locale(identifier: identifier)
do {
let place = try await geoCoder.reverseGeocodeLocation(findLocation, preferredLocale: local)
return place.last?.administrativeArea
Expand Down

0 comments on commit 48d2a7a

Please sign in to comment.