mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 21:45:19 +00:00
Various fixes
This commit is contained in:
parent
6334e86721
commit
fe2cc49a55
@ -14262,6 +14262,7 @@ Sorry for the inconvenience.";
|
||||
|
||||
"PeerInfo.Gifts.Sale" = "sale";
|
||||
|
||||
"Gift.Store.ForResaleNoResults" = "no results";
|
||||
"Gift.Store.ForResale_1" = "%@ for resale";
|
||||
"Gift.Store.ForResale_any" = "%@ for resale";
|
||||
"Gift.Store.Sort.Price" = "Price";
|
||||
|
@ -71,7 +71,15 @@ private func actionForAttribute(attribute: StarGift.UniqueGift.Attribute, presen
|
||||
|
||||
var title = "# \(name)"
|
||||
var count = ""
|
||||
if let counter = item.attributeCount[.model(file.fileId.id)] {
|
||||
var attributeId: ResaleGiftsContext.Attribute?
|
||||
switch attribute {
|
||||
case .model:
|
||||
attributeId = .model(file.fileId.id)
|
||||
case .pattern:
|
||||
attributeId = .pattenr(file.fileId.id)
|
||||
}
|
||||
|
||||
if let attributeId, let counter = item.attributeCount[attributeId] {
|
||||
count = " \(presentationStringsFormattedNumber(counter, presentationData.dateTimeFormat.groupingSeparator))"
|
||||
entities.append(
|
||||
MessageTextEntity(
|
||||
@ -81,6 +89,7 @@ private func actionForAttribute(attribute: StarGift.UniqueGift.Attribute, presen
|
||||
)
|
||||
title += count
|
||||
}
|
||||
|
||||
|
||||
let words = title.components(separatedBy: .whitespacesAndNewlines).filter { !$0.isEmpty }
|
||||
var wordStartIndices: [String.Index] = []
|
||||
|
@ -454,22 +454,31 @@ final class GiftStoreScreenComponent: Component {
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Peer Info/SortValue"), color: theme.contextMenu.primaryColor)
|
||||
}, action: { [weak self] _, f in
|
||||
f(.default)
|
||||
|
||||
self?.state?.starGiftsContext.updateSorting(.value)
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.state?.starGiftsContext.updateSorting(.value)
|
||||
self.scrollToTop()
|
||||
})))
|
||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.Gift_Store_SortByDate, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Peer Info/SortDate"), color: theme.contextMenu.primaryColor)
|
||||
}, action: { [weak self] _, f in
|
||||
f(.default)
|
||||
|
||||
self?.state?.starGiftsContext.updateSorting(.date)
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.state?.starGiftsContext.updateSorting(.date)
|
||||
self.scrollToTop()
|
||||
})))
|
||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.Gift_Store_SortByNumber, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Peer Info/SortNumber"), color: theme.contextMenu.primaryColor)
|
||||
}, action: { [weak self] _, f in
|
||||
f(.default)
|
||||
|
||||
self?.state?.starGiftsContext.updateSorting(.number)
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.state?.starGiftsContext.updateSorting(.number)
|
||||
self.scrollToTop()
|
||||
})))
|
||||
|
||||
let contextController = ContextController(presentationData: presentationData, source: .reference(GiftStoreReferenceContentSource(controller: controller, sourceView: sourceView)), items: .single(ContextController.Items(content: .list(items))), gesture: nil)
|
||||
@ -542,6 +551,7 @@ final class GiftStoreScreenComponent: Component {
|
||||
}
|
||||
}
|
||||
self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes)
|
||||
self.scrollToTop()
|
||||
},
|
||||
selectAll: { [weak self] in
|
||||
guard let self else {
|
||||
@ -554,6 +564,7 @@ final class GiftStoreScreenComponent: Component {
|
||||
return true
|
||||
}
|
||||
self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes)
|
||||
self.scrollToTop()
|
||||
}
|
||||
), false))
|
||||
|
||||
@ -633,6 +644,7 @@ final class GiftStoreScreenComponent: Component {
|
||||
}
|
||||
}
|
||||
self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes)
|
||||
self.scrollToTop()
|
||||
},
|
||||
selectAll: { [weak self] in
|
||||
guard let self else {
|
||||
@ -645,6 +657,7 @@ final class GiftStoreScreenComponent: Component {
|
||||
return true
|
||||
}
|
||||
self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes)
|
||||
self.scrollToTop()
|
||||
}
|
||||
), false))
|
||||
|
||||
@ -724,6 +737,7 @@ final class GiftStoreScreenComponent: Component {
|
||||
}
|
||||
}
|
||||
self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes)
|
||||
self.scrollToTop()
|
||||
},
|
||||
selectAll: { [weak self] in
|
||||
guard let self else {
|
||||
@ -736,6 +750,7 @@ final class GiftStoreScreenComponent: Component {
|
||||
return true
|
||||
}
|
||||
self.state?.starGiftsContext.updateFilterAttributes(updatedFilterAttributes)
|
||||
self.scrollToTop()
|
||||
}
|
||||
), false))
|
||||
|
||||
@ -900,7 +915,7 @@ final class GiftStoreScreenComponent: Component {
|
||||
let subtitleSize = self.subtitle.update(
|
||||
transition: transition,
|
||||
component: AnyComponent(BalancedTextComponent(
|
||||
text: .plain(NSAttributedString(string: environment.strings.Gift_Store_ForResale(effectiveCount), font: Font.regular(13.0), textColor: theme.rootController.navigationBar.secondaryTextColor)),
|
||||
text: .plain(NSAttributedString(string: effectiveCount == 0 ? environment.strings.Gift_Store_ForResaleNoResults : environment.strings.Gift_Store_ForResale(effectiveCount), font: Font.regular(13.0), textColor: theme.rootController.navigationBar.secondaryTextColor)),
|
||||
horizontalAlignment: .center,
|
||||
maximumNumberOfLines: 1
|
||||
)),
|
||||
|
@ -308,6 +308,7 @@ private final class StarsPurchaseScreenContentComponent: CombinedComponent {
|
||||
var i = 0
|
||||
var items: [AnyComponentWithIdentity<Empty>] = []
|
||||
|
||||
var collapsedItems = 0
|
||||
if let products = state.products, let balance = context.component.balance {
|
||||
var minimumCount: StarsAmount?
|
||||
if let requiredStars = context.component.purpose.requiredStars {
|
||||
@ -326,6 +327,7 @@ private final class StarsPurchaseScreenContentComponent: CombinedComponent {
|
||||
if let _ = minimumCount, items.isEmpty {
|
||||
|
||||
} else if !context.component.expanded && product.isExtended {
|
||||
collapsedItems += 1
|
||||
continue
|
||||
}
|
||||
|
||||
@ -390,7 +392,7 @@ private final class StarsPurchaseScreenContentComponent: CombinedComponent {
|
||||
}
|
||||
}
|
||||
|
||||
if !context.component.expanded && items.count > 1 {
|
||||
if !context.component.expanded && collapsedItems > 0 {
|
||||
let titleComponent = AnyComponent(MultilineTextComponent(
|
||||
text: .plain(NSAttributedString(
|
||||
string: strings.Stars_Purchase_ShowMore,
|
||||
|
Loading…
x
Reference in New Issue
Block a user