Skip to content

Commit

Permalink
fix customization layouting
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipthelen committed Jan 19, 2024
1 parent 1860bce commit fafb76b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
8 changes: 6 additions & 2 deletions HabitRPG/UI/General/ArmoireViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,15 @@ private class ViewModel: ObservableObject {
self.text = response?.armoire?.dropText ?? ""
self.key = response?.armoire?.dropKey ?? ""
self.value = response?.armoire?.value ?? 0
if (self.type == "gear") {
if self.type == "gear" {
self.remainingCount -= 1
}
onCompleted()
}).flatMap(.latest, { _ in
})
.flatMap(.latest, { _ in
return self.userRepository.retrieveInAppRewards()
})
.flatMap(.latest, { _ in
return self.userRepository.retrieveUser(forced: true)
})
.observeValues({ _ in
Expand Down
13 changes: 12 additions & 1 deletion HabitRPG/UI/Inventory/AvatarDetailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,18 @@ class AvatarDetailViewController: BaseCollectionViewController, UICollectionView
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
let width = 80
let viewWidth = Int(collectionView.frame.size.width)
var count = viewWidth / width
var count = viewWidth / (width + 10)
if let dataSource = gearDataSource {
let inSection = dataSource.collectionView(collectionView, numberOfItemsInSection: section)
if inSection < count {
count = inSection
}
} else if let dataSource = customizationDataSource {
let inSection = dataSource.collectionView(collectionView, numberOfItemsInSection: section)
if inSection < count {
count = inSection
}
}
if customizationType == "background" {
count = 3
}
Expand Down

0 comments on commit fafb76b

Please sign in to comment.