Skip to content

Commit

Permalink
[Edit] likeAction() 삭제 #166
Browse files Browse the repository at this point in the history
  • Loading branch information
withseon committed Mar 21, 2024
1 parent db0f404 commit 0828c4c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "e61f9af2a013864b7919deedca43e2aaa74a995ba2089949eea130f3ce6b99f5",
"originHash" : "9d00d6d19aea4480f6191998a2ec62f9eee0bcf6df419b0690743e83bbd804c1",
"pins" : [
{
"identity" : "abseil-cpp-binary",
Expand Down Expand Up @@ -128,12 +128,12 @@
}
},
{
"identity" : "lottie-ios",
"identity" : "lottie-spm",
"kind" : "remoteSourceControl",
"location" : "https://github.com/airbnb/lottie-ios.git",
"location" : "https://github.com/airbnb/lottie-spm.git",
"state" : {
"branch" : "master",
"revision" : "41dfe7b0d8c3349adc7a5a03a1c6aaac8746433d"
"revision" : "3bd43e12d6fb54654366a61f7cfaca787318b8ce",
"version" : "4.4.1"
}
},
{
Expand Down
33 changes: 13 additions & 20 deletions JUDA_iOS/JUDA/Resource/Components/PostCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,25 @@ struct PostCell: View {
// 좋아요를 해제 -> 테두리가 회색인 하트
Button {
// TODO: 로그인 안 되어 있을 때, 로그인 페이지 넘어가기
likeAction()
if authViewModel.signInStatus {
isLike.toggle()
debouncer.call {
if isLike {
likeCount += 1
} else {
likeCount -= 1
}
Task {
await authViewModel.updateLikedPosts(isLiked: isLike, selectedPost: post)
}
}
}
} label: {
Image(systemName: isLike ? "heart.fill" : "heart")
.foregroundStyle(isLike ? .mainAccent01 : .gray01)
}
Text(Formatter.formattedPostLikesCount(likeCount))
.foregroundStyle(.gray01)
.onTapGesture {
likeAction()
}
}
.font(.regular14)
.padding(.trailing, 5)
Expand All @@ -102,22 +111,6 @@ struct PostCell: View {
self.likeCount = post.likedUsersID.count
}
}

private func likeAction() {
if authViewModel.signInStatus {
isLike.toggle()
debouncer.call {
if isLike {
likeCount += 1
} else {
likeCount -= 1
}
Task {
await authViewModel.updateLikedPosts(isLiked: isLike, selectedPost: post)
}
}
}
}
}

// MARK: - PostCell 의 이미지 프로필에서 사용하는 KFImage
Expand Down

0 comments on commit 0828c4c

Please sign in to comment.