diff --git a/submodules/Display/Source/UIKitUtils.swift b/submodules/Display/Source/UIKitUtils.swift index 02c50f0ed3..c2727f91cf 100644 --- a/submodules/Display/Source/UIKitUtils.swift +++ b/submodules/Display/Source/UIKitUtils.swift @@ -484,6 +484,17 @@ public extension UIImage { } return result } + + func fixedOrientation() -> UIImage { + if self.imageOrientation == .up { return self } + + UIGraphicsBeginImageContextWithOptions(self.size, false, self.scale) + self.draw(in: CGRect(origin: .zero, size: size)) + let normalizedImage = UIGraphicsGetImageFromCurrentImageContext() + UIGraphicsEndImageContext() + + return normalizedImage ?? self + } } private func makeSubtreeSnapshot(layer: CALayer, keepPortals: Bool = false, keepTransform: Bool = false) -> UIView? { diff --git a/submodules/ShareController/Sources/ShareController.swift b/submodules/ShareController/Sources/ShareController.swift index 228a9fd417..8590765693 100644 --- a/submodules/ShareController/Sources/ShareController.swift +++ b/submodules/ShareController/Sources/ShareController.swift @@ -1259,7 +1259,7 @@ public final class ShareController: ViewController { var result: [EnginePeer.Id: EnginePeer?] = [:] var requiresStars: [EnginePeer.Id: StarsAmount] = [:] for peerId in peerIds { - if let view = views.views[PostboxViewKey.basicPeer(peerId)] as? PeerView, let peer = peerViewMainPeer(view) { + if let view = views.views[PostboxViewKey.peer(peerId: peerId, components: [])] as? PeerView, let peer = peerViewMainPeer(view) { result[peerId] = EnginePeer(peer) if peer is TelegramUser, let cachedPeerDataView = views.views[PostboxViewKey.cachedPeerData(peerId: peerId)] as? CachedPeerDataView { if let cachedData = cachedPeerDataView.cachedPeerData as? CachedUserData { @@ -1913,7 +1913,7 @@ public final class ShareController: ViewController { var result: [EnginePeer.Id: EnginePeer?] = [:] var requiresStars: [EnginePeer.Id: StarsAmount] = [:] for peerId in peerIds { - if let view = views.views[PostboxViewKey.basicPeer(peerId)] as? PeerView, let peer = peerViewMainPeer(view) { + if let view = views.views[PostboxViewKey.peer(peerId: peerId, components: [])] as? PeerView, let peer = peerViewMainPeer(view) { result[peerId] = EnginePeer(peer) if peer is TelegramUser, let cachedPeerDataView = views.views[PostboxViewKey.cachedPeerData(peerId: peerId)] as? CachedPeerDataView { if let cachedData = cachedPeerDataView.cachedPeerData as? CachedUserData { @@ -2549,7 +2549,7 @@ public final class ShareController: ViewController { if let view = views.views[.cachedPeerData(peerId: id)] as? CachedPeerDataView, let data = view.cachedPeerData as? CachedUserData { requiresPremiumForMessaging[id] = data.flags.contains(.premiumRequired) requiresStars[id] = data.sendPaidMessageStars?.value - } else if let view = views.views[.basicPeer(id)] as? PeerView, let channel = peerViewMainPeer(view) as? TelegramChannel { + } else if let view = views.views[.peer(peerId: id, components: [])] as? PeerView, let channel = peerViewMainPeer(view) as? TelegramChannel { requiresStars[id] = channel.sendPaidMessageStars?.value } else { requiresPremiumForMessaging[id] = false diff --git a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift index e01afc1408..b7fb94d32c 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift @@ -1657,6 +1657,10 @@ private final class GiftViewSheetContent: CombinedComponent { convertStars = nil titleString = "" } + + if !canUpgrade, let gift = state.starGiftsMap[giftId], let _ = gift.upgradeStars { + canUpgrade = true + } var showUpgradePreview = false if state.inUpgradePreview, let _ = state.sampleGiftAttributes { diff --git a/submodules/TelegramUI/Components/MediaScrubberComponent/Sources/MediaScrubberComponent.swift b/submodules/TelegramUI/Components/MediaScrubberComponent/Sources/MediaScrubberComponent.swift index 58944fdf9c..70af5bfa7f 100644 --- a/submodules/TelegramUI/Components/MediaScrubberComponent/Sources/MediaScrubberComponent.swift +++ b/submodules/TelegramUI/Components/MediaScrubberComponent/Sources/MediaScrubberComponent.swift @@ -1890,8 +1890,8 @@ public class TrimView: UIView { effectiveHandleWidth = 16.0 fullTrackHeight = 33.0 capsuleOffset = 8.0 - color = .clear - highlightColor = .clear + color = theme.chat.inputPanel.panelControlAccentColor + highlightColor = theme.chat.inputPanel.panelControlAccentColor self.zoneView.backgroundColor = UIColor(white: 1.0, alpha: 0.4) @@ -1902,7 +1902,19 @@ public class TrimView: UIView { context.fill(CGRect(origin: .zero, size: CGSize(width: 1.0, height: size.height))) context.fill(CGRect(origin: CGPoint(x: size.width - 1.0, y: 0.0), size: CGSize(width: 1.0, height: size.height))) })?.withRenderingMode(.alwaysTemplate).resizableImage(withCapInsets: UIEdgeInsets(top: 0.0, left: 1.0, bottom: 0.0, right: 1.0)) - + + let handleImage = generateImage(CGSize(width: effectiveHandleWidth, height: fullTrackHeight), rotatedContext: { size, context in + context.clear(CGRect(origin: .zero, size: size)) + context.setFillColor(UIColor.white.cgColor) + + let path = UIBezierPath(roundedRect: CGRect(origin: .zero, size: CGSize(width: size.width * 2.0, height: size.height)), cornerRadius: 16.5) + context.addPath(path.cgPath) + context.fillPath() + })?.withRenderingMode(.alwaysTemplate) + + self.leftHandleView.image = handleImage + self.rightHandleView.image = handleImage + self.leftCapsuleView.backgroundColor = .white self.rightCapsuleView.backgroundColor = .white } diff --git a/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift b/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift index 3db8d6c396..52492030e1 100644 --- a/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift +++ b/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift @@ -1842,12 +1842,13 @@ public final class MessageInputPanelComponent: Component { } } - let lightFieldColor = UIColor(white: 1.0, alpha: 0.09) + var lightFieldColor = UIColor(white: 1.0, alpha: 0.09) var fieldBackgroundIsDark = false if component.useGrayBackground { fieldBackgroundIsDark = false } else if component.style == .media { fieldBackgroundIsDark = false + lightFieldColor = UIColor(white: 0.2, alpha: 0.45) } else if self.textFieldExternalState.hasText && component.alwaysDarkWhenHasText { fieldBackgroundIsDark = true } else if isEditing || component.style == .story || component.style == .editor { diff --git a/submodules/TelegramUI/Sources/OpenResolvedUrl.swift b/submodules/TelegramUI/Sources/OpenResolvedUrl.swift index 7cdcc9e4da..95321e6533 100644 --- a/submodules/TelegramUI/Sources/OpenResolvedUrl.swift +++ b/submodules/TelegramUI/Sources/OpenResolvedUrl.swift @@ -898,7 +898,7 @@ func openResolvedUrlImpl( func subject(for path: String) -> MediaEditorScreenImpl.Subject? { if path.hasSuffix(".jpg") { - if let image = UIImage(contentsOfFile: path) { + if let image = UIImage(contentsOfFile: path)?.fixedOrientation() { return .image(image: image, dimensions: PixelDimensions(image.size), additionalImage: nil, additionalImagePosition: .topLeft, fromCamera: false) } } else {