Skip to content

Commit

Permalink
Merge pull request #931 from MixinNetwork/feature/holiday
Browse files Browse the repository at this point in the history
Update snowflake color
  • Loading branch information
over140 authored Jan 28, 2022
2 parents 2bc0983 + 4a91bc3 commit c658080
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class WalletHeaderView: InfiniteTopView {
cell.scale = 0.3
cell.scaleRange = 0.15
cell.spinRange = 1
cell.color = UIColor(displayP3RgbValue: 0x9CABE9, alpha: 0.4).cgColor
cell.color = snowflakeColor
cell.contents = R.image.snowflake()!.cgImage

let layer = CAEmitterLayer()
Expand All @@ -67,6 +67,14 @@ class WalletHeaderView: InfiniteTopView {

private var contentHeight: CGFloat = 159

private var snowflakeColor: CGColor {
if traitCollection.userInterfaceStyle == .dark {
return UIColor.white.withAlphaComponent(0.4).cgColor
} else {
return UIColor(displayP3RgbValue: 0x9CABE9, alpha: 0.4).cgColor
}
}

override func sizeThatFits(_ size: CGSize) -> CGSize {
return CGSize(width: size.width, height: contentHeight)
}
Expand All @@ -78,6 +86,15 @@ class WalletHeaderView: InfiniteTopView {
}
}

override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
if #available(iOS 13.0, *), traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection) {
snowfallLayerIfLoaded?.emitterCells?.forEach { cell in
cell.color = snowflakeColor
}
}
}

func render(assets: [AssetItem]) {
fiatMoneySymbolLabel.text = Currency.current.symbol
var assetPortions = [AssetPortion]()
Expand Down

0 comments on commit c658080

Please sign in to comment.