From a3db20c9728a7ae2354e271503d1d418d5683dd1 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Wed, 20 Jul 2022 08:17:54 +0200 Subject: [PATCH] Various fixes --- submodules/AppLock/Sources/AppLock.swift | 6 ++- .../Sources/ContextActionsContainerNode.swift | 13 +++--- .../ContextUI/Sources/ContextController.swift | 1 + .../ContextControllerActionsStackNode.swift | 6 ++- .../Navigation/NavigationController.swift | 43 +----------------- submodules/Display/Source/WindowContent.swift | 36 +++++++++++++-- .../LegacyComponents/Sources/PGVideoMovie.m | 4 +- .../PremiumUI/Sources/PremiumGiftScreen.swift | 2 +- .../PrivacyAndSecurityController.swift | 3 ++ .../Sources/StickerPackScreen.swift | 2 +- .../AppBadge.imageset/AppBadge@3x.png | Bin 4347 -> 3929 bytes .../Sources/ChatEntityKeyboardInputNode.swift | 6 +-- .../Sources/PeerInfo/PeerInfoScreen.swift | 13 +++--- .../Sources/TelegramRootController.swift | 7 +-- 14 files changed, 70 insertions(+), 72 deletions(-) diff --git a/submodules/AppLock/Sources/AppLock.swift b/submodules/AppLock/Sources/AppLock.swift index 2f8d668b27..49ec60fb5d 100644 --- a/submodules/AppLock/Sources/AppLock.swift +++ b/submodules/AppLock/Sources/AppLock.swift @@ -44,19 +44,23 @@ private func getCoveringViewSnaphot(window: Window1) -> UIImage? { context.clear(CGRect(origin: CGPoint(), size: size)) context.scaleBy(x: scale, y: scale) UIGraphicsPushContext(context) + + window.badgeView.alpha = 0.0 window.forEachViewController({ controller in if let controller = controller as? PasscodeEntryController { controller.displayNode.alpha = 0.0 } return true }) - window.hostView.containerView.drawHierarchy(in: CGRect(origin: CGPoint(), size: unscaledSize), afterScreenUpdates: false) + window.hostView.containerView.drawHierarchy(in: CGRect(origin: CGPoint(), size: unscaledSize), afterScreenUpdates: true) window.forEachViewController({ controller in if let controller = controller as? PasscodeEntryController { controller.displayNode.alpha = 1.0 } return true }) + window.badgeView.alpha = 1.0 + UIGraphicsPopContext() }).flatMap(applyScreenshotEffectToImage) } diff --git a/submodules/ContextUI/Sources/ContextActionsContainerNode.swift b/submodules/ContextUI/Sources/ContextActionsContainerNode.swift index 0045400c43..e366f414f5 100644 --- a/submodules/ContextUI/Sources/ContextActionsContainerNode.swift +++ b/submodules/ContextUI/Sources/ContextActionsContainerNode.swift @@ -357,7 +357,7 @@ final class InnerTextSelectionTipContainerNode: ASDisplayNode { private let targetSelectionIndex: Int? private var action: (() -> Void)? - var requestDismiss: () -> Void = {} + var requestDismiss: (@escaping () -> Void) -> Void = { _ in } init(presentationData: PresentationData, tip: ContextController.Tip) { self.presentationData = presentationData @@ -369,8 +369,8 @@ final class InnerTextSelectionTipContainerNode: ASDisplayNode { self.buttonNode = HighlightTrackingButtonNode() self.textNode = TextNodeWithEntities() + self.textNode.textNode.displaysAsynchronously = false self.textNode.textNode.isUserInteractionEnabled = false - self.textNode.textNode.displaysAsynchronously = true var isUserInteractionEnabled = false var icon: UIImage? @@ -467,8 +467,9 @@ final class InnerTextSelectionTipContainerNode: ASDisplayNode { } @objc func pressed() { - self.requestDismiss() - self.action?() + self.requestDismiss({ + self.action?() + }) } func updateLayout(widthClass: ContainerViewLayoutSizeClass, width: CGFloat, transition: ContainedViewLayoutTransition) -> CGSize { @@ -652,8 +653,8 @@ final class ContextActionsContainerNode: ASDisplayNode { self.actionsNode = InnerActionsContainerNode(presentationData: presentationData, items: itemList, getController: getController, actionSelected: actionSelected, requestLayout: requestLayout, feedbackTap: feedbackTap, blurBackground: blurBackground) if let tip = items.tip { let textSelectionTipNode = InnerTextSelectionTipContainerNode(presentationData: presentationData, tip: tip) - textSelectionTipNode.requestDismiss = { - getController()?.dismiss(completion: nil) + textSelectionTipNode.requestDismiss = { completion in + getController()?.dismiss(completion: completion) } self.textSelectionTipNode = textSelectionTipNode } else { diff --git a/submodules/ContextUI/Sources/ContextController.swift b/submodules/ContextUI/Sources/ContextController.swift index 398eea1cfb..5e655079d0 100644 --- a/submodules/ContextUI/Sources/ContextController.swift +++ b/submodules/ContextUI/Sources/ContextController.swift @@ -2396,6 +2396,7 @@ public final class ContextController: ViewController, StandalonePresentableContr public func setItems(_ items: Signal, minHeight: ContextController.ActionsHeight?) { self.items = items if self.isNodeLoaded { + self.immediateItemsTransitionAnimation = false self.controllerNode.setItemsSignal(items: items, minHeight: minHeight, previousActionsTransition: .scale) } } diff --git a/submodules/ContextUI/Sources/ContextControllerActionsStackNode.swift b/submodules/ContextUI/Sources/ContextControllerActionsStackNode.swift index 4b7e5ac84a..e4e72f488a 100644 --- a/submodules/ContextUI/Sources/ContextControllerActionsStackNode.swift +++ b/submodules/ContextUI/Sources/ContextControllerActionsStackNode.swift @@ -887,8 +887,8 @@ final class ContextControllerActionsStackNode: ASDisplayNode { if self.tipNode == nil { updatedTransition = .immediate let tipNode = InnerTextSelectionTipContainerNode(presentationData: presentationData, tip: tip) - tipNode.requestDismiss = { [weak self] in - self?.getController()?.dismiss(completion: nil) + tipNode.requestDismiss = { [weak self] completion in + self?.getController()?.dismiss(completion: completion) } self.tipNode = tipNode } @@ -997,6 +997,7 @@ final class ContextControllerActionsStackNode: ASDisplayNode { if animated { self.dismissingItemContainers.append((itemContainer, false)) } else { + itemContainer.tipNode?.removeFromSupernode() itemContainer.removeFromSupernode() } } @@ -1198,6 +1199,7 @@ final class ContextControllerActionsStackNode: ASDisplayNode { itemContainer?.removeFromSupernode() }) if let tipNode = itemContainer.tipNode { + transition.updateFrame(node: tipNode, frame: CGRect(origin: CGPoint(x: navigationContainerFrame.minX, y: navigationContainerFrame.maxY + tipSpacing), size: tipNode.frame.size), beginWithCurrentState: true) transition.updateAlpha(node: tipNode, alpha: 0.0, completion: { [weak tipNode] _ in tipNode?.removeFromSupernode() }) diff --git a/submodules/Display/Source/Navigation/NavigationController.swift b/submodules/Display/Source/Navigation/NavigationController.swift index 3cbd98634f..7de91ddaf2 100644 --- a/submodules/Display/Source/Navigation/NavigationController.swift +++ b/submodules/Display/Source/Navigation/NavigationController.swift @@ -357,41 +357,10 @@ open class NavigationController: UINavigationController, ContainableController, self.updateContainers(layout: layout, transition: transition) } } - - private var forceBadgeHidden = false - public func setForceBadgeHidden(_ hidden: Bool) { - guard hidden != self.forceBadgeHidden else { - return - } - self.forceBadgeHidden = hidden - if let layout = self.validLayout { - self.updateBadgeVisibility(layout: layout) - } - } - - private func updateBadgeVisibility(layout: ContainerViewLayout) { - guard let badgeNode = self.badgeNode else { - return - } - let badgeIsHidden = !layout.deviceMetrics.hasTopNotch || self.forceBadgeHidden || layout.size.width > layout.size.height - if badgeIsHidden != badgeNode.isHidden && !badgeIsHidden { - Queue.mainQueue().after(0.3) { - badgeNode.isHidden = badgeIsHidden - } - } else { - badgeNode.isHidden = badgeIsHidden - } - } - private func updateContainers(layout rawLayout: ContainerViewLayout, transition: ContainedViewLayoutTransition) { self.isUpdatingContainers = true - - if let badgeNode = self.badgeNode, let image = badgeNode.image { - self.updateBadgeVisibility(layout: rawLayout) - badgeNode.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((rawLayout.size.width - image.size.width) / 2.0), y: 6.0), size: image.size) - } - + var layout = rawLayout if self.ignoreInputHeight { @@ -1268,16 +1237,8 @@ open class NavigationController: UINavigationController, ContainableController, self.displayNode.addSubnode(inCallStatusBar) } } - - let badgeNode = ASImageNode() - badgeNode.displaysAsynchronously = false - badgeNode.image = UIImage(bundleImageName: "Components/AppBadge") - self.badgeNode = badgeNode - self.displayNode.addSubnode(badgeNode) } - - private var badgeNode: ASImageNode? - + public func pushViewController(_ controller: ViewController) { self.pushViewController(controller, completion: {}) } diff --git a/submodules/Display/Source/WindowContent.swift b/submodules/Display/Source/WindowContent.swift index 82b0b44a1c..e66677cd42 100644 --- a/submodules/Display/Source/WindowContent.swift +++ b/submodules/Display/Source/WindowContent.swift @@ -240,6 +240,7 @@ public final class WindowKeyboardGestureRecognizerDelegate: NSObject, UIGestureR public class Window1 { public let hostView: WindowHostView + public let badgeView: UIImageView private var deviceMetrics: DeviceMetrics @@ -328,6 +329,9 @@ public class Window1 { public init(hostView: WindowHostView, statusBarHost: StatusBarHost?) { self.hostView = hostView + self.badgeView = UIImageView() + self.badgeView.image = UIImage(bundleImageName: "Components/AppBadge") + self.systemUserInterfaceStyle = hostView.systemUserInterfaceStyle let boundsSize = self.hostView.eventView.bounds.size @@ -626,8 +630,9 @@ public class Window1 { } self.windowPanRecognizer = recognizer self.hostView.containerView.addGestureRecognizer(recognizer) + self.hostView.containerView.addSubview(self.badgeView) } - + public required init(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } @@ -650,6 +655,26 @@ public class Window1 { } } + private var forceBadgeHidden = false + public func setForceBadgeHidden(_ hidden: Bool) { + guard hidden != self.forceBadgeHidden else { + return + } + self.forceBadgeHidden = hidden + self.updateBadgeVisibility(layout: self.windowLayout) + } + + private func updateBadgeVisibility(layout: WindowLayout) { + let badgeIsHidden = !self.deviceMetrics.hasTopNotch || self.forceBadgeHidden || layout.size.width > layout.size.height + if badgeIsHidden != self.badgeView.isHidden && !badgeIsHidden { + Queue.mainQueue().after(0.3) { + self.badgeView.isHidden = badgeIsHidden + } + } else { + self.badgeView.isHidden = badgeIsHidden + } + } + public func setForceInCallStatusBar(_ forceInCallStatusBarText: String?, transition: ContainedViewLayoutTransition = .animated(duration: 0.3, curve: .easeInOut)) { if self.forceInCallStatusBarText != forceInCallStatusBarText { self.forceInCallStatusBarText = forceInCallStatusBarText @@ -828,7 +853,7 @@ public class Window1 { if let coveringView = self.coveringView { self.hostView.containerView.insertSubview(controller.view, belowSubview: coveringView) } else { - self.hostView.containerView.addSubview(controller.view) + self.hostView.containerView.insertSubview(controller.view, belowSubview: self.badgeView) } if let controller = controller as? ViewController { @@ -868,7 +893,7 @@ public class Window1 { if let controller = self.topPresentationContext.controllers.first { self.hostView.containerView.insertSubview(coveringView, belowSubview: controller.0.displayNode.view) } else { - self.hostView.containerView.addSubview(coveringView) + self.hostView.containerView.insertSubview(coveringView, belowSubview: self.badgeView) } if !self.windowLayout.size.width.isZero { coveringView.frame = CGRect(origin: CGPoint(), size: self.windowLayout.size) @@ -1087,6 +1112,11 @@ public class Window1 { coveringView.frame = CGRect(origin: CGPoint(), size: self.windowLayout.size) coveringView.updateLayout(self.windowLayout.size) } + + if let image = self.badgeView.image { + self.updateBadgeVisibility(layout: self.windowLayout) + self.badgeView.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((self.windowLayout.size.width - image.size.width) / 2.0), y: 6.0), size: image.size) + } } } } diff --git a/submodules/LegacyComponents/Sources/PGVideoMovie.m b/submodules/LegacyComponents/Sources/PGVideoMovie.m index 274ec0605c..ceb10a7b57 100755 --- a/submodules/LegacyComponents/Sources/PGVideoMovie.m +++ b/submodules/LegacyComponents/Sources/PGVideoMovie.m @@ -16,8 +16,8 @@ GLfloat kColorConversion601FullRangeDefault[] = { GLfloat kColorConversion709Default[] = { 1, 1, 1, - 0, -.21482, 2.12798, - 1.28033, -.38059, 0, + 0, -0.1873, 1.8556, + 1.5748, -0.4681, 0, }; GLfloat *kColorConversion601 = kColorConversion601Default; diff --git a/submodules/PremiumUI/Sources/PremiumGiftScreen.swift b/submodules/PremiumUI/Sources/PremiumGiftScreen.swift index 19d1249bcd..2dc3ae0916 100644 --- a/submodules/PremiumUI/Sources/PremiumGiftScreen.swift +++ b/submodules/PremiumUI/Sources/PremiumGiftScreen.swift @@ -1223,7 +1223,7 @@ public final class PremiumGiftScreen: ViewControllerComponentContainer { public weak var containerView: UIView? public var animationColor: UIColor? - public init(context: AccountContext, peerId: PeerId) { + public init(context: AccountContext, peerId: PeerId, options: [CachedPremiumGiftOption]) { self.context = context var updateInProgressImpl: ((Bool) -> Void)? diff --git a/submodules/SettingsUI/Sources/Privacy and Security/PrivacyAndSecurityController.swift b/submodules/SettingsUI/Sources/Privacy and Security/PrivacyAndSecurityController.swift index 09f3a97eec..a20f4fe1d8 100644 --- a/submodules/SettingsUI/Sources/Privacy and Security/PrivacyAndSecurityController.swift +++ b/submodules/SettingsUI/Sources/Privacy and Security/PrivacyAndSecurityController.swift @@ -769,6 +769,9 @@ public func privacyAndSecurityController(context: AccountContext, initialSetting }), true) } } else { + let hapticFeedback = HapticFeedback() + hapticFeedback.impact() + presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .info(title: nil, text: presentationData.strings.Privacy_VoiceMessages_Tooltip), elevatedLayout: false, animateInAsReplacement: false, action: { action in if action == .info { let controller = PremiumIntroScreen(context: context, source: .settings) diff --git a/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift b/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift index 576b23290f..1401791f68 100644 --- a/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift +++ b/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift @@ -715,7 +715,7 @@ private final class StickerPackContainer: ASDisplayNode { } else if loadedCount == contents.count { self.onReady() - if !contents.isEmpty && self.currentStickerPack == nil { + if !contents.isEmpty && self.currentStickerPacks.isEmpty { if let _ = self.validLayout, abs(self.expandScrollProgress - 1.0) < .ulpOfOne { scrollToItem = GridNodeScrollToItem(index: 0, position: .top(0.0), transition: .immediate, directionHint: .up, adjustForSection: false) } diff --git a/submodules/TelegramUI/Images.xcassets/Components/AppBadge.imageset/AppBadge@3x.png b/submodules/TelegramUI/Images.xcassets/Components/AppBadge.imageset/AppBadge@3x.png index d647852ab026fccfeff1c00eaa369fab476b824b..f9746877fdf944b445ea7c7e1030cf2fa7fdb9e8 100644 GIT binary patch delta 3910 zcmV-M54rIBA=w^~IDZcdNklUu+y#6^FlDh2o+>c7>?olBR1@Q5*@fF+zm| z)U6{xv=4Cz;sJ{6knombN2H>{Aa8^$K?THyBJmJNBIpYu#1U#xMe8gN4it&Rd5H^@ z?3T23MFqQ2BWg<3;o*3^^LO{opWXGw_meDp$1`{C&dmMYbAQi0_l)8jZxI!1N=4dV zO<4WFy})+h{Xh=59oPhHj9dYO!4Sp`;5zUs@B;80a2a^kno?H*)P&WtlUq}Y4Xr3x zO<1=8L%`>O&j4FmaUO%g;A7*;&wG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8Ra%AW;AS002ovPDHLkV1n*qfe-)y diff --git a/submodules/TelegramUI/Sources/ChatEntityKeyboardInputNode.swift b/submodules/TelegramUI/Sources/ChatEntityKeyboardInputNode.swift index 22b3258fb6..0e96c35d3c 100644 --- a/submodules/TelegramUI/Sources/ChatEntityKeyboardInputNode.swift +++ b/submodules/TelegramUI/Sources/ChatEntityKeyboardInputNode.swift @@ -203,7 +203,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode { if file.isPremiumEmoji && !hasPremium { //TODO:localize - + let presentationData = context.sharedContext.currentPresentationData.with { $0 } controllerInteraction.presentController(UndoOverlayController(presentationData: presentationData, content: .sticker(context: context, file: file, title: nil, text: "Subscribe to Telegram Premium to unlock this emoji.", undoText: "More", customAction: { [weak controllerInteraction] in guard let controllerInteraction = controllerInteraction else { @@ -211,7 +211,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode { } var replaceImpl: ((ViewController) -> Void)? - let controller = PremiumDemoScreen(context: context, subject: .premiumStickers, action: { + let controller = PremiumDemoScreen(context: context, subject: .animatedEmoji, action: { let controller = PremiumIntroScreen(context: context, source: .stickers) replaceImpl?(controller) }) @@ -1310,7 +1310,7 @@ final class EntityInputView: UIView, AttachmentTextInputPanelInputView, UIInputV } var replaceImpl: ((ViewController) -> Void)? - let controller = PremiumDemoScreen(context: strongSelf.context, subject: .premiumStickers, action: { + let controller = PremiumDemoScreen(context: strongSelf.context, subject: .animatedEmoji, action: { let controller = PremiumIntroScreen(context: strongSelf.context, source: .stickers) replaceImpl?(controller) }) diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index 641416b426..1f46cd824e 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -4064,7 +4064,11 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Gift"), color: theme.contextMenu.primaryColor) }, action: { [weak self] _, f in f(.dismissWithoutContent) - self?.giftPremium() + + if let strongSelf = self { + let controller = PremiumGiftScreen(context: strongSelf.context, peerId: strongSelf.peerId, options: cachedData.premiumGiftOptions) + strongSelf.controller?.push(controller) + } }))) } @@ -6426,12 +6430,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate } })) } - - private func giftPremium() { - let controller = PremiumGiftScreen(context: self.context, peerId: self.peerId) - self.controller?.push(controller) - } - + fileprivate func switchToAccount(id: AccountRecordId) { self.accountsAndPeers.set(.never()) self.context.sharedContext.switchToAccount(id: id, fromSettingsController: nil, withChatListController: nil) diff --git a/submodules/TelegramUI/Sources/TelegramRootController.swift b/submodules/TelegramUI/Sources/TelegramRootController.swift index 73927f1538..6957009e80 100644 --- a/submodules/TelegramUI/Sources/TelegramRootController.swift +++ b/submodules/TelegramUI/Sources/TelegramRootController.swift @@ -76,11 +76,8 @@ public final class TelegramRootController: NavigationController { self.applicationInFocusDisposable = (context.sharedContext.applicationBindings.applicationIsActive |> distinctUntilChanged - |> deliverOn(Queue.mainQueue())).start(next: { [weak self] value in - guard let strongSelf = self else { - return - } - strongSelf.setForceBadgeHidden(!value) + |> deliverOn(Queue.mainQueue())).start(next: { value in + context.sharedContext.mainWindow?.setForceBadgeHidden(!value) }) }