feat(follow): 팔로우 해제 확인 팝업을 추가한다
This commit is contained in:
@@ -13,6 +13,19 @@ struct FollowCreatorItemView: View {
|
||||
let creator: GetCreatorFollowingAllListItem
|
||||
let onClickFollow: (Int) -> Void
|
||||
let showCreatorFollowNotifyDialog: (Int) -> Void
|
||||
let onTapUnfollow: ((Int) -> Void)?
|
||||
|
||||
init(
|
||||
creator: GetCreatorFollowingAllListItem,
|
||||
onClickFollow: @escaping (Int) -> Void,
|
||||
showCreatorFollowNotifyDialog: @escaping (Int) -> Void,
|
||||
onTapUnfollow: ((Int) -> Void)? = nil
|
||||
) {
|
||||
self.creator = creator
|
||||
self.onClickFollow = onClickFollow
|
||||
self.showCreatorFollowNotifyDialog = showCreatorFollowNotifyDialog
|
||||
self.onTapUnfollow = onTapUnfollow
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 13.3) {
|
||||
@@ -36,19 +49,7 @@ struct FollowCreatorItemView: View {
|
||||
|
||||
Spacer()
|
||||
|
||||
let asset = FollowButtonImageAsset(
|
||||
type: creator.isFollow
|
||||
? (creator.isNotify ? .following : .followingNoAlarm)
|
||||
: .follow
|
||||
)
|
||||
asset.imageView()
|
||||
.onTapGesture {
|
||||
if creator.isFollow {
|
||||
showCreatorFollowNotifyDialog(creator.creatorId)
|
||||
} else {
|
||||
onClickFollow(creator.creatorId)
|
||||
}
|
||||
}
|
||||
followButton
|
||||
}
|
||||
|
||||
Rectangle()
|
||||
@@ -56,4 +57,33 @@ struct FollowCreatorItemView: View {
|
||||
.frame(height: 0.5)
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var followButton: some View {
|
||||
if creator.isFollow, let onTapUnfollow {
|
||||
Button(action: { onTapUnfollow(creator.creatorId) }) {
|
||||
Image("ic_new_following_white")
|
||||
.resizable()
|
||||
.frame(width: 20, height: 20)
|
||||
.frame(width: 36, height: 36)
|
||||
.background(Color.gray800)
|
||||
.clipShape(Circle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
} else {
|
||||
let asset = FollowButtonImageAsset(
|
||||
type: creator.isFollow
|
||||
? (creator.isNotify ? .following : .followingNoAlarm)
|
||||
: .follow
|
||||
)
|
||||
asset.imageView()
|
||||
.onTapGesture {
|
||||
if creator.isFollow {
|
||||
showCreatorFollowNotifyDialog(creator.creatorId)
|
||||
} else {
|
||||
onClickFollow(creator.creatorId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user