fix(main): 최근 활동 이동을 보정한다
This commit is contained in:
@@ -3,17 +3,20 @@ import SwiftUI
|
||||
struct MainHomeActiveCreatorSection: View {
|
||||
let items: [HomeActiveCreatorItem]
|
||||
let onTapLive: (Int) -> Void
|
||||
let onTapCreator: (Int) -> Void
|
||||
let onTapContent: (Int) -> Void
|
||||
let onTapCommunityPost: (Int) -> Void
|
||||
|
||||
init(
|
||||
items: [HomeActiveCreatorItem],
|
||||
onTapLive: @escaping (Int) -> Void = { _ in },
|
||||
onTapCreator: @escaping (Int) -> Void = { _ in },
|
||||
onTapContent: @escaping (Int) -> Void = { _ in },
|
||||
onTapCommunityPost: @escaping (Int) -> Void = { _ in }
|
||||
) {
|
||||
self.items = items
|
||||
self.onTapLive = onTapLive
|
||||
self.onTapCreator = onTapCreator
|
||||
self.onTapContent = onTapContent
|
||||
self.onTapCommunityPost = onTapCommunityPost
|
||||
}
|
||||
@@ -38,16 +41,16 @@ struct MainHomeActiveCreatorSection: View {
|
||||
}
|
||||
|
||||
private func handleTap(_ item: HomeActiveCreatorItem) {
|
||||
guard let targetId = item.targetId else { return }
|
||||
|
||||
switch item.activityType {
|
||||
case .live:
|
||||
onTapLive(targetId)
|
||||
case .audio:
|
||||
onTapContent(targetId)
|
||||
case .community:
|
||||
onTapCommunityPost(targetId)
|
||||
case .unknown:
|
||||
switch item.activeCreatorTapDestination {
|
||||
case .live(let roomId):
|
||||
onTapLive(roomId)
|
||||
case .creator(let creatorId):
|
||||
onTapCreator(creatorId)
|
||||
case .content(let contentId):
|
||||
onTapContent(contentId)
|
||||
case .communityPost(let postId):
|
||||
onTapCommunityPost(postId)
|
||||
case nil:
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -141,6 +144,7 @@ struct MainHomeActiveCreatorSection_Previews: PreviewProvider {
|
||||
MainHomeActiveCreatorSection(
|
||||
items: [
|
||||
HomeActiveCreatorItem(
|
||||
creatorId: 1,
|
||||
creatorNickname: "크리에이터이름",
|
||||
creatorProfileImage: previewImageUrl,
|
||||
activityType: .live,
|
||||
@@ -148,6 +152,7 @@ struct MainHomeActiveCreatorSection_Previews: PreviewProvider {
|
||||
targetId: 1
|
||||
),
|
||||
HomeActiveCreatorItem(
|
||||
creatorId: 2,
|
||||
creatorNickname: "크리에이터이름",
|
||||
creatorProfileImage: previewImageUrl,
|
||||
activityType: .audio,
|
||||
|
||||
Reference in New Issue
Block a user