Various fixes

This commit is contained in:
Ilya Laktyushin
2025-01-02 04:03:51 +04:00
parent 45fa1b5ddb
commit 3bf092aff8
18 changed files with 361 additions and 292 deletions

View File

@@ -79,6 +79,7 @@ final class GiftOptionsScreenComponent: Component {
public enum StarsFilter: Equatable {
case all
case limited
case inStock
case stars(Int64)
init(rawValue: Int64) {
@@ -87,6 +88,8 @@ final class GiftOptionsScreenComponent: Component {
self = .all
case -1:
self = .limited
case -2:
self = .inStock
default:
self = .stars(rawValue)
}
@@ -98,6 +101,8 @@ final class GiftOptionsScreenComponent: Component {
return 0
case .limited:
return -1
case .inStock:
return -2
case let .stars(stars):
return stars
}
@@ -159,6 +164,10 @@ final class GiftOptionsScreenComponent: Component {
if $0.availability != nil {
return true
}
case .inStock:
if $0.availability == nil || $0.availability!.remains > 0 {
return true
}
case let .stars(stars):
if $0.price == stars {
return true
@@ -901,6 +910,11 @@ final class GiftOptionsScreenComponent: Component {
title: strings.Gift_Options_Gift_Filter_Limited
))
}
tabSelectorItems.append(TabSelectorComponent.Item(
id: AnyHashable(StarsFilter.inStock.rawValue),
title: strings.Gift_Options_Gift_Filter_InStock
))
let starsAmounts = Array(starsAmountsSet).sorted()
for amount in starsAmounts {