From 6ce70fe59bd23c4b75ac52dc8e1ea3ab88813e7c Mon Sep 17 00:00:00 2001 From: Ali <> Date: Thu, 9 Mar 2023 09:20:35 +0400 Subject: [PATCH 1/5] Fix localization --- Telegram/Telegram-iOS/en.lproj/Localizable.strings | 4 ++++ .../Data and Storage/EnergySavingSettingsScreen.swift | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 62a9ed76e5..7cec8241ff 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -9008,6 +9008,10 @@ Sorry for the inconvenience."; "PowerSaving.BatteryLevelLimit.AlwaysOff" = "Always Off"; "PowerSaving.BatteryLevelLimit.WhenBelow" = "When Below %@%"; +"PowerSaving.AllDescriptionNever" = "Don’t disable all resource-intensive processes even when the battery is low."; +"PowerSaving.AllDescriptionAlways" = "Always disable all resource-intensive processes, regardless of the battery charge level."; +"PowerSaving.AllDescriptionLimit" = "Automatically disable all resource-intensive processes when your battery is below %@%."; + "AppearanceSettings.Animations" = "Animations"; "SendInviteLink.SkipAction" = "Skip"; diff --git a/submodules/SettingsUI/Sources/Data and Storage/EnergySavingSettingsScreen.swift b/submodules/SettingsUI/Sources/Data and Storage/EnergySavingSettingsScreen.swift index 673daa54db..1adeb07de8 100644 --- a/submodules/SettingsUI/Sources/Data and Storage/EnergySavingSettingsScreen.swift +++ b/submodules/SettingsUI/Sources/Data and Storage/EnergySavingSettingsScreen.swift @@ -221,11 +221,11 @@ private func energeSavingSettingsScreenEntries( let allText: String if settings.energyUsageSettings.activationThreshold <= 4 { - allText = "Don’t disable all resource-intensive processes even when the battery is low." + allText = presentationData.strings.PowerSaving_AllDescriptionNever } else if settings.energyUsageSettings.activationThreshold >= 96 { - allText = "Always disable all resource-intensive processes, regardless of the battery charge level." + allText = presentationData.strings.PowerSaving_AllDescriptionAlways } else { - allText = "Automatically disable all resource-intensive processes when your battery is below \(settings.energyUsageSettings.activationThreshold)%." + allText = presentationData.strings.PowerSaving_AllDescriptionLimit("\(settings.energyUsageSettings.activationThreshold)") } entries.append(.allFooter(allText)) From dcea20dd22f2a69526e15a6fddd8b76f0f9bc7a3 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Thu, 9 Mar 2023 09:20:52 +0400 Subject: [PATCH 2/5] Fix resource clone --- submodules/TelegramCore/Sources/State/ApplyUpdateMessage.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/TelegramCore/Sources/State/ApplyUpdateMessage.swift b/submodules/TelegramCore/Sources/State/ApplyUpdateMessage.swift index 0ddf59afbe..277cf02a3b 100644 --- a/submodules/TelegramCore/Sources/State/ApplyUpdateMessage.swift +++ b/submodules/TelegramCore/Sources/State/ApplyUpdateMessage.swift @@ -26,7 +26,7 @@ func applyMediaResourceChanges(from: Media, to: Media, postbox: Postbox, force: } } if let fromLargestRepresentation = largestImageRepresentation(fromImage.representations), let toLargestRepresentation = largestImageRepresentation(toImage.representations) { - if fromLargestRepresentation.progressiveSizes != toLargestRepresentation.progressiveSizes { + if fromLargestRepresentation.resource is CloudPeerPhotoSizeMediaResource { } else { copyOrMoveResourceData(from: fromLargestRepresentation.resource, to: toLargestRepresentation.resource, mediaBox: postbox.mediaBox) } From 67a3d9f73bfc44c09e556b3867ad19dbd1734390 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Thu, 9 Mar 2023 09:25:20 +0400 Subject: [PATCH 3/5] Fix duplicate group ids --- .../Sources/ChatHistoryEntriesForView.swift | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/submodules/TelegramUI/Sources/ChatHistoryEntriesForView.swift b/submodules/TelegramUI/Sources/ChatHistoryEntriesForView.swift index 953eaae337..9c24366eff 100644 --- a/submodules/TelegramUI/Sources/ChatHistoryEntriesForView.swift +++ b/submodules/TelegramUI/Sources/ChatHistoryEntriesForView.swift @@ -77,7 +77,8 @@ func chatHistoryEntriesForView( associatedThreadInfo: nil ) } - + + var existingGroupStableIds: [UInt32] = [] var groupBucket: [(Message, Bool, ChatHistoryMessageSelection, ChatMessageEntryAttributes, MessageHistoryEntryLocation?)] = [] var count = 0 loop: for entry in view.entries { @@ -156,7 +157,11 @@ func chatHistoryEntriesForView( if groupMessages { if !groupBucket.isEmpty && message.groupInfo != groupBucket[0].0.groupInfo { - entries.append(.MessageGroupEntry(groupBucket[0].0.groupInfo!, groupBucket, presentationData)) + let groupStableId = groupBucket[0].0.groupInfo!.stableId + if !existingGroupStableIds.contains(groupStableId) { + existingGroupStableIds.append(groupStableId) + entries.append(.MessageGroupEntry(groupBucket[0].0.groupInfo!, groupBucket, presentationData)) + } groupBucket.removeAll() } if let _ = message.groupInfo { @@ -189,7 +194,14 @@ func chatHistoryEntriesForView( if !groupBucket.isEmpty { assert(groupMessages) - entries.append(.MessageGroupEntry(groupBucket[0].0.groupInfo!, groupBucket, presentationData)) + + let groupStableId = groupBucket[0].0.groupInfo!.stableId + if !existingGroupStableIds.contains(groupStableId) { + existingGroupStableIds.append(groupStableId) + entries.append(.MessageGroupEntry(groupBucket[0].0.groupInfo!, groupBucket, presentationData)) + } + + groupBucket.removeAll() } if let maybeJoinMessage = joinMessage, !view.holeLater { From 4046102362c4d0996a48b0b7b69969703dfa148a Mon Sep 17 00:00:00 2001 From: Ali <> Date: Thu, 9 Mar 2023 10:40:36 +0400 Subject: [PATCH 4/5] Bump version --- versions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions.json b/versions.json index f220850f42..b7bed4a746 100644 --- a/versions.json +++ b/versions.json @@ -1,5 +1,5 @@ { - "app": "9.5", + "app": "9.5.1", "bazel": "5.3.1", "xcode": "14.2" } From c63b57a0624b0c9de274c2ea7f51870141e198ad Mon Sep 17 00:00:00 2001 From: Ali <> Date: Thu, 9 Mar 2023 12:03:38 +0400 Subject: [PATCH 5/5] Fix build --- .../Sources/Data and Storage/EnergySavingSettingsScreen.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/SettingsUI/Sources/Data and Storage/EnergySavingSettingsScreen.swift b/submodules/SettingsUI/Sources/Data and Storage/EnergySavingSettingsScreen.swift index 1adeb07de8..615fc8b32f 100644 --- a/submodules/SettingsUI/Sources/Data and Storage/EnergySavingSettingsScreen.swift +++ b/submodules/SettingsUI/Sources/Data and Storage/EnergySavingSettingsScreen.swift @@ -225,7 +225,7 @@ private func energeSavingSettingsScreenEntries( } else if settings.energyUsageSettings.activationThreshold >= 96 { allText = presentationData.strings.PowerSaving_AllDescriptionAlways } else { - allText = presentationData.strings.PowerSaving_AllDescriptionLimit("\(settings.energyUsageSettings.activationThreshold)") + allText = presentationData.strings.PowerSaving_AllDescriptionLimit("\(settings.energyUsageSettings.activationThreshold)").string } entries.append(.allFooter(allText))