Various fixes

This commit is contained in:
Ilya Laktyushin 2026-04-29 04:35:17 +02:00
parent 837acfa784
commit 5d7edcf36f
4 changed files with 12 additions and 4 deletions

View file

@ -2924,7 +2924,9 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode {
if !poll.countries.isEmpty {
let locale = localeWithStrings(item.presentationData.strings)
let countryNames = poll.countries.map { id in
if let countryName = locale.localizedString(forRegionCode: id) {
if id == "FT" {
return "Fragment"
} else if let countryName = locale.localizedString(forRegionCode: id) {
return countryName
} else {
return id

View file

@ -2396,7 +2396,11 @@ final class ComposePollScreenComponent: Component {
if self.limitToCountries.count > 1 {
value = environment.strings.CreatePoll_AllowedCountries_Countries(Int32(self.limitToCountries.count))
} else if self.limitToCountries.count == 1, let countryCode = self.limitToCountries.first {
value = self.currentLocale?.localizedString(forRegionCode: countryCode) ?? countryCode
if countryCode == "FT" {
value = "Fragment"
} else {
value = self.currentLocale?.localizedString(forRegionCode: countryCode) ?? countryCode
}
} else {
value = ""
}

View file

@ -1163,7 +1163,7 @@ public extension CountriesMultiselectionScreen {
var currentSection: String?
var currentCountries: [CountryItem] = []
for country in countries {
let section = String(country.0.1.prefix(1))
let section = String(country.0.1.prefix(1)).uppercased()
if currentSection != section {
if let currentSection {
sections.append((currentSection, currentCountries))

View file

@ -2310,7 +2310,9 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState
if !poll.countries.isEmpty {
let locale = localeWithStrings(chatPresentationInterfaceState.strings)
let countryNames = poll.countries.map { id in
if let countryName = locale.localizedString(forRegionCode: id) {
if id == "FT" {
return "Fragment"
} else if let countryName = locale.localizedString(forRegionCode: id) {
return countryName
} else {
return id