Skip to content

Commit

Permalink
🔧 모델 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
chopmozzi committed Nov 30, 2023
1 parent 4c84266 commit 2b9ce5d
Show file tree
Hide file tree
Showing 17 changed files with 151 additions and 122 deletions.
2 changes: 1 addition & 1 deletion iOS/Layover/Layover/Models/Board.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

struct Board {
struct Board: Hashable {
let identifier: Int
let title: String
let description: String?
Expand Down
2 changes: 1 addition & 1 deletion iOS/Layover/Layover/Models/Member.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

struct Member {
struct Member: Hashable {
let identifier: Int
let username: String
let introduce: String
Expand Down
2 changes: 1 addition & 1 deletion iOS/Layover/Layover/Models/Post.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

struct Post {
struct Post: Hashable {
let member: Member
let board: Board
let tag: [String]
Expand Down
2 changes: 1 addition & 1 deletion iOS/Layover/Layover/Network/DTOs/MemberDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

struct MemberDTO: Decodable {
struct MemberDTO: Codable {
let id: Int
let username, introduce: String
let profileImageURL: String
Expand Down
4 changes: 2 additions & 2 deletions iOS/Layover/Layover/Scenes/Home/HomeInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ protocol HomeBusinessLogic {
}

protocol HomeDataStore {
var videos: [VideoDTO]? { get set }
var videos: [Post]? { get set }
var index: Int? { get set }
}

Expand All @@ -26,7 +26,7 @@ final class HomeInteractor: HomeDataStore {

var presenter: HomePresentationLogic?

var videos: [VideoDTO]?
var videos: [Post]?

var index: Int?
}
Expand Down
6 changes: 3 additions & 3 deletions iOS/Layover/Layover/Scenes/Home/HomeModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ enum HomeModels {
enum MoveToPlaybackScene {
struct Request {
let index: Int
let videos: [VideoDTO]
let videos: [Post]
}

struct Response {
let index: Int
let videos: [VideoDTO]
let videos: [Post]
}

struct ViewModel {
let index: Int
let videos: [VideoDTO]
let videos: [Post]
}
}
}
15 changes: 4 additions & 11 deletions iOS/Layover/Layover/Scenes/Home/HomeRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,13 @@ final class HomeRouter: NSObject, HomeRoutingLogic, HomeDataPassing {
else { return }
destination.parentView = .home
destination.index = source.index
destination.videos = transDTO(videos: source.videos ?? [])
destination.videos = transData(videos: source.videos ?? [])
viewController?.navigationController?.pushViewController(playbackViewController, animated: true)
}

// Interactor가 해줄 역할? 고민 필요
private func transDTO(videos: [VideoDTO]) -> [PlaybackModels.Board] {
videos.map { videoDTO in
return PlaybackModels.Board(
title: videoDTO.title,
content: videoDTO.content,
tags: videoDTO.tags,
sdUrl: videoDTO.sdURL,
hdURL: videoDTO.hdURL,
memeber: videoDTO.member)
private func transData(videos: [Post]) -> [PlaybackModels.PlaybackVideo] {
videos.map { video in
return PlaybackModels.PlaybackVideo(post: video)
}
}
// MARK: - Data Passing
Expand Down
87 changes: 55 additions & 32 deletions iOS/Layover/Layover/Scenes/Home/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,38 +44,61 @@ final class HomeViewController: BaseViewController {
cell.setVideo(url: url, loopingAt: .zero)
cell.configure(title: "요리왕 비룡 데뷔", tags: ["#천상의맛", "#갈갈갈", "#빨리주세요"])
cell.moveToPlaybackSceneCallback = {
self.interactor?.moveToPlaybackScene(with: Models.MoveToPlaybackScene.Request(index: indexPath.row, videos: [
VideoDTO(title: "찹모찌1",
content: "찹모찌의 뜻은 뭘 까?",
location: "첫번째 우주",
tags: [""],
member: MemberDTO(
username: "찹모찌",
introduce: "찹모찌임당",
profileImageURL: URL(string: "https://i.ibb.co/qML8vdN/2023-11-25-9-08-01.png")!),
sdURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!,
hdURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!),
VideoDTO(title: "찹모찌2",
content: "찹모찌의 뜻은 뭘 까??",
location: "첫번째 우주",
tags: ["", ""],
member: MemberDTO(
username: "찹모찌",
introduce: "찹모찌임당",
profileImageURL: URL(string: "https://i.ibb.co/qML8vdN/2023-11-25-9-08-01.png")!),
sdURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!,
hdURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!),
VideoDTO(title: "찹모찌3",
content: "찹모찌의 뜻은 뭘 까??",
location: "첫번째 우주",
tags: ["", ""],
member: MemberDTO(
username: "찹모찌",
introduce: "찹모찌임당",
profileImageURL: URL(string: "https://i.ibb.co/qML8vdN/2023-11-25-9-08-01.png")!),
sdURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!,
hdURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!)
]))
self.interactor?.moveToPlaybackScene(
with: Models.MoveToPlaybackScene.Request(
index: indexPath.row,
videos: [
Post(
member: Member(
identifier: 1,
username: "찹모찌",
introduce: "찹모찌데스",
profileImageURL: URL(string: "https://i.ibb.co/qML8vdN/2023-11-25-9-08-01.png")!),
board: Board(
identifier: 1,
title: "찹찹찹",
description: "찹모찌의 뜻은 뭘까?",
thumbnailImageURL: nil,
videoURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!,
latitude: nil,
longitude: nil),
tag: ["", "", ""]
),
Post(
member: Member(
identifier: 2,
username: "로인설",
introduce: "로인설데스",
profileImageURL: URL(string: "https://i.ibb.co/qML8vdN/2023-11-25-9-08-01.png")!),
board: Board(
identifier: 2,
title: "설설설",
description: "로인설의 뜻은 뭘까?",
thumbnailImageURL: nil,
videoURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!,
latitude: nil,
longitude: nil),
tag: ["", "", ""]
),
Post(
member: Member(
identifier: 3,
username: "콩콩콩",
introduce: "콩콩콩데스",
profileImageURL: URL(string: "https://i.ibb.co/qML8vdN/2023-11-25-9-08-01.png")!),
board: Board(
identifier: 1,
title: "콩콩콩",
description: "콩콩콩의 뜻은 뭘까?",
thumbnailImageURL: nil,
videoURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!,
latitude: nil,
longitude: nil),
tag: ["", "", ""]
)
]
)
)
}
cell.addLoopingViewGesture()
return cell
Expand Down
4 changes: 2 additions & 2 deletions iOS/Layover/Layover/Scenes/Map/MapInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protocol MapBusinessLogic {
}

protocol MapDataStore {
var videos: [VideoDTO]? { get set }
var videos: [Post]? { get set }
var index: Int? { get set }
}

Expand All @@ -34,7 +34,7 @@ final class MapInteractor: NSObject, MapBusinessLogic, MapDataStore {

var index: Int?

var videos: [VideoDTO]?
var videos: [Post]?

var presenter: MapPresentationLogic?

Expand Down
6 changes: 3 additions & 3 deletions iOS/Layover/Layover/Scenes/Map/MapModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ enum MapModels {
enum MoveToPlaybackScene {
struct Request {
let index: Int
let videos: [VideoDTO]
let videos: [Post]
}

struct Response {
let index: Int
let videos: [VideoDTO]
let videos: [Post]
}

struct ViewModel {
let index: Int
let videos: [VideoDTO]
let videos: [Post]
}
}

Expand Down
14 changes: 4 additions & 10 deletions iOS/Layover/Layover/Scenes/Map/MapRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,13 @@ final class MapRouter: MapRoutingLogic, MapDataPassing {
else { return }
destination.parentView = .other
destination.index = source.index
destination.videos = transDTO(videos: source.videos ?? [])
destination.videos = transData(videos: source.videos ?? [])
viewController?.navigationController?.pushViewController(playbackViewController, animated: true)
}

private func transDTO(videos: [VideoDTO]) -> [PlaybackModels.Board] {
videos.map { videoDTO in
return PlaybackModels.Board(
title: videoDTO.title,
content: videoDTO.content,
tags: videoDTO.tags,
sdUrl: videoDTO.sdURL,
hdURL: videoDTO.hdURL,
memeber: videoDTO.member)
private func transData(videos: [Post]) -> [PlaybackModels.PlaybackVideo] {
videos.map { video in
return PlaybackModels.PlaybackVideo(post: video)
}
}

Expand Down
87 changes: 55 additions & 32 deletions iOS/Layover/Layover/Scenes/Map/MapViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,38 +63,61 @@ final class MapViewController: BaseViewController {
for: indexPath) as? MapCarouselCollectionViewCell else { return UICollectionViewCell() }
cell.configure(url: item.videoURL)
cell.moveToPlaybackSceneCallback = {
self.interactor?.moveToPlaybackScene(with: Models.MoveToPlaybackScene.Request(index: indexPath.row, videos: [
VideoDTO(title: "찹모찌1",
content: "찹모찌의 뜻은 뭘 까?",
location: "첫번째 우주",
tags: [""],
member: MemberDTO(
username: "찹모찌",
introduce: "찹모찌임당",
profileImageURL: URL(string: "https://i.ibb.co/qML8vdN/2023-11-25-9-08-01.png")!),
sdURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!,
hdURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!),
VideoDTO(title: "찹모찌2",
content: "찹모찌의 뜻은 뭘 까??",
location: "첫번째 우주",
tags: ["", ""],
member: MemberDTO(
username: "찹모찌",
introduce: "찹모찌임당",
profileImageURL: URL(string: "https://i.ibb.co/qML8vdN/2023-11-25-9-08-01.png")!),
sdURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!,
hdURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!),
VideoDTO(title: "찹모찌3",
content: "찹모찌의 뜻은 뭘 까??",
location: "첫번째 우주",
tags: ["", ""],
member: MemberDTO(
username: "찹모찌",
introduce: "찹모찌임당",
profileImageURL: URL(string: "https://i.ibb.co/qML8vdN/2023-11-25-9-08-01.png")!),
sdURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!,
hdURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!)
]))
self.interactor?.moveToPlaybackScene(
with: Models.MoveToPlaybackScene.Request(
index: indexPath.row,
videos: [
Post(
member: Member(
identifier: 1,
username: "찹모찌",
introduce: "찹모찌데스",
profileImageURL: URL(string: "https://i.ibb.co/qML8vdN/2023-11-25-9-08-01.png")!),
board: Board(
identifier: 1,
title: "찹찹찹",
description: "찹모찌의 뜻은 뭘까?",
thumbnailImageURL: nil,
videoURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!,
latitude: nil,
longitude: nil),
tag: ["", "", ""]
),
Post(
member: Member(
identifier: 2,
username: "로인설",
introduce: "로인설데스",
profileImageURL: URL(string: "https://i.ibb.co/qML8vdN/2023-11-25-9-08-01.png")!),
board: Board(
identifier: 2,
title: "설설설",
description: "로인설의 뜻은 뭘까?",
thumbnailImageURL: nil,
videoURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!,
latitude: nil,
longitude: nil),
tag: ["", "", ""]
),
Post(
member: Member(
identifier: 3,
username: "콩콩콩",
introduce: "콩콩콩데스",
profileImageURL: URL(string: "https://i.ibb.co/qML8vdN/2023-11-25-9-08-01.png")!),
board: Board(
identifier: 1,
title: "콩콩콩",
description: "콩콩콩의 뜻은 뭘까?",
thumbnailImageURL: nil,
videoURL: URL(string: "https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/m3u8s/11331.m3u8")!,
latitude: nil,
longitude: nil),
tag: ["", "", ""]
)
]
)
)
}
cell.addLoopingViewGesture()
return cell
Expand Down
6 changes: 3 additions & 3 deletions iOS/Layover/Layover/Scenes/Playback/Cell/PlaybackCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ final class PlaybackCell: UICollectionViewCell {
}

// TODO: VideoModel 받아서 처리
func setPlaybackContents(viewModel: PlaybackModels.Board) {
playbackView.descriptionView.titleLabel.text = viewModel.title
playbackView.descriptionView.setText(viewModel.content)
func setPlaybackContents(viewModel: PlaybackModels.PlaybackVideo) {
playbackView.descriptionView.titleLabel.text = viewModel.post.board.title
playbackView.descriptionView.setText(viewModel.post.board.description ?? "")

}

Expand Down
6 changes: 3 additions & 3 deletions iOS/Layover/Layover/Scenes/Playback/PlaybackInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protocol PlaybackBusinessLogic {
}

protocol PlaybackDataStore: AnyObject {
var videos: [PlaybackModels.Board]? { get set }
var videos: [PlaybackModels.PlaybackVideo]? { get set }
var parentView: PlaybackModels.ParentView? { get set }
var prevCell: PlaybackCell? { get set }
var index: Int? { get set }
Expand All @@ -36,7 +36,7 @@ final class PlaybackInteractor: PlaybackBusinessLogic, PlaybackDataStore {
lazy var worker = PlaybackWorker()
var presenter: PlaybackPresentationLogic?

var videos: [Models.Board]?
var videos: [PlaybackModels.PlaybackVideo]?

var parentView: Models.ParentView?

Expand All @@ -52,7 +52,7 @@ final class PlaybackInteractor: PlaybackBusinessLogic, PlaybackDataStore {
guard let parentView: Models.ParentView else {
return
}
guard var videos: [PlaybackModels.Board] else {
guard var videos: [PlaybackModels.PlaybackVideo] else {
return
}
if parentView == .other {
Expand Down
Loading

0 comments on commit 2b9ce5d

Please sign in to comment.