Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

부스트 버그 수정 #263

Merged
merged 2 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ final class WalWalBoostCounter {
private var countLabel: UILabel?
private var borderLabel: UILabel?

func resetCount(){
currentCount = 0
}

func setupCountLabel(in window: UIWindow, detailView: UIView) {
currentCount = 0
countLabel = UILabel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ final class WalWalBoostGenerator {
for gesture: UILongPressGestureRecognizer,
in collectionView: UICollectionView
) {
walwalBoostCounter.resetCount()
let point = gesture.location(in: collectionView)
guard let indexPath = collectionView.indexPathForItem(at: point),
let cell = collectionView.cellForItem(at: indexPath) as? WalWalFeedCell,
Expand Down
30 changes: 16 additions & 14 deletions WalWal/DesignSystem/Sources/WalWalFeed/WalWalFeed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,23 @@ public final class WalWalFeed: UIView {
.withUnretained(self) { (owner, boostResult) in
var updatedFeedData = owner.feedData.value
var boostCount = boostResult.count
if let feedModel = updatedFeedData[safe: boostResult.indexPath.item] {
if boostResult.count > 500 {
WalWalToast.shared.show(type: .boost, message: "부스터는 최대 500개까지만 가능해요!")
boostCount = 500

if boostCount > 0 {
if let feedModel = updatedFeedData[safe: boostResult.indexPath.item] {
if boostResult.count > 500 {
WalWalToast.shared.show(type: .boost, message: "부스터는 최대 500개까지만 가능해요!")
boostCount = 500
}

var updatedModel = feedModel
updatedModel.boostCount += boostCount
updatedFeedData[boostResult.indexPath.item] = updatedModel

owner.updatedBoost.accept(
(recordId: updatedModel.recordId,
count: boostCount)
)
}

var updatedModel = feedModel
updatedModel.boostCount += boostCount
updatedFeedData[boostResult.indexPath.item] = updatedModel

owner.updatedBoost.accept(
(recordId: updatedModel.recordId,
count: boostCount)
)
}

return updatedFeedData
Expand Down Expand Up @@ -241,7 +244,6 @@ public final class WalWalFeed: UIView {
updatedRecord = feedModel
collectionView.collectionViewLayout.invalidateLayout()
feedData.accept(updatedFeedData)

}

// MARK: - Scroll
Expand Down