From b825d09009b2cdcdbbc9b5d0cb5b9d4505d8276d Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Sat, 17 Sep 2022 20:28:11 +0300 Subject: [PATCH] Various fixes --- .../Telegram-iOS/en.lproj/Localizable.strings | 15 +++++++++++++++ submodules/Display/Source/DeviceMetrics.swift | 9 --------- submodules/Display/Source/WindowContent.swift | 4 ++-- .../ChatItemGalleryFooterContentNode.swift | 6 ++++++ .../Sources/PresentationThemeCodable.swift | 1 + .../TelegramUI/Sources/ChatController.swift | 6 ++++-- .../ChatMessageAnimatedStickerItemNode.swift | 2 +- 7 files changed, 29 insertions(+), 14 deletions(-) diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index ff971f1ef1..813f51445d 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -8080,3 +8080,18 @@ Sorry for the inconvenience."; "PeerInfo.LabelAllReactions" = "All Reactions"; "TextFormat.Format" = "Format"; + +"Group.Setup.PublicLink" = "PUBLIC LINK"; +"Group.Setup.LinksOrder" = "LINKS ORDER"; +"Group.Setup.LinksOrderInfo" = "Drag and drop links to change the order in which they will be displayed on the group info page."; + +"Group.Setup.LinkActive" = "active"; +"Group.Setup.LinkInactive" = "inactive"; + +"Channel.Setup.PublicLink" = "PUBLIC LINK"; +"Channel.Setup.LinksOrder" = "LINKS ORDER"; +"Channel.Setup.LinksOrderInfo" = "Drag and drop links to change the order in which they will be displayed on the channel info page."; + +"Username.Username" = "USERNAME"; +"Username.LinksOrder" = "USERNAMES ORDER"; +"Username.LinksOrderInfo" = "Drag and drop links to change the order in which they will be displayed on your info page."; diff --git a/submodules/Display/Source/DeviceMetrics.swift b/submodules/Display/Source/DeviceMetrics.swift index 998cc009ad..6c16532edb 100644 --- a/submodules/Display/Source/DeviceMetrics.swift +++ b/submodules/Display/Source/DeviceMetrics.swift @@ -320,13 +320,4 @@ public enum DeviceMetrics: CaseIterable, Equatable { return false } } - - public var maybeHasDynamicIsland: Bool { - switch self { - case .iPhone12, .iPhone12ProMax, .iPhone14Pro, .iPhone14ProMax: - return true - default: - return false - } - } } diff --git a/submodules/Display/Source/WindowContent.swift b/submodules/Display/Source/WindowContent.swift index 8f32346a6f..81f85d0ca3 100644 --- a/submodules/Display/Source/WindowContent.swift +++ b/submodules/Display/Source/WindowContent.swift @@ -679,10 +679,10 @@ public class Window1 { } private func updateBadgeVisibility() { - let badgeIsHidden = !self.deviceMetrics.hasTopNotch || self.deviceMetrics.hasDynamicIsland || self.deviceMetrics.maybeHasDynamicIsland || self.forceBadgeHidden || self.windowLayout.size.width > self.windowLayout.size.height + let badgeIsHidden = !self.deviceMetrics.hasTopNotch || self.deviceMetrics.hasDynamicIsland || self.forceBadgeHidden || self.windowLayout.size.width > self.windowLayout.size.height if badgeIsHidden != self.badgeView.isHidden && !badgeIsHidden { Queue.mainQueue().after(0.4) { - let badgeShouldBeHidden = !self.deviceMetrics.hasTopNotch || self.deviceMetrics.hasDynamicIsland || self.deviceMetrics.maybeHasDynamicIsland || self.forceBadgeHidden || self.windowLayout.size.width > self.windowLayout.size.height + let badgeShouldBeHidden = !self.deviceMetrics.hasTopNotch || self.deviceMetrics.hasDynamicIsland || self.forceBadgeHidden || self.windowLayout.size.width > self.windowLayout.size.height if badgeShouldBeHidden == badgeIsHidden { self.badgeView.isHidden = badgeIsHidden } diff --git a/submodules/GalleryUI/Sources/ChatItemGalleryFooterContentNode.swift b/submodules/GalleryUI/Sources/ChatItemGalleryFooterContentNode.swift index 69ad8c7418..a0fbbdd975 100644 --- a/submodules/GalleryUI/Sources/ChatItemGalleryFooterContentNode.swift +++ b/submodules/GalleryUI/Sources/ChatItemGalleryFooterContentNode.swift @@ -615,9 +615,11 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll if media is TelegramMediaImage { canEdit = true } else if let media = media as? TelegramMediaFile, !media.isAnimated { + var isVideo = false for attribute in media.attributes { switch attribute { case let .Video(_, dimensions, _): + isVideo = true if dimensions.height > 0 { if CGFloat(dimensions.width) / CGFloat(dimensions.height) > 1.33 { canFullscreen = true @@ -627,6 +629,10 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll break } } + + if !isVideo { + canEdit = true + } } else if let media = media as? TelegramMediaWebpage, case let .Loaded(content) = media.content { let type = webEmbedType(content: content) switch type { diff --git a/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift b/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift index 5f2e8ca37b..df9ee92b2b 100644 --- a/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift +++ b/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift @@ -1045,6 +1045,7 @@ extension PresentationThemeChatList: Codable { try encodeColor(&values, self.itemBackgroundColor, .itemBg) try encodeColor(&values, self.pinnedItemBackgroundColor, .pinnedItemBg) try encodeColor(&values, self.itemHighlightedBackgroundColor, .itemHighlightedBg) + try encodeColor(&values, self.pinnedItemHighlightedBackgroundColor, .pinnedItemHighlightedBg) try encodeColor(&values, self.itemSelectedBackgroundColor, .itemSelectedBg) try encodeColor(&values, self.titleColor, .title) try encodeColor(&values, self.secretTitleColor, .secretTitle) diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index 521193756a..aaea70b2fb 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -929,9 +929,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G } var mediaReference: AnyMediaReference? - for m in message.media { - if let image = m as? TelegramMediaImage { + for media in message.media { + if let image = media as? TelegramMediaImage { mediaReference = AnyMediaReference.standalone(media: image) + } else if let file = media as? TelegramMediaFile { + mediaReference = AnyMediaReference.standalone(media: file) } } diff --git a/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift b/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift index ea4ff09148..dddc4117c6 100644 --- a/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift @@ -2348,7 +2348,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView { let offset: CGFloat = incoming ? 42.0 : 0.0 if let selectionNode = self.selectionNode { - selectionNode.updateSelected(selected, animated: false) + selectionNode.updateSelected(selected, animated: animated) let selectionFrame = CGRect(origin: CGPoint(x: -offset, y: 0.0), size: CGSize(width: self.contentBounds.size.width, height: self.contentBounds.size.height)) selectionNode.frame = selectionFrame selectionNode.updateLayout(size: selectionFrame.size, leftInset: self.safeInsets.left)