mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-08 19:10:53 +00:00
Various improvements
This commit is contained in:
parent
9006b615e6
commit
3ce47cc05a
@ -30,6 +30,7 @@ swift_library(
|
||||
"//submodules/TelegramUI/Components/TabSelectorComponent",
|
||||
"//submodules/TelegramUI/Components/LottieComponent",
|
||||
"//submodules/TelegramUI/Components/PlainButtonComponent",
|
||||
"//submodules/UIKitRuntimeUtils",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
@ -13,6 +13,7 @@ import EntityKeyboard
|
||||
import AnimationCache
|
||||
import MultiAnimationRenderer
|
||||
import UndoUI
|
||||
import UIKitRuntimeUtils
|
||||
|
||||
private let animationDurationFactor: Double = 1.0
|
||||
|
||||
@ -559,6 +560,10 @@ final class ContextControllerNode: ViewControllerTracingNode, UIScrollViewDelega
|
||||
self?.dimNodeTapped()
|
||||
return true
|
||||
}
|
||||
|
||||
if controller.disableScreenshots {
|
||||
setLayerDisableScreenshots(self.layer, true)
|
||||
}
|
||||
}
|
||||
|
||||
deinit {
|
||||
@ -2426,6 +2431,7 @@ public final class ContextController: ViewController, StandalonePresentableContr
|
||||
public var useComplexItemsTransitionAnimation = false
|
||||
public var immediateItemsTransitionAnimation = false
|
||||
let workaroundUseLegacyImplementation: Bool
|
||||
let disableScreenshots: Bool
|
||||
|
||||
public enum HandledTouchEvent {
|
||||
case ignore
|
||||
@ -2441,7 +2447,7 @@ public final class ContextController: ViewController, StandalonePresentableContr
|
||||
|
||||
public var getOverlayViews: (() -> [UIView])?
|
||||
|
||||
convenience public init(presentationData: PresentationData, source: ContextContentSource, items: Signal<ContextController.Items, NoError>, recognizer: TapLongTapOrDoubleTapGestureRecognizer? = nil, gesture: ContextGesture? = nil, workaroundUseLegacyImplementation: Bool = false) {
|
||||
convenience public init(presentationData: PresentationData, source: ContextContentSource, items: Signal<ContextController.Items, NoError>, recognizer: TapLongTapOrDoubleTapGestureRecognizer? = nil, gesture: ContextGesture? = nil, workaroundUseLegacyImplementation: Bool = false, disableScreenshots: Bool = false) {
|
||||
self.init(
|
||||
presentationData: presentationData,
|
||||
configuration: ContextController.Configuration(
|
||||
@ -2455,7 +2461,8 @@ public final class ContextController: ViewController, StandalonePresentableContr
|
||||
),
|
||||
recognizer: recognizer,
|
||||
gesture: gesture,
|
||||
workaroundUseLegacyImplementation: workaroundUseLegacyImplementation
|
||||
workaroundUseLegacyImplementation: workaroundUseLegacyImplementation,
|
||||
disableScreenshots: disableScreenshots
|
||||
)
|
||||
}
|
||||
|
||||
@ -2464,13 +2471,15 @@ public final class ContextController: ViewController, StandalonePresentableContr
|
||||
configuration: ContextController.Configuration,
|
||||
recognizer: TapLongTapOrDoubleTapGestureRecognizer? = nil,
|
||||
gesture: ContextGesture? = nil,
|
||||
workaroundUseLegacyImplementation: Bool = false
|
||||
workaroundUseLegacyImplementation: Bool = false,
|
||||
disableScreenshots: Bool = false
|
||||
) {
|
||||
self.presentationData = presentationData
|
||||
self.configuration = configuration
|
||||
self.recognizer = recognizer
|
||||
self.gesture = gesture
|
||||
self.workaroundUseLegacyImplementation = workaroundUseLegacyImplementation
|
||||
self.disableScreenshots = disableScreenshots
|
||||
|
||||
super.init(navigationBarPresentationData: nil)
|
||||
|
||||
|
@ -6,6 +6,7 @@ import TelegramPresentationData
|
||||
import TextSelectionNode
|
||||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import UIKitRuntimeUtils
|
||||
|
||||
final class PinchSourceGesture: UIPinchGestureRecognizer {
|
||||
private final class Target {
|
||||
@ -237,6 +238,7 @@ private final class PinchControllerNode: ViewControllerTracingNode {
|
||||
private let scrollingContainer: ASDisplayNode
|
||||
|
||||
private let sourceNode: PinchSourceContainerNode
|
||||
private let disableScreenshots: Bool
|
||||
private let getContentAreaInScreenSpace: () -> CGRect
|
||||
|
||||
private let dimNode: ASDisplayNode
|
||||
@ -246,9 +248,10 @@ private final class PinchControllerNode: ViewControllerTracingNode {
|
||||
|
||||
private var hapticFeedback: HapticFeedback?
|
||||
|
||||
init(controller: PinchController, sourceNode: PinchSourceContainerNode, getContentAreaInScreenSpace: @escaping () -> CGRect) {
|
||||
init(controller: PinchController, sourceNode: PinchSourceContainerNode, disableScreenshots: Bool, getContentAreaInScreenSpace: @escaping () -> CGRect) {
|
||||
self.controller = controller
|
||||
self.sourceNode = sourceNode
|
||||
self.disableScreenshots = disableScreenshots
|
||||
self.getContentAreaInScreenSpace = getContentAreaInScreenSpace
|
||||
|
||||
self.dimNode = ASDisplayNode()
|
||||
@ -290,6 +293,10 @@ private final class PinchControllerNode: ViewControllerTracingNode {
|
||||
|
||||
strongSelf.sourceNode.contentNode.transform = transform
|
||||
}
|
||||
|
||||
if self.disableScreenshots {
|
||||
setLayerDisableScreenshots(self.layer, true)
|
||||
}
|
||||
}
|
||||
|
||||
deinit {
|
||||
@ -407,6 +414,7 @@ public final class PinchController: ViewController, StandalonePresentableControl
|
||||
}
|
||||
|
||||
private let sourceNode: PinchSourceContainerNode
|
||||
private let disableScreenshots: Bool
|
||||
private let getContentAreaInScreenSpace: () -> CGRect
|
||||
|
||||
private var wasDismissed = false
|
||||
@ -415,8 +423,9 @@ public final class PinchController: ViewController, StandalonePresentableControl
|
||||
return self.displayNode as! PinchControllerNode
|
||||
}
|
||||
|
||||
public init(sourceNode: PinchSourceContainerNode, getContentAreaInScreenSpace: @escaping () -> CGRect) {
|
||||
public init(sourceNode: PinchSourceContainerNode, disableScreenshots: Bool = false, getContentAreaInScreenSpace: @escaping () -> CGRect) {
|
||||
self.sourceNode = sourceNode
|
||||
self.disableScreenshots = disableScreenshots
|
||||
self.getContentAreaInScreenSpace = getContentAreaInScreenSpace
|
||||
|
||||
super.init(navigationBarPresentationData: nil)
|
||||
@ -435,7 +444,7 @@ public final class PinchController: ViewController, StandalonePresentableControl
|
||||
}
|
||||
|
||||
override public func loadDisplayNode() {
|
||||
self.displayNode = PinchControllerNode(controller: self, sourceNode: self.sourceNode, getContentAreaInScreenSpace: self.getContentAreaInScreenSpace)
|
||||
self.displayNode = PinchControllerNode(controller: self, sourceNode: self.sourceNode, disableScreenshots: self.disableScreenshots, getContentAreaInScreenSpace: self.getContentAreaInScreenSpace)
|
||||
|
||||
self.displayNodeDidLoad()
|
||||
|
||||
|
@ -294,7 +294,8 @@ extension ChatControllerImpl {
|
||||
|
||||
self.canReadHistory.set(false)
|
||||
|
||||
let controller = ContextController(presentationData: self.presentationData, source: source, items: actionsSignal, recognizer: recognizer, gesture: gesture)
|
||||
let isSecret = self.presentationInterfaceState.copyProtectionEnabled || self.chatLocation.peerId?.namespace == Namespaces.Peer.SecretChat
|
||||
let controller = ContextController(presentationData: self.presentationData, source: source, items: actionsSignal, recognizer: recognizer, gesture: gesture, disableScreenshots: isSecret)
|
||||
controller.dismissed = { [weak self] in
|
||||
self?.canReadHistory.set(true)
|
||||
}
|
||||
|
@ -1588,7 +1588,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
}
|
||||
}
|
||||
|
||||
let pinchController = PinchController(sourceNode: sourceNode, getContentAreaInScreenSpace: {
|
||||
let isSecret = strongSelf.presentationInterfaceState.copyProtectionEnabled || strongSelf.chatLocation.peerId?.namespace == Namespaces.Peer.SecretChat
|
||||
let pinchController = PinchController(sourceNode: sourceNode, disableScreenshots: isSecret, getContentAreaInScreenSpace: {
|
||||
guard let strongSelf = self else {
|
||||
return CGRect()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user