diff --git a/submodules/Display/Source/PointerInteraction.swift b/submodules/Display/Source/PointerInteraction.swift index 867c39abca..e2a978ae7a 100644 --- a/submodules/Display/Source/PointerInteraction.swift +++ b/submodules/Display/Source/PointerInteraction.swift @@ -11,8 +11,9 @@ public enum PointerStyle { } @available(iOSApplicationExtension 13.4, iOS 13.4, *) -private final class PointerInteractionImpl: NSObject, UIPointerInteractionDelegate { - weak var pointerInteraction: UIPointerInteraction? +private final class PointerInteractionImpl: NSObject { +//UIPointerInteractionDelegate { +// weak var pointerInteraction: UIPointerInteraction? private let style: PointerStyle @@ -28,63 +29,63 @@ private final class PointerInteractionImpl: NSObject, UIPointerInteractionDelega } deinit { - if let pointerInteraction = self.pointerInteraction { - pointerInteraction.view?.removeInteraction(pointerInteraction) - } +// if let pointerInteraction = self.pointerInteraction { +// pointerInteraction.view?.removeInteraction(pointerInteraction) +// } } func setup(view: UIView) { - let pointerInteraction = UIPointerInteraction(delegate: self) - view.addInteraction(pointerInteraction) - self.pointerInteraction = pointerInteraction +// let pointerInteraction = UIPointerInteraction(delegate: self) +// view.addInteraction(pointerInteraction) +// self.pointerInteraction = pointerInteraction } - func pointerInteraction(_ interaction: UIPointerInteraction, styleFor region: UIPointerRegion) -> UIPointerStyle? { - var pointerStyle: UIPointerStyle? = nil - if let interactionView = interaction.view { - let targetedPreview = UITargetedPreview(view: interactionView) - switch self.style { - case .default: - let horizontalPadding: CGFloat = 10.0 - let verticalPadding: CGFloat = 4.0 - let minHeight: CGFloat = 40.0 - let size: CGSize = CGSize(width: targetedPreview.size.width + horizontalPadding * 2.0, height: max(minHeight, targetedPreview.size.height + verticalPadding * 2.0)) - pointerStyle = UIPointerStyle(effect: .highlight(targetedPreview), shape: .roundedRect(CGRect(origin: CGPoint(x: targetedPreview.view.center.x - size.width / 2.0, y: targetedPreview.view.center.y - size.height / 2.0), size: size), radius: UIPointerShape.defaultCornerRadius)) - case let .rectangle(size): - pointerStyle = UIPointerStyle(effect: .highlight(targetedPreview), shape: .roundedRect(CGRect(origin: CGPoint(x: targetedPreview.view.center.x - size.width / 2.0, y: targetedPreview.view.center.y - size.height / 2.0), size: size), radius: UIPointerShape.defaultCornerRadius)) - case .circle: - let maxSide = max(targetedPreview.size.width, targetedPreview.size.height) - pointerStyle = UIPointerStyle(effect: .highlight(targetedPreview), shape: .path(UIBezierPath(ovalIn: CGRect(origin: CGPoint(), size: CGSize(width: maxSide, height: maxSide))))) - case .caret: - pointerStyle = UIPointerStyle(shape: .verticalBeam(length: 24.0), constrainedAxes: .vertical) - case .lift: - pointerStyle = UIPointerStyle(effect: .lift(targetedPreview)) - case .hover: - pointerStyle = UIPointerStyle(effect: .hover(targetedPreview, preferredTintMode: .none, prefersShadow: false, prefersScaledContent: false)) - } - } - return pointerStyle - } - - func pointerInteraction(_ interaction: UIPointerInteraction, willEnter region: UIPointerRegion, animator: UIPointerInteractionAnimating) { - guard let _ = interaction.view else { - return - } - - animator.addAnimations { - self.willEnter() - } - } - - func pointerInteraction(_ interaction: UIPointerInteraction, willExit region: UIPointerRegion, animator: UIPointerInteractionAnimating) { - guard let _ = interaction.view else { - return - } - - animator.addAnimations { - self.willExit() - } - } +// func pointerInteraction(_ interaction: UIPointerInteraction, styleFor region: UIPointerRegion) -> UIPointerStyle? { +// var pointerStyle: UIPointerStyle? = nil +// if let interactionView = interaction.view { +// let targetedPreview = UITargetedPreview(view: interactionView) +// switch self.style { +// case .default: +// let horizontalPadding: CGFloat = 10.0 +// let verticalPadding: CGFloat = 4.0 +// let minHeight: CGFloat = 40.0 +// let size: CGSize = CGSize(width: targetedPreview.size.width + horizontalPadding * 2.0, height: max(minHeight, targetedPreview.size.height + verticalPadding * 2.0)) +// pointerStyle = UIPointerStyle(effect: .highlight(targetedPreview), shape: .roundedRect(CGRect(origin: CGPoint(x: targetedPreview.view.center.x - size.width / 2.0, y: targetedPreview.view.center.y - size.height / 2.0), size: size), radius: UIPointerShape.defaultCornerRadius)) +// case let .rectangle(size): +// pointerStyle = UIPointerStyle(effect: .highlight(targetedPreview), shape: .roundedRect(CGRect(origin: CGPoint(x: targetedPreview.view.center.x - size.width / 2.0, y: targetedPreview.view.center.y - size.height / 2.0), size: size), radius: UIPointerShape.defaultCornerRadius)) +// case .circle: +// let maxSide = max(targetedPreview.size.width, targetedPreview.size.height) +// pointerStyle = UIPointerStyle(effect: .highlight(targetedPreview), shape: .path(UIBezierPath(ovalIn: CGRect(origin: CGPoint(), size: CGSize(width: maxSide, height: maxSide))))) +// case .caret: +// pointerStyle = UIPointerStyle(shape: .verticalBeam(length: 24.0), constrainedAxes: .vertical) +// case .lift: +// pointerStyle = UIPointerStyle(effect: .lift(targetedPreview)) +// case .hover: +// pointerStyle = UIPointerStyle(effect: .hover(targetedPreview, preferredTintMode: .none, prefersShadow: false, prefersScaledContent: false)) +// } +// } +// return pointerStyle +// } +// +// func pointerInteraction(_ interaction: UIPointerInteraction, willEnter region: UIPointerRegion, animator: UIPointerInteractionAnimating) { +// guard let _ = interaction.view else { +// return +// } +// +// animator.addAnimations { +// self.willEnter() +// } +// } +// +// func pointerInteraction(_ interaction: UIPointerInteraction, willExit region: UIPointerRegion, animator: UIPointerInteractionAnimating) { +// guard let _ = interaction.view else { +// return +// } +// +// animator.addAnimations { +// self.willExit() +// } +// } } public final class PointerInteraction { diff --git a/submodules/LegacyComponents/Sources/TGMenuSheetButtonItemView.m b/submodules/LegacyComponents/Sources/TGMenuSheetButtonItemView.m index 0fbd911cbe..db4462f238 100644 --- a/submodules/LegacyComponents/Sources/TGMenuSheetButtonItemView.m +++ b/submodules/LegacyComponents/Sources/TGMenuSheetButtonItemView.m @@ -11,7 +11,7 @@ const CGFloat TGMenuSheetButtonItemViewHeight = 57.0f; -@interface TGMenuSheetButtonItemView () +@interface TGMenuSheetButtonItemView () // { bool _dark; bool _requiresDivider; @@ -58,36 +58,36 @@ const CGFloat TGMenuSheetButtonItemViewHeight = 57.0f; strongSelf.highlightUpdateBlock(highlighted); }; - if (iosMajorVersion() > 13 || (iosMajorVersion() == 13 && iosMinorVersion() >= 4)) { - UIPointerInteraction *pointerInteraction = [[UIPointerInteraction alloc] initWithDelegate:self]; - [self addInteraction:pointerInteraction]; - } +// if (iosMajorVersion() > 13 || (iosMajorVersion() == 13 && iosMinorVersion() >= 4)) { +// UIPointerInteraction *pointerInteraction = [[UIPointerInteraction alloc] initWithDelegate:self]; +// [self addInteraction:pointerInteraction]; +// } } return self; } -- (UIPointerStyle *)pointerInteraction:(UIPointerInteraction *)interaction styleForRegion:(UIPointerRegion *)region { - if (interaction.view != nil) { - UITargetedPreview *targetedPreview = [[UITargetedPreview alloc] initWithView:interaction.view]; - UIPointerHoverEffect *effect = [UIPointerHoverEffect effectWithPreview:targetedPreview]; - effect.preferredTintMode = UIPointerEffectTintModeNone; - effect.prefersScaledContent = false; - return [UIPointerStyle styleWithEffect:effect shape:nil]; - } - return nil; -} - -- (void)pointerInteraction:(UIPointerInteraction *)interaction willEnterRegion:(UIPointerRegion *)region animator:(id)animator { - [animator addAnimations:^{ - _highlightView.alpha = 0.75f; - }]; -} - -- (void)pointerInteraction:(UIPointerInteraction *)interaction willExitRegion:(UIPointerRegion *)region animator:(id)animator { - [animator addAnimations:^{ - _highlightView.alpha = 0.0f; - }]; -} +//- (UIPointerStyle *)pointerInteraction:(UIPointerInteraction *)interaction styleForRegion:(UIPointerRegion *)region { +// if (interaction.view != nil) { +// UITargetedPreview *targetedPreview = [[UITargetedPreview alloc] initWithView:interaction.view]; +// UIPointerHoverEffect *effect = [UIPointerHoverEffect effectWithPreview:targetedPreview]; +// effect.preferredTintMode = UIPointerEffectTintModeNone; +// effect.prefersScaledContent = false; +// return [UIPointerStyle styleWithEffect:effect shape:nil]; +// } +// return nil; +//} +// +//- (void)pointerInteraction:(UIPointerInteraction *)interaction willEnterRegion:(UIPointerRegion *)region animator:(id)animator { +// [animator addAnimations:^{ +// _highlightView.alpha = 0.75f; +// }]; +//} +// +//- (void)pointerInteraction:(UIPointerInteraction *)interaction willExitRegion:(UIPointerRegion *)region animator:(id)animator { +// [animator addAnimations:^{ +// _highlightView.alpha = 0.0f; +// }]; +//} - (void)setDark {