Skip to content

Commit

Permalink
show correct icons
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipthelen committed May 30, 2024
1 parent 434c633 commit 6c6fb20
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
12 changes: 8 additions & 4 deletions HabitRPG/TableviewCells/InAppRewardCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ class InAppRewardCell: UICollectionViewCell {
private var isLocked = false {
didSet {
if isLocked {
if ThemeService.shared.theme.isDark {
infoImageView.image = HabiticaIcons.imageOfItemIndicatorLockedDark()
if availableUntil != nil {
infoImageView.image = HabiticaIcons.imageOfItemIndicatorLocked(indicatorLocked: .purple300, lockColor: .white)
} else {
infoImageView.image = HabiticaIcons.imageOfItemIndicatorLocked()
if ThemeService.shared.theme.isDark {
infoImageView.image = HabiticaIcons.imageOfItemIndicatorLockedDark()
} else {
infoImageView.image = HabiticaIcons.imageOfItemIndicatorLocked()
}
}
infoImageView.isHidden = false
infoLabel.isHidden = true
Expand Down Expand Up @@ -108,7 +112,6 @@ class InAppRewardCell: UICollectionViewCell {
currencyView.currency = thisCurrency
currency = thisCurrency
}
isLocked = reward.locked

if let currency = currency {
setCanAfford(price, currency: currency, user: user)
Expand Down Expand Up @@ -138,6 +141,7 @@ class InAppRewardCell: UICollectionViewCell {
unlockLabel.isHidden = true
currencyView.isHidden = false
}
isLocked = reward.locked

if reward.key == "gem" {
infoImageView.image = Asset.subBenefitIndicator.image
Expand Down
2 changes: 1 addition & 1 deletion HabitRPG/UI/Settings/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class SettingsViewController: FormViewController, Themeable {
}.onCellSelection({[weak self] (_, _) in
self?.contentRepository.retrieveContent(force: true)
.flatMap(.latest, { _ in
return self?.contentRepository.retrieveWorldState() ?? Signal.empty
return self?.contentRepository.retrieveWorldState(force: true) ?? Signal.empty
})
.observeCompleted {
ToastManager.show(text: L10n.Settings.reloadedContent, color: .green, duration: 4.0)
Expand Down
9 changes: 1 addition & 8 deletions HabitRPG/Utilities/HabiticaIcons.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2447,19 +2447,12 @@ public class HabiticaIcons : NSObject {
let fillColor39 = UIColor(red: 1, green: 1, blue: 1.000, alpha: 1.000)
let strokeColor2 = UIColor(red: 1, green: 1, blue: 1.000, alpha: 1.000)

//// Shadow Declarations
let shadow = NSShadow()
shadow.shadowColor = shadowTint.withAlphaComponent(0.12 * shadowTint.cgColor.alpha)
shadow.shadowOffset = CGSize(width: 0, height: 1)
shadow.shadowBlurRadius = 1

//// Variable Declarations
let itemIndicatorColor = isLocked ? (isDark ? indicatorLockedDark : indicatorLocked) : (isLimited ? strokeColor : (isDark ? indicatorLockedDark : itemIndicatorColorBackground))

//// Oval 2 Drawing
let oval2Path = UIBezierPath(ovalIn: CGRect(x: 2, y: 2, width: 24, height: 24))
let oval2Path = UIBezierPath(ovalIn: CGRect(x: 0, y: 0, width: 28, height: 28))
context.saveGState()
context.setShadow(offset: CGSize(width: shadow.shadowOffset.width * resizedShadowScale, height: shadow.shadowOffset.height * resizedShadowScale), blur: shadow.shadowBlurRadius * resizedShadowScale, color: (shadow.shadowColor as! UIColor).cgColor)
itemIndicatorColor.setFill()
oval2Path.fill()
context.restoreGState()
Expand Down

0 comments on commit 6c6fb20

Please sign in to comment.