diff --git a/submodules/Components/SheetComponent/Sources/SheetComponent.swift b/submodules/Components/SheetComponent/Sources/SheetComponent.swift index 1841395688..8f1dd9b5fc 100644 --- a/submodules/Components/SheetComponent/Sources/SheetComponent.swift +++ b/submodules/Components/SheetComponent/Sources/SheetComponent.swift @@ -6,10 +6,12 @@ import ViewControllerComponent public final class SheetComponentEnvironment: Equatable { public let isDisplaying: Bool + public let isCentered: Bool public let dismiss: (Bool) -> Void - public init(isDisplaying: Bool, dismiss: @escaping (Bool) -> Void) { + public init(isDisplaying: Bool, isCentered: Bool, dismiss: @escaping (Bool) -> Void) { self.isDisplaying = isDisplaying + self.isCentered = isCentered self.dismiss = dismiss } @@ -17,6 +19,9 @@ public final class SheetComponentEnvironment: Equatable { if lhs.isDisplaying != rhs.isDisplaying { return false } + if lhs.isCentered != rhs.isCentered { + return false + } return true } } @@ -180,6 +185,7 @@ public final class SheetComponent: Component { private var currentAvailableSize: CGSize? func update(component: SheetComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: Transition) -> CGSize { + let sheetEnvironment = environment[SheetComponentEnvironment.self].value component.animateOut.connect { [weak self] completion in guard let strongSelf = self else { return @@ -195,19 +201,36 @@ public final class SheetComponent: Component { transition.setFrame(view: self.dimView, frame: CGRect(origin: CGPoint(), size: availableSize), completion: nil) + let containerSize: CGSize + if sheetEnvironment.isCentered { + let verticalInset: CGFloat = 44.0 + let maxSide = max(availableSize.width, availableSize.height) + let minSide = min(availableSize.width, availableSize.height) + containerSize = CGSize(width: min(availableSize.width - 20.0, floor(maxSide / 2.0)), height: min(availableSize.height, minSide) - verticalInset * 2.0) + } else { + containerSize = CGSize(width: availableSize.width, height: .greatestFiniteMagnitude) + } + let contentSize = self.contentView.update( transition: transition, component: component.content, environment: { environment[ChildEnvironmentType.self] }, - containerSize: CGSize(width: availableSize.width, height: .greatestFiniteMagnitude) + containerSize: containerSize ) self.ignoreScrolling = true - transition.setFrame(view: self.contentView, frame: CGRect(origin: .zero, size: contentSize), completion: nil) - transition.setFrame(view: self.backgroundView, frame: CGRect(origin: .zero, size: CGSize(width: contentSize.width, height: contentSize.height + 1000.0)), completion: nil) + + if sheetEnvironment.isCentered { + transition.setFrame(view: self.contentView, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((availableSize.width - contentSize.width) / 2.0), y: 0.0), size: contentSize), completion: nil) + transition.setFrame(view: self.backgroundView, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((availableSize.width - contentSize.width) / 2.0), y: floorToScreenPixels((availableSize.height - contentSize.height) / 2.0)), size: contentSize), completion: nil) + } else { + transition.setFrame(view: self.contentView, frame: CGRect(origin: .zero, size: contentSize), completion: nil) + transition.setFrame(view: self.backgroundView, frame: CGRect(origin: .zero, size: CGSize(width: contentSize.width, height: contentSize.height + 1000.0)), completion: nil) + } transition.setFrame(view: self.scrollView, frame: CGRect(origin: CGPoint(), size: availableSize), completion: nil) + self.scrollView.contentSize = contentSize self.scrollView.contentInset = UIEdgeInsets(top: max(0.0, availableSize.height - contentSize.height) + contentSize.height, left: 0.0, bottom: 0.0, right: 0.0) self.ignoreScrolling = false @@ -222,9 +245,8 @@ public final class SheetComponent: Component { } else if !environment[SheetComponentEnvironment.self].value.isDisplaying, self.previousIsDisplaying, let _ = transition.userData(ViewControllerComponentContainer.AnimateOutTransition.self) { self.animateOut(completion: {}) } - self.previousIsDisplaying = environment[SheetComponentEnvironment.self].value.isDisplaying - - self.dismiss = environment[SheetComponentEnvironment.self].value.dismiss + self.previousIsDisplaying = sheetEnvironment.isDisplaying + self.dismiss = sheetEnvironment.dismiss return availableSize } diff --git a/submodules/Components/ViewControllerComponent/Sources/ViewControllerComponent.swift b/submodules/Components/ViewControllerComponent/Sources/ViewControllerComponent.swift index ec7dc58860..fcf07de3f0 100644 --- a/submodules/Components/ViewControllerComponent/Sources/ViewControllerComponent.swift +++ b/submodules/Components/ViewControllerComponent/Sources/ViewControllerComponent.swift @@ -69,6 +69,7 @@ open class ViewControllerComponentContainer: ViewController { public let statusBarHeight: CGFloat public let navigationHeight: CGFloat public let safeInsets: UIEdgeInsets + public let metrics: LayoutMetrics public let isVisible: Bool public let theme: PresentationTheme public let strings: PresentationStrings @@ -79,6 +80,7 @@ open class ViewControllerComponentContainer: ViewController { statusBarHeight: CGFloat, navigationHeight: CGFloat, safeInsets: UIEdgeInsets, + metrics: LayoutMetrics, isVisible: Bool, theme: PresentationTheme, strings: PresentationStrings, @@ -88,6 +90,7 @@ open class ViewControllerComponentContainer: ViewController { self.statusBarHeight = statusBarHeight self.navigationHeight = navigationHeight self.safeInsets = safeInsets + self.metrics = metrics self.isVisible = isVisible self.theme = theme self.strings = strings @@ -109,6 +112,9 @@ open class ViewControllerComponentContainer: ViewController { if lhs.safeInsets != rhs.safeInsets { return false } + if lhs.metrics != rhs.metrics { + return false + } if lhs.isVisible != rhs.isVisible { return false } @@ -164,6 +170,7 @@ open class ViewControllerComponentContainer: ViewController { statusBarHeight: layout.statusBarHeight ?? 0.0, navigationHeight: navigationHeight, safeInsets: UIEdgeInsets(top: layout.intrinsicInsets.top + layout.safeInsets.top, left: layout.safeInsets.left, bottom: layout.intrinsicInsets.bottom + layout.safeInsets.bottom, right: layout.safeInsets.right), + metrics: layout.metrics, isVisible: self.currentIsVisible, theme: self.theme ?? self.presentationData.theme, strings: self.presentationData.strings, diff --git a/submodules/ComposePollUI/Sources/CreatePollController.swift b/submodules/ComposePollUI/Sources/CreatePollController.swift index f3fa5ebba8..b7d9c384e9 100644 --- a/submodules/ComposePollUI/Sources/CreatePollController.swift +++ b/submodules/ComposePollUI/Sources/CreatePollController.swift @@ -798,8 +798,8 @@ public func createPollController(context: AccountContext, updatedPresentationDat ) |> map { presentationData, state, limitsConfiguration -> (ItemListControllerState, (ItemListNodeState, Any)) in var presentationData = presentationData - if presentationData.theme.list.blocksBackgroundColor.rgb == 0x000000 { - let updatedTheme = presentationData.theme.withInvertedBlocksBackground() + if presentationData.theme.list.blocksBackgroundColor.rgb == presentationData.theme.list.plainBackgroundColor.rgb { + let updatedTheme = presentationData.theme.withModalBlocksBackground() presentationData = presentationData.withUpdated(theme: updatedTheme) } diff --git a/submodules/PaymentMethodUI/Sources/AddPaymentMethodSheetScreen.swift b/submodules/PaymentMethodUI/Sources/AddPaymentMethodSheetScreen.swift index 444c79c5c5..6b4004236a 100644 --- a/submodules/PaymentMethodUI/Sources/AddPaymentMethodSheetScreen.swift +++ b/submodules/PaymentMethodUI/Sources/AddPaymentMethodSheetScreen.swift @@ -207,6 +207,7 @@ private final class AddPaymentMethodSheetComponent: CombinedComponent { environment SheetComponentEnvironment( isDisplaying: environment.value.isVisible, + isCentered: false, dismiss: { animated in if animated { animateOut.invoke(Action { _ in diff --git a/submodules/PremiumUI/Sources/PremiumDemoScreen.swift b/submodules/PremiumUI/Sources/PremiumDemoScreen.swift index 327de73c3b..d5d47acc03 100644 --- a/submodules/PremiumUI/Sources/PremiumDemoScreen.swift +++ b/submodules/PremiumUI/Sources/PremiumDemoScreen.swift @@ -1102,6 +1102,7 @@ private final class DemoSheetComponent: CombinedComponent { environment SheetComponentEnvironment( isDisplaying: environment.value.isVisible, + isCentered: environment.metrics.widthClass == .regular, dismiss: { animated in if animated { animateOut.invoke(Action { _ in diff --git a/submodules/PremiumUI/Sources/PremiumIntroScreen.swift b/submodules/PremiumUI/Sources/PremiumIntroScreen.swift index 0de0d55b49..3f9a4bb8e7 100644 --- a/submodules/PremiumUI/Sources/PremiumIntroScreen.swift +++ b/submodules/PremiumUI/Sources/PremiumIntroScreen.swift @@ -654,7 +654,7 @@ private final class PerkComponent: CombinedComponent { static var body: Body { let iconBackground = Child(RoundedRectangle.self) let icon = Child(BundleIconComponent.self) - let title = Child(Text.self) + let title = Child(MultilineTextComponent.self) let subtitle = Child(MultilineTextComponent.self) let arrow = Child(BundleIconComponent.self) @@ -665,7 +665,7 @@ private final class PerkComponent: CombinedComponent { let iconTopInset: CGFloat = 15.0 let textTopInset: CGFloat = 9.0 let textBottomInset: CGFloat = 9.0 - let spacing: CGFloat = 3.0 + let spacing: CGFloat = 2.0 let iconSize = CGSize(width: 30.0, height: 30.0) let iconBackground = iconBackground.update( @@ -695,10 +695,16 @@ private final class PerkComponent: CombinedComponent { ) let title = title.update( - component: Text( - text: component.title, - font: Font.regular(17.0), - color: component.titleColor + component: MultilineTextComponent( + text: .plain( + NSAttributedString( + string: component.title, + font: Font.regular(17), + textColor: component.titleColor + ) + ), + maximumNumberOfLines: 0, + lineSpacing: 0.1 ), availableSize: CGSize(width: context.availableSize.width - iconBackground.size.width - sideInset * 2.83, height: context.availableSize.height), transition: context.transition diff --git a/submodules/PremiumUI/Sources/PremiumLimitScreen.swift b/submodules/PremiumUI/Sources/PremiumLimitScreen.swift index 89e3c65778..39abd2487e 100644 --- a/submodules/PremiumUI/Sources/PremiumLimitScreen.swift +++ b/submodules/PremiumUI/Sources/PremiumLimitScreen.swift @@ -1006,6 +1006,7 @@ private final class LimitSheetComponent: CombinedComponent { environment SheetComponentEnvironment( isDisplaying: environment.value.isVisible, + isCentered: environment.metrics.widthClass == .regular, dismiss: { animated in if animated { animateOut.invoke(Action { _ in diff --git a/submodules/PremiumUI/Sources/PremiumLimitsListScreen.swift b/submodules/PremiumUI/Sources/PremiumLimitsListScreen.swift index e4f47cf261..9c083cf901 100644 --- a/submodules/PremiumUI/Sources/PremiumLimitsListScreen.swift +++ b/submodules/PremiumUI/Sources/PremiumLimitsListScreen.swift @@ -617,16 +617,20 @@ public class PremimLimitsListScreen: ViewController { transition.setFrame(view: self.containerView, frame: clipFrame) transition.setFrame(view: self.scrollView, frame: CGRect(origin: CGPoint(), size: clipFrame.size), completion: nil) - let clipLayout = layout.withUpdatedSize(clipFrame.size) + var clipLayout = layout.withUpdatedSize(clipFrame.size) + if case .regular = layout.metrics.widthClass { + clipLayout = clipLayout.withUpdatedIntrinsicInsets(.zero) + } let footerHeight = self.footerNode.updateLayout(layout: clipLayout, transition: .immediate) - let convertedFooterFrame = self.view.convert(CGRect(origin: CGPoint(x: 0.0, y: layout.size.height - footerHeight), size: CGSize(width: clipFrame.width, height: footerHeight)), to: self.containerView) + let convertedFooterFrame = self.view.convert(CGRect(origin: CGPoint(x: clipFrame.minX, y: clipFrame.maxY - footerHeight), size: CGSize(width: clipFrame.width, height: footerHeight)), to: self.containerView) transition.setFrame(view: self.footerNode.view, frame: convertedFooterFrame) let environment = ViewControllerComponentContainer.Environment( statusBarHeight: 0.0, navigationHeight: navigationHeight, safeInsets: UIEdgeInsets(top: layout.intrinsicInsets.top + layout.safeInsets.top, left: layout.safeInsets.left, bottom: footerHeight, right: layout.safeInsets.right), + metrics: layout.metrics, isVisible: self.currentIsVisible, theme: self.theme ?? self.presentationData.theme, strings: self.presentationData.strings, diff --git a/submodules/TabBarUI/Sources/TabBarNode.swift b/submodules/TabBarUI/Sources/TabBarNode.swift index 2251a7ee7e..86ebf72173 100644 --- a/submodules/TabBarUI/Sources/TabBarNode.swift +++ b/submodules/TabBarUI/Sources/TabBarNode.swift @@ -576,7 +576,7 @@ class TabBarNode: ASDisplayNode { ContainedViewLayoutTransition.animated(duration: 0.2, curve: .easeInOut).updateTransformScale(node: node.ringImageNode, scale: 1.0, delay: 0.1) node.imageNode.layer.animateScale(from: 1.0, to: 0.87, duration: 0.1, removeOnCompletion: false, completion: { [weak node] _ in - node?.imageNode.layer.animateScale(from: 0.87, to: 1.0, duration: 0.2, removeOnCompletion: false, completion: { [weak node] _ in + node?.imageNode.layer.animateScale(from: 0.87, to: 1.0, duration: 0.14, removeOnCompletion: false, completion: { [weak node] _ in node?.imageNode.layer.removeAllAnimations() }) }) diff --git a/submodules/TelegramCallsUI/Sources/CallControllerNode.swift b/submodules/TelegramCallsUI/Sources/CallControllerNode.swift index f7baacd111..b612a9711e 100644 --- a/submodules/TelegramCallsUI/Sources/CallControllerNode.swift +++ b/submodules/TelegramCallsUI/Sources/CallControllerNode.swift @@ -16,6 +16,7 @@ import TooltipUI import AlertUI import PresentationDataUtils import DeviceAccess +import ContextUI private func interpolateFrame(from fromValue: CGRect, to toValue: CGRect, t: CGFloat) -> CGRect { return CGRect(x: floorToScreenPixels(toValue.origin.x * t + fromValue.origin.x * (1.0 - t)), y: floorToScreenPixels(toValue.origin.y * t + fromValue.origin.y * (1.0 - t)), width: floorToScreenPixels(toValue.size.width * t + fromValue.size.width * (1.0 - t)), height: floorToScreenPixels(toValue.size.height * t + fromValue.size.height * (1.0 - t))) @@ -200,17 +201,9 @@ private final class CallVideoNode: ASDisplayNode, PreviewVideoNode { case .rotation90: rotationAngle = CGFloat.pi / 2.0 case .rotation180: -// if isCompactLayout { - rotationAngle = CGFloat.pi -// } else { -// rotationAngle = 0.0 -// } + rotationAngle = CGFloat.pi case .rotation270: -// if isCompactLayout { - rotationAngle = -CGFloat.pi / 2.0 -// } else { -// rotationAngle = CGFloat.pi / 2.0 -// } + rotationAngle = -CGFloat.pi / 2.0 } var additionalAngle: CGFloat = 0.0 @@ -375,6 +368,7 @@ final class CallControllerNode: ViewControllerTracingNode, CallControllerNodePro private let containerTransformationNode: ASDisplayNode private let containerNode: ASDisplayNode + private let videoContainerNode: PinchSourceContainerNode private let imageNode: TransformImageNode private let dimNode: ASImageNode @@ -397,7 +391,7 @@ final class CallControllerNode: ViewControllerTracingNode, CallControllerNodePro private var displayedCameraConfirmation: Bool = false private var displayedCameraTooltip: Bool = false - + private var expandedVideoNode: CallVideoNode? private var minimizedVideoNode: CallVideoNode? private var disableAnimationForExpandedVideoOnce: Bool = false @@ -455,6 +449,7 @@ final class CallControllerNode: ViewControllerTracingNode, CallControllerNodePro private var isUIHidden: Bool = false private var isVideoPaused: Bool = false + private var isVideoPinched: Bool = false private enum PictureInPictureGestureState { case none @@ -486,6 +481,8 @@ final class CallControllerNode: ViewControllerTracingNode, CallControllerNodePro self.containerNode = ASDisplayNode() + self.videoContainerNode = PinchSourceContainerNode() + self.imageNode = TransformImageNode() self.imageNode.contentAnimations = [.subsequentUpdates] self.dimNode = ASImageNode() @@ -531,6 +528,7 @@ final class CallControllerNode: ViewControllerTracingNode, CallControllerNodePro } self.containerNode.addSubnode(self.imageNode) + self.containerNode.addSubnode(self.videoContainerNode) self.containerNode.addSubnode(self.dimNode) self.containerNode.addSubnode(self.statusNode) self.containerNode.addSubnode(self.buttonsNode) @@ -711,6 +709,40 @@ final class CallControllerNode: ViewControllerTracingNode, CallControllerNodePro } } }) + + self.videoContainerNode.activate = { [weak self] sourceNode in + guard let strongSelf = self else { + return + } + let pinchController = PinchController(sourceNode: sourceNode, getContentAreaInScreenSpace: { + return UIScreen.main.bounds + }) + strongSelf.sharedContext.mainWindow?.presentInGlobalOverlay(pinchController) + strongSelf.isVideoPinched = true + + strongSelf.videoContainerNode.contentNode.clipsToBounds = true + strongSelf.videoContainerNode.backgroundColor = .black + + if let (layout, navigationBarHeight) = strongSelf.validLayout { + strongSelf.videoContainerNode.contentNode.cornerRadius = layout.deviceMetrics.screenCornerRadius + + strongSelf.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .immediate) + } + } + + self.videoContainerNode.animatedOut = { [weak self] in + guard let strongSelf = self else { + return + } + strongSelf.isVideoPinched = false + + strongSelf.videoContainerNode.backgroundColor = .clear + strongSelf.videoContainerNode.contentNode.cornerRadius = 0.0 + + if let (layout, navigationBarHeight) = strongSelf.validLayout { + strongSelf.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .animated(duration: 0.3, curve: .easeInOut)) + } + } } deinit { @@ -830,9 +862,9 @@ final class CallControllerNode: ViewControllerTracingNode, CallControllerNodePro strongSelf.incomingVideoNodeValue = incomingVideoNode if let expandedVideoNode = strongSelf.expandedVideoNode { strongSelf.minimizedVideoNode = expandedVideoNode - strongSelf.containerNode.insertSubnode(incomingVideoNode, belowSubnode: expandedVideoNode) + strongSelf.videoContainerNode.contentNode.insertSubnode(incomingVideoNode, belowSubnode: expandedVideoNode) } else { - strongSelf.containerNode.insertSubnode(incomingVideoNode, belowSubnode: strongSelf.dimNode) + strongSelf.videoContainerNode.contentNode.addSubnode(incomingVideoNode) } strongSelf.expandedVideoNode = incomingVideoNode strongSelf.updateButtonsMode(transition: .animated(duration: 0.4, curve: .spring)) @@ -914,10 +946,10 @@ final class CallControllerNode: ViewControllerTracingNode, CallControllerNodePro strongSelf.outgoingVideoNodeValue = outgoingVideoNode if let expandedVideoNode = strongSelf.expandedVideoNode { strongSelf.minimizedVideoNode = outgoingVideoNode - strongSelf.containerNode.insertSubnode(outgoingVideoNode, aboveSubnode: expandedVideoNode) + strongSelf.videoContainerNode.contentNode.insertSubnode(outgoingVideoNode, aboveSubnode: expandedVideoNode) } else { strongSelf.expandedVideoNode = outgoingVideoNode - strongSelf.containerNode.insertSubnode(outgoingVideoNode, belowSubnode: strongSelf.dimNode) + strongSelf.videoContainerNode.contentNode.addSubnode(outgoingVideoNode) } strongSelf.updateButtonsMode(transition: .animated(duration: 0.4, curve: .spring)) @@ -1140,6 +1172,9 @@ final class CallControllerNode: ViewControllerTracingNode, CallControllerNodePro } self.callEnded?(presentRating) } + + let hasIncomingVideoNode = self.incomingVideoNodeValue != nil && self.expandedVideoNode === self.incomingVideoNodeValue + self.videoContainerNode.isPinchGestureEnabled = hasIncomingVideoNode } private func updateToastContent() { @@ -1481,6 +1516,8 @@ final class CallControllerNode: ViewControllerTracingNode, CallControllerNodePro let pipTransitionAlpha: CGFloat = 1.0 - self.pictureInPictureTransitionFraction uiDisplayTransition *= pipTransitionAlpha + let pinchTransitionAlpha: CGFloat = self.isVideoPinched ? 0.0 : 1.0 + let previousVideoButtonFrame = self.buttonsNode.videoButtonFrame().flatMap { frame -> CGRect in return self.buttonsNode.view.convert(frame, to: self.view) } @@ -1501,8 +1538,8 @@ final class CallControllerNode: ViewControllerTracingNode, CallControllerNodePro let toastCollapsedOriginY = self.pictureInPictureTransitionFraction > 0.0 ? layout.size.height : layout.size.height - max(layout.intrinsicInsets.bottom, 20.0) - toastHeight let toastOriginY = interpolate(from: toastCollapsedOriginY, to: defaultButtonsOriginY - toastSpacing - toastHeight, value: uiDisplayTransition) - var overlayAlpha: CGFloat = uiDisplayTransition - var toastAlpha: CGFloat = pipTransitionAlpha + var overlayAlpha: CGFloat = min(pinchTransitionAlpha, uiDisplayTransition) + var toastAlpha: CGFloat = min(pinchTransitionAlpha, pipTransitionAlpha) switch self.callState?.state { case .terminated, .terminating: @@ -1522,14 +1559,18 @@ final class CallControllerNode: ViewControllerTracingNode, CallControllerNodePro transition.updateCornerRadius(layer: self.containerTransformationNode.layer, cornerRadius: self.pictureInPictureTransitionFraction * 10.0) transition.updateFrame(node: self.containerNode, frame: CGRect(origin: CGPoint(x: (containerFrame.width - layout.size.width) / 2.0, y: floor(containerFrame.height - layout.size.height) / 2.0), size: layout.size)) - transition.updateFrame(node: self.dimNode, frame: CGRect(origin: CGPoint(), size: layout.size)) + transition.updateFrame(node: self.videoContainerNode, frame: containerFullScreenFrame) + self.videoContainerNode.update(size: containerFullScreenFrame.size, transition: transition) + + transition.updateAlpha(node: self.dimNode, alpha: pinchTransitionAlpha) + transition.updateFrame(node: self.dimNode, frame: containerFullScreenFrame) if let keyPreviewNode = self.keyPreviewNode { - transition.updateFrame(node: keyPreviewNode, frame: CGRect(origin: CGPoint(), size: layout.size)) + transition.updateFrame(node: keyPreviewNode, frame: containerFullScreenFrame) keyPreviewNode.updateLayout(size: layout.size, transition: .immediate) } - transition.updateFrame(node: self.imageNode, frame: CGRect(origin: CGPoint(), size: layout.size)) + transition.updateFrame(node: self.imageNode, frame: containerFullScreenFrame) let arguments = TransformImageArguments(corners: ImageCorners(), imageSize: CGSize(width: 640.0, height: 640.0).aspectFilled(layout.size), boundingSize: layout.size, intrinsicInsets: UIEdgeInsets()) let apply = self.imageNode.asyncLayout()(arguments) apply() @@ -1574,8 +1615,7 @@ final class CallControllerNode: ViewControllerTracingNode, CallControllerNodePro transition.updateFrame(node: self.buttonsNode, frame: CGRect(origin: CGPoint(x: 0.0, y: buttonsOriginY), size: CGSize(width: layout.size.width, height: buttonsHeight))) transition.updateAlpha(node: self.buttonsNode, alpha: overlayAlpha) - let fullscreenVideoFrame = CGRect(origin: CGPoint(), size: layout.size) - + let fullscreenVideoFrame = containerFullScreenFrame let previewVideoFrame = self.calculatePreviewVideoRect(layout: layout, navigationHeight: navigationBarHeight) if let removedMinimizedVideoNodeValue = self.removedMinimizedVideoNodeValue { @@ -1640,7 +1680,7 @@ final class CallControllerNode: ViewControllerTracingNode, CallControllerNodePro if let minimizedVideoNode = self.minimizedVideoNode { - transition.updateAlpha(node: minimizedVideoNode, alpha: pipTransitionAlpha) + transition.updateAlpha(node: minimizedVideoNode, alpha: min(pipTransitionAlpha, pinchTransitionAlpha)) var minimizedVideoTransition = transition var didAppear = false if minimizedVideoNode.frame.isEmpty { diff --git a/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift b/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift index 3b9353eac5..6d186f0120 100644 --- a/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift @@ -376,6 +376,7 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati let list = PresentationThemeList( blocksBackgroundColor: UIColor(rgb: 0x000000), + modalBlocksBackgroundColor: UIColor(rgb: 0x1c1c1d), plainBackgroundColor: UIColor(rgb: 0x000000), itemPrimaryTextColor: UIColor(rgb: 0xffffff), itemSecondaryTextColor: UIColor(rgb: 0x98989e), @@ -385,6 +386,7 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati itemDestructiveColor: UIColor(rgb: 0xeb5545), itemPlaceholderTextColor: UIColor(rgb: 0x4d4d4d), itemBlocksBackgroundColor: UIColor(rgb: 0x1c1c1d), + itemModalBlocksBackgroundColor: UIColor(rgb: 0x2c2c2e), itemHighlightedBackgroundColor: UIColor(rgb: 0x313135), itemBlocksSeparatorColor: UIColor(rgb: 0x3d3d40), itemPlainSeparatorColor: UIColor(rgb: 0x3d3d40), diff --git a/submodules/TelegramPresentationData/Sources/DefaultDarkTintedPresentationTheme.swift b/submodules/TelegramPresentationData/Sources/DefaultDarkTintedPresentationTheme.swift index 72fed52de5..234bfd7798 100644 --- a/submodules/TelegramPresentationData/Sources/DefaultDarkTintedPresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/DefaultDarkTintedPresentationTheme.swift @@ -604,6 +604,7 @@ public func makeDefaultDarkTintedPresentationTheme(extendingThemeReference: Pres let list = PresentationThemeList( blocksBackgroundColor: additionalBackgroundColor, + modalBlocksBackgroundColor: additionalBackgroundColor, plainBackgroundColor: additionalBackgroundColor, itemPrimaryTextColor: UIColor(rgb: 0xffffff), itemSecondaryTextColor: mainSecondaryTextColor.withAlphaComponent(0.5), @@ -613,6 +614,7 @@ public func makeDefaultDarkTintedPresentationTheme(extendingThemeReference: Pres itemDestructiveColor: UIColor(rgb: 0xff6767), itemPlaceholderTextColor: mainSecondaryTextColor.withAlphaComponent(0.5), itemBlocksBackgroundColor: mainBackgroundColor, + itemModalBlocksBackgroundColor: mainBackgroundColor, itemHighlightedBackgroundColor: mainSelectionColor, itemBlocksSeparatorColor: mainSeparatorColor, itemPlainSeparatorColor: mainSeparatorColor, diff --git a/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift b/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift index 29264c7f62..573f275c9f 100644 --- a/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift @@ -447,6 +447,7 @@ public func makeDefaultDayPresentationTheme(extendingThemeReference: Presentatio let list = PresentationThemeList( blocksBackgroundColor: UIColor(rgb: 0xefeff4), + modalBlocksBackgroundColor: UIColor(rgb: 0xefeff4), plainBackgroundColor: UIColor(rgb: 0xffffff), itemPrimaryTextColor: UIColor(rgb: 0x000000), itemSecondaryTextColor: UIColor(rgb: 0x8e8e93), @@ -456,6 +457,7 @@ public func makeDefaultDayPresentationTheme(extendingThemeReference: Presentatio itemDestructiveColor: UIColor(rgb: 0xff3b30), itemPlaceholderTextColor: UIColor(rgb: 0xc8c8ce), itemBlocksBackgroundColor: UIColor(rgb: 0xffffff), + itemModalBlocksBackgroundColor: UIColor(rgb: 0xffffff), itemHighlightedBackgroundColor: UIColor(rgb: 0xe5e5ea), itemBlocksSeparatorColor: UIColor(rgb: 0xc8c7cc), itemPlainSeparatorColor: UIColor(rgb: 0xc8c7cc), diff --git a/submodules/TelegramPresentationData/Sources/PresentationTheme.swift b/submodules/TelegramPresentationData/Sources/PresentationTheme.swift index 23e60ea57f..85cbcefa86 100644 --- a/submodules/TelegramPresentationData/Sources/PresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/PresentationTheme.swift @@ -428,6 +428,7 @@ public final class PresentationThemeList { public let blocksBackgroundColor: UIColor public let plainBackgroundColor: UIColor + public let modalBlocksBackgroundColor: UIColor public let itemPrimaryTextColor: UIColor public let itemSecondaryTextColor: UIColor public let itemDisabledTextColor: UIColor @@ -436,6 +437,7 @@ public final class PresentationThemeList { public let itemDestructiveColor: UIColor public let itemPlaceholderTextColor: UIColor public let itemBlocksBackgroundColor: UIColor + public let itemModalBlocksBackgroundColor: UIColor public let itemHighlightedBackgroundColor: UIColor public let itemBlocksSeparatorColor: UIColor public let itemPlainSeparatorColor: UIColor @@ -461,6 +463,7 @@ public final class PresentationThemeList { public init( blocksBackgroundColor: UIColor, + modalBlocksBackgroundColor: UIColor, plainBackgroundColor: UIColor, itemPrimaryTextColor: UIColor, itemSecondaryTextColor: UIColor, @@ -470,6 +473,7 @@ public final class PresentationThemeList { itemDestructiveColor: UIColor, itemPlaceholderTextColor: UIColor, itemBlocksBackgroundColor: UIColor, + itemModalBlocksBackgroundColor: UIColor, itemHighlightedBackgroundColor: UIColor, itemBlocksSeparatorColor: UIColor, itemPlainSeparatorColor: UIColor, @@ -494,6 +498,7 @@ public final class PresentationThemeList { paymentOption: PaymentOption ) { self.blocksBackgroundColor = blocksBackgroundColor + self.modalBlocksBackgroundColor = modalBlocksBackgroundColor self.plainBackgroundColor = plainBackgroundColor self.itemPrimaryTextColor = itemPrimaryTextColor self.itemSecondaryTextColor = itemSecondaryTextColor @@ -505,6 +510,7 @@ public final class PresentationThemeList { self.itemBlocksBackgroundColor = itemBlocksBackgroundColor self.itemHighlightedBackgroundColor = itemHighlightedBackgroundColor self.itemBlocksSeparatorColor = itemBlocksSeparatorColor + self.itemModalBlocksBackgroundColor = itemModalBlocksBackgroundColor self.itemPlainSeparatorColor = itemPlainSeparatorColor self.disclosureArrowColor = disclosureArrowColor self.sectionHeaderTextColor = sectionHeaderTextColor @@ -527,8 +533,8 @@ public final class PresentationThemeList { self.paymentOption = paymentOption } - public func withUpdated(blocksBackgroundColor: UIColor? = nil, plainBackgroundColor: UIColor? = nil, itemPrimaryTextColor: UIColor? = nil, itemSecondaryTextColor: UIColor? = nil, itemDisabledTextColor: UIColor? = nil, itemAccentColor: UIColor? = nil, itemHighlightedColor: UIColor? = nil, itemDestructiveColor: UIColor? = nil, itemPlaceholderTextColor: UIColor? = nil, itemBlocksBackgroundColor: UIColor? = nil, itemHighlightedBackgroundColor: UIColor? = nil, itemBlocksSeparatorColor: UIColor? = nil, itemPlainSeparatorColor: UIColor? = nil, disclosureArrowColor: UIColor? = nil, sectionHeaderTextColor: UIColor? = nil, freeTextColor: UIColor? = nil, freeTextErrorColor: UIColor? = nil, freeTextSuccessColor: UIColor? = nil, freeMonoIconColor: UIColor? = nil, itemSwitchColors: PresentationThemeSwitch? = nil, itemDisclosureActions: PresentationThemeItemDisclosureActions? = nil, itemCheckColors: PresentationThemeFillStrokeForeground? = nil, controlSecondaryColor: UIColor? = nil, freeInputField: PresentationInputFieldTheme? = nil, freePlainInputField: PresentationInputFieldTheme? = nil, mediaPlaceholderColor: UIColor? = nil, scrollIndicatorColor: UIColor? = nil, pageIndicatorInactiveColor: UIColor? = nil, inputClearButtonColor: UIColor? = nil, itemBarChart: PresentationThemeItemBarChart? = nil, itemInputField: PresentationInputFieldTheme? = nil, paymentOption: PaymentOption? = nil) -> PresentationThemeList { - return PresentationThemeList(blocksBackgroundColor: blocksBackgroundColor ?? self.blocksBackgroundColor, plainBackgroundColor: plainBackgroundColor ?? self.plainBackgroundColor, itemPrimaryTextColor: itemPrimaryTextColor ?? self.itemPrimaryTextColor, itemSecondaryTextColor: itemSecondaryTextColor ?? self.itemSecondaryTextColor, itemDisabledTextColor: itemDisabledTextColor ?? self.itemDisabledTextColor, itemAccentColor: itemAccentColor ?? self.itemAccentColor, itemHighlightedColor: itemHighlightedColor ?? self.itemHighlightedColor, itemDestructiveColor: itemDestructiveColor ?? self.itemDestructiveColor, itemPlaceholderTextColor: itemPlaceholderTextColor ?? self.itemPlaceholderTextColor, itemBlocksBackgroundColor: itemBlocksBackgroundColor ?? self.itemBlocksBackgroundColor, itemHighlightedBackgroundColor: itemHighlightedBackgroundColor ?? self.itemHighlightedBackgroundColor, itemBlocksSeparatorColor: itemBlocksSeparatorColor ?? self.itemBlocksSeparatorColor, itemPlainSeparatorColor: itemPlainSeparatorColor ?? self.itemPlainSeparatorColor, disclosureArrowColor: disclosureArrowColor ?? self.disclosureArrowColor, sectionHeaderTextColor: sectionHeaderTextColor ?? self.sectionHeaderTextColor, freeTextColor: freeTextColor ?? self.freeTextColor, freeTextErrorColor: freeTextErrorColor ?? self.freeTextErrorColor, freeTextSuccessColor: freeTextSuccessColor ?? self.freeTextSuccessColor, freeMonoIconColor: freeMonoIconColor ?? self.freeMonoIconColor, itemSwitchColors: itemSwitchColors ?? self.itemSwitchColors, itemDisclosureActions: itemDisclosureActions ?? self.itemDisclosureActions, itemCheckColors: itemCheckColors ?? self.itemCheckColors, controlSecondaryColor: controlSecondaryColor ?? self.controlSecondaryColor, freeInputField: freeInputField ?? self.freeInputField, freePlainInputField: freePlainInputField ?? self.freePlainInputField, mediaPlaceholderColor: mediaPlaceholderColor ?? self.mediaPlaceholderColor, scrollIndicatorColor: scrollIndicatorColor ?? self.scrollIndicatorColor, pageIndicatorInactiveColor: pageIndicatorInactiveColor ?? self.pageIndicatorInactiveColor, inputClearButtonColor: inputClearButtonColor ?? self.inputClearButtonColor, itemBarChart: itemBarChart ?? self.itemBarChart, itemInputField: itemInputField ?? self.itemInputField, paymentOption: paymentOption ?? self.paymentOption) + public func withUpdated(blocksBackgroundColor: UIColor? = nil, modalBlocksBackgroundColor: UIColor? = nil, plainBackgroundColor: UIColor? = nil, itemPrimaryTextColor: UIColor? = nil, itemSecondaryTextColor: UIColor? = nil, itemDisabledTextColor: UIColor? = nil, itemAccentColor: UIColor? = nil, itemHighlightedColor: UIColor? = nil, itemDestructiveColor: UIColor? = nil, itemPlaceholderTextColor: UIColor? = nil, itemBlocksBackgroundColor: UIColor? = nil, itemModalBlocksBackgroundColor: UIColor? = nil, itemHighlightedBackgroundColor: UIColor? = nil, itemBlocksSeparatorColor: UIColor? = nil, itemPlainSeparatorColor: UIColor? = nil, disclosureArrowColor: UIColor? = nil, sectionHeaderTextColor: UIColor? = nil, freeTextColor: UIColor? = nil, freeTextErrorColor: UIColor? = nil, freeTextSuccessColor: UIColor? = nil, freeMonoIconColor: UIColor? = nil, itemSwitchColors: PresentationThemeSwitch? = nil, itemDisclosureActions: PresentationThemeItemDisclosureActions? = nil, itemCheckColors: PresentationThemeFillStrokeForeground? = nil, controlSecondaryColor: UIColor? = nil, freeInputField: PresentationInputFieldTheme? = nil, freePlainInputField: PresentationInputFieldTheme? = nil, mediaPlaceholderColor: UIColor? = nil, scrollIndicatorColor: UIColor? = nil, pageIndicatorInactiveColor: UIColor? = nil, inputClearButtonColor: UIColor? = nil, itemBarChart: PresentationThemeItemBarChart? = nil, itemInputField: PresentationInputFieldTheme? = nil, paymentOption: PaymentOption? = nil) -> PresentationThemeList { + return PresentationThemeList(blocksBackgroundColor: blocksBackgroundColor ?? self.blocksBackgroundColor, modalBlocksBackgroundColor: modalBlocksBackgroundColor ?? self.modalBlocksBackgroundColor, plainBackgroundColor: plainBackgroundColor ?? self.plainBackgroundColor, itemPrimaryTextColor: itemPrimaryTextColor ?? self.itemPrimaryTextColor, itemSecondaryTextColor: itemSecondaryTextColor ?? self.itemSecondaryTextColor, itemDisabledTextColor: itemDisabledTextColor ?? self.itemDisabledTextColor, itemAccentColor: itemAccentColor ?? self.itemAccentColor, itemHighlightedColor: itemHighlightedColor ?? self.itemHighlightedColor, itemDestructiveColor: itemDestructiveColor ?? self.itemDestructiveColor, itemPlaceholderTextColor: itemPlaceholderTextColor ?? self.itemPlaceholderTextColor, itemBlocksBackgroundColor: itemBlocksBackgroundColor ?? self.itemBlocksBackgroundColor, itemModalBlocksBackgroundColor: itemModalBlocksBackgroundColor ?? self.itemModalBlocksBackgroundColor, itemHighlightedBackgroundColor: itemHighlightedBackgroundColor ?? self.itemHighlightedBackgroundColor, itemBlocksSeparatorColor: itemBlocksSeparatorColor ?? self.itemBlocksSeparatorColor, itemPlainSeparatorColor: itemPlainSeparatorColor ?? self.itemPlainSeparatorColor, disclosureArrowColor: disclosureArrowColor ?? self.disclosureArrowColor, sectionHeaderTextColor: sectionHeaderTextColor ?? self.sectionHeaderTextColor, freeTextColor: freeTextColor ?? self.freeTextColor, freeTextErrorColor: freeTextErrorColor ?? self.freeTextErrorColor, freeTextSuccessColor: freeTextSuccessColor ?? self.freeTextSuccessColor, freeMonoIconColor: freeMonoIconColor ?? self.freeMonoIconColor, itemSwitchColors: itemSwitchColors ?? self.itemSwitchColors, itemDisclosureActions: itemDisclosureActions ?? self.itemDisclosureActions, itemCheckColors: itemCheckColors ?? self.itemCheckColors, controlSecondaryColor: controlSecondaryColor ?? self.controlSecondaryColor, freeInputField: freeInputField ?? self.freeInputField, freePlainInputField: freePlainInputField ?? self.freePlainInputField, mediaPlaceholderColor: mediaPlaceholderColor ?? self.mediaPlaceholderColor, scrollIndicatorColor: scrollIndicatorColor ?? self.scrollIndicatorColor, pageIndicatorInactiveColor: pageIndicatorInactiveColor ?? self.pageIndicatorInactiveColor, inputClearButtonColor: inputClearButtonColor ?? self.inputClearButtonColor, itemBarChart: itemBarChart ?? self.itemBarChart, itemInputField: itemInputField ?? self.itemInputField, paymentOption: paymentOption ?? self.paymentOption) } } @@ -1479,8 +1485,8 @@ public final class PresentationTheme: Equatable { return PresentationTheme(name: self.name, index: self.index, referenceTheme: self.referenceTheme, overallDarkAppearance: self.overallDarkAppearance, intro: self.intro, passcode: self.passcode, rootController: self.rootController, list: self.list, chatList: self.chatList, chat: self.chat, actionSheet: self.actionSheet, contextMenu: self.contextMenu, inAppNotification: self.inAppNotification, chart: self.chart, preview: preview) } - public func withInvertedBlocksBackground() -> PresentationTheme { - let list = self.list.withUpdated(blocksBackgroundColor: self.list.itemBlocksBackgroundColor, itemBlocksBackgroundColor: self.list.blocksBackgroundColor) + public func withModalBlocksBackground() -> PresentationTheme { + let list = self.list.withUpdated(blocksBackgroundColor: self.list.modalBlocksBackgroundColor, itemBlocksBackgroundColor: self.list.itemModalBlocksBackgroundColor) return PresentationTheme(name: self.name, index: self.index, referenceTheme: self.referenceTheme, overallDarkAppearance: self.overallDarkAppearance, intro: self.intro, passcode: self.passcode, rootController: self.rootController, list: list, chatList: self.chatList, chat: self.chat, actionSheet: self.actionSheet, contextMenu: self.contextMenu, inAppNotification: self.inAppNotification, chart: self.chart, preview: self.preview) } } diff --git a/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift b/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift index f69eae26b8..fcd002deb2 100644 --- a/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift +++ b/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift @@ -813,6 +813,7 @@ extension PresentationThemeList.PaymentOption: Codable { extension PresentationThemeList: Codable { enum CodingKeys: String, CodingKey { case blocksBg + case modalBlocksBg case plainBg case primaryText case secondaryText @@ -822,6 +823,7 @@ extension PresentationThemeList: Codable { case destructive case placeholderText case itemBlocksBg + case itemModalBlocksBg case itemHighlightedBg case blocksSeparator case plainSeparator @@ -848,6 +850,7 @@ extension PresentationThemeList: Codable { public convenience init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) + let codingPath = decoder.codingPath.map { $0.stringValue }.joined(separator: ".") let freePlainInputField: PresentationInputFieldTheme if let value = try? values.decode(PresentationInputFieldTheme.self, forKey: .freePlainInputField) { @@ -860,6 +863,7 @@ extension PresentationThemeList: Codable { self.init( blocksBackgroundColor: try decodeColor(values, .blocksBg), + modalBlocksBackgroundColor: try decodeColor(values, .modalBlocksBg, fallbackKey: "\(codingPath).blocksBg"), plainBackgroundColor: try decodeColor(values, .plainBg), itemPrimaryTextColor: try decodeColor(values, .primaryText), itemSecondaryTextColor: try decodeColor(values, .secondaryText), @@ -869,6 +873,7 @@ extension PresentationThemeList: Codable { itemDestructiveColor: try decodeColor(values, .destructive), itemPlaceholderTextColor: try decodeColor(values, .placeholderText), itemBlocksBackgroundColor: try decodeColor(values, .itemBlocksBg), + itemModalBlocksBackgroundColor: try decodeColor(values, .itemModalBlocksBg, fallbackKey: "\(codingPath).itemBlocksBg"), itemHighlightedBackgroundColor: try decodeColor(values, .itemHighlightedBg), itemBlocksSeparatorColor: try decodeColor(values, .blocksSeparator), itemPlainSeparatorColor: try decodeColor(values, .plainSeparator), diff --git a/submodules/TelegramUI/Sources/AttachmentFileController.swift b/submodules/TelegramUI/Sources/AttachmentFileController.swift index ef8dba066a..7860dbbf9f 100644 --- a/submodules/TelegramUI/Sources/AttachmentFileController.swift +++ b/submodules/TelegramUI/Sources/AttachmentFileController.swift @@ -239,8 +239,8 @@ public func attachmentFileController(context: AccountContext, updatedPresentatio ) |> map { presentationData, recentDocuments, state -> (ItemListControllerState, (ItemListNodeState, Any)) in var presentationData = presentationData - if presentationData.theme.list.blocksBackgroundColor.rgb == 0x000000 { - let updatedTheme = presentationData.theme.withInvertedBlocksBackground() + if presentationData.theme.list.blocksBackgroundColor.rgb == presentationData.theme.list.plainBackgroundColor.rgb { + let updatedTheme = presentationData.theme.withModalBlocksBackground() presentationData = presentationData.withUpdated(theme: updatedTheme) } diff --git a/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift b/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift index 5da4d930e0..f519798185 100644 --- a/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift @@ -1352,7 +1352,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView { strongSelf.addSubnode(deliveryFailedNode) } let deliveryFailedSize = deliveryFailedNode.updateLayout(theme: item.presentationData.theme.theme) - let deliveryFailedFrame = CGRect(origin: CGPoint(x: imageFrame.maxX + deliveryFailedInset - deliveryFailedSize.width, y: imageFrame.maxY - deliveryFailedSize.height - imageInset), size: deliveryFailedSize) + let deliveryFailedFrame = CGRect(origin: CGPoint(x: imageFrame.maxX + deliveryFailedInset - deliveryFailedSize.width, y: imageFrame.maxY - deliveryFailedSize.height - imageInset + imageVerticalInset), size: deliveryFailedSize) if isAppearing { deliveryFailedNode.frame = deliveryFailedFrame transition.animatePositionAdditive(node: deliveryFailedNode, offset: CGPoint(x: deliveryFailedInset, y: 0.0)) @@ -1370,7 +1370,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView { if let actionButtonsSizeAndApply = actionButtonsSizeAndApply { let actionButtonsNode = actionButtonsSizeAndApply.1(animation) let previousFrame = actionButtonsNode.frame - let actionButtonsFrame = CGRect(origin: CGPoint(x: imageFrame.minX, y: imageFrame.maxY), size: actionButtonsSizeAndApply.0) + let actionButtonsFrame = CGRect(origin: CGPoint(x: imageFrame.minX, y: imageFrame.maxY + imageVerticalInset), size: actionButtonsSizeAndApply.0) actionButtonsNode.frame = actionButtonsFrame if actionButtonsNode !== strongSelf.actionButtonsNode { strongSelf.actionButtonsNode = actionButtonsNode @@ -1397,7 +1397,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView { if let reactionButtonsSizeAndApply = reactionButtonsSizeAndApply { let reactionButtonsNode = reactionButtonsSizeAndApply.1(animation) - var reactionButtonsFrame = CGRect(origin: CGPoint(x: imageFrame.minX, y: imageFrame.maxY), size: reactionButtonsSizeAndApply.0) + var reactionButtonsFrame = CGRect(origin: CGPoint(x: imageFrame.minX, y: imageFrame.maxY + imageVerticalInset), size: reactionButtonsSizeAndApply.0) if !incoming { reactionButtonsFrame.origin.x = imageFrame.maxX - reactionButtonsSizeAndApply.0.width } @@ -1689,7 +1689,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView { var animationFrame: CGRect if isStickerEffect { let scale: CGFloat = 0.245 - animationFrame = animationNode.frame.offsetBy(dx: incomingMessage ? animationNode.frame.width * scale : -animationNode.frame.width * scale + 21.0, dy: -1.0).insetBy(dx: -animationNode.frame.width * scale, dy: -animationNode.frame.height * scale) + animationFrame = animationNode.frame.offsetBy(dx: incomingMessage ? animationNode.frame.width * scale - 21.0 : -animationNode.frame.width * scale + 21.0, dy: -1.0).insetBy(dx: -animationNode.frame.width * scale, dy: -animationNode.frame.height * scale) } else { animationFrame = animationNode.frame.insetBy(dx: -animationNode.frame.width, dy: -animationNode.frame.height) .offsetBy(dx: incomingMessage ? animationNode.frame.width - 10.0 : -animationNode.frame.width + 10.0, dy: 0.0) diff --git a/submodules/TranslateUI/Sources/TranslateScreen.swift b/submodules/TranslateUI/Sources/TranslateScreen.swift index 2cc5b5c46b..bf6098d0d0 100644 --- a/submodules/TranslateUI/Sources/TranslateScreen.swift +++ b/submodules/TranslateUI/Sources/TranslateScreen.swift @@ -720,6 +720,7 @@ public class TranslateScreen: ViewController { statusBarHeight: 0.0, navigationHeight: navigationHeight, safeInsets: UIEdgeInsets(top: layout.intrinsicInsets.top + layout.safeInsets.top, left: layout.safeInsets.left, bottom: layout.intrinsicInsets.bottom + layout.safeInsets.bottom, right: layout.safeInsets.right), + metrics: layout.metrics, isVisible: self.currentIsVisible, theme: self.theme ?? self.presentationData.theme, strings: self.presentationData.strings, diff --git a/submodules/WebUI/Sources/WebAppController.swift b/submodules/WebUI/Sources/WebAppController.swift index 71efdf5e6b..bd5958885d 100644 --- a/submodules/WebUI/Sources/WebAppController.swift +++ b/submodules/WebUI/Sources/WebAppController.swift @@ -161,9 +161,9 @@ public struct WebAppParameters { public func generateWebAppThemeParams(_ presentationTheme: PresentationTheme) -> [String: Any] { var backgroundColor = presentationTheme.list.plainBackgroundColor.rgb var secondaryBackgroundColor = presentationTheme.list.blocksBackgroundColor.rgb - if backgroundColor == 0x000000 { - backgroundColor = presentationTheme.list.itemBlocksBackgroundColor.rgb - secondaryBackgroundColor = presentationTheme.list.itemBlocksBackgroundColor.rgb + if presentationTheme.list.blocksBackgroundColor.rgb == presentationTheme.list.plainBackgroundColor.rgb { + backgroundColor = presentationTheme.list.modalBlocksBackgroundColor.rgb + secondaryBackgroundColor = presentationTheme.list.plainBackgroundColor.rgb } return [ "bg_color": Int32(bitPattern: backgroundColor), @@ -733,9 +733,9 @@ public final class WebAppController: ViewController, AttachmentContainable { let color: UIColor? var backgroundColor = self.presentationData.theme.list.plainBackgroundColor var secondaryBackgroundColor = self.presentationData.theme.list.blocksBackgroundColor - if backgroundColor.rgb == 0x000000 { - backgroundColor = self.presentationData.theme.list.itemBlocksBackgroundColor - secondaryBackgroundColor = self.presentationData.theme.list.itemBlocksBackgroundColor + if self.presentationData.theme.list.blocksBackgroundColor.rgb == self.presentationData.theme.list.plainBackgroundColor.rgb { + backgroundColor = self.presentationData.theme.list.modalBlocksBackgroundColor + secondaryBackgroundColor = self.presentationData.theme.list.plainBackgroundColor } if let headerColorKey = self.headerColorKey { switch headerColorKey {