mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Emoji input improvements
This commit is contained in:
@@ -27,36 +27,93 @@ public final class BlurredBackgroundComponent: Component {
|
||||
}
|
||||
|
||||
public final class View: BlurredBackgroundView {
|
||||
private var tintMaskView: UIView?
|
||||
private var tintContainerView: UIView?
|
||||
private var vibrancyEffectView: UIVisualEffectView?
|
||||
|
||||
public func update(component: BlurredBackgroundComponent, availableSize: CGSize, transition: Transition) -> CGSize {
|
||||
if let tintContainerView = component.tintContainerView {
|
||||
self.updateColor(color: .clear, forceKeepBlur: true, transition: transition.containedViewLayoutTransition)
|
||||
/*if self.tintContainerView !== component.tintContainerView {
|
||||
if let tintContainerView = self.tintContainerView {
|
||||
self.tintContainerView = nil
|
||||
if tintContainerView.superview === self {
|
||||
tintContainerView.removeFromSuperview()
|
||||
}
|
||||
}
|
||||
|
||||
let tintMaskView: UIView
|
||||
if let current = self.tintMaskView {
|
||||
tintMaskView = current
|
||||
self.tintContainerView = component.tintContainerView
|
||||
|
||||
if let tintContainerView = self.tintContainerView {
|
||||
let vibrancyEffectView: UIVisualEffectView
|
||||
if let current = self.vibrancyEffectView {
|
||||
vibrancyEffectView = current
|
||||
} else {
|
||||
let blurEffect = UIBlurEffect(style: .extraLight)
|
||||
let vibrancyEffect = UIVibrancyEffect(blurEffect: blurEffect)
|
||||
vibrancyEffectView = UIVisualEffectView(effect: vibrancyEffect)
|
||||
self.vibrancyEffectView = vibrancyEffectView
|
||||
self.addSubview(vibrancyEffectView)
|
||||
}
|
||||
tintContainerView.backgroundColor = .white
|
||||
vibrancyEffectView.contentView.addSubview(tintContainerView)
|
||||
} else {
|
||||
tintMaskView = UIView()
|
||||
self.tintMaskView = tintMaskView
|
||||
self.addSubview(tintMaskView)
|
||||
}
|
||||
|
||||
tintMaskView.backgroundColor = component.color
|
||||
transition.setFrame(view: tintMaskView, frame: CGRect(origin: CGPoint(), size: availableSize))
|
||||
|
||||
if tintMaskView.mask !== tintContainerView {
|
||||
tintMaskView.mask = tintContainerView
|
||||
if let vibrancyEffectView = self.vibrancyEffectView {
|
||||
self.vibrancyEffectView = nil
|
||||
vibrancyEffectView.removeFromSuperview()
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
self.updateColor(color: component.color, transition: transition.containedViewLayoutTransition)
|
||||
|
||||
/*if let _ = self.viewWithTag(123) {
|
||||
} else {
|
||||
self.updateColor(color: component.color, transition: transition.containedViewLayoutTransition)
|
||||
let blurEffect = UIBlurEffect(style: .extraLight)
|
||||
|
||||
if let tintMaskView = self.tintMaskView {
|
||||
self.tintMaskView = nil
|
||||
tintMaskView.removeFromSuperview()
|
||||
}
|
||||
|
||||
/*let segmentedControl = UISegmentedControl(items: ["First Item", "Second Item"])
|
||||
segmentedControl.sizeToFit()
|
||||
segmentedControl.center = CGPoint(x: 250.0, y: 250.0)*/
|
||||
let testView = UIView(frame: CGRect(origin: CGPoint(x: 50.0, y: 100.0), size: CGSize(width: 250.0, height: 50.0)))
|
||||
testView.backgroundColor = .white
|
||||
|
||||
let testView2 = UILabel()
|
||||
testView2.text = "Test 13245"
|
||||
testView2.font = Font.semibold(17.0)
|
||||
testView2.textColor = .black
|
||||
testView2.sizeToFit()
|
||||
|
||||
testView2.center = CGPoint(x: 250.0 - testView.frame.minX, y: 490.0 - testView.frame.minY)
|
||||
|
||||
let vibrancyEffect = UIVibrancyEffect(blurEffect: blurEffect)
|
||||
let vibrancyEffectView = UIVisualEffectView(effect: vibrancyEffect)
|
||||
//vibrancyEffectView.frame = CGRect(origin: CGPoint(), size: CGSize(width: 400.0, height: 300.0))
|
||||
vibrancyEffectView.tag = 123
|
||||
|
||||
vibrancyEffectView.contentView.addSubview(testView)
|
||||
testView.addSubview(testView2)
|
||||
//vibrancyEffectView.contentView.addSubview(testView2)
|
||||
|
||||
self.addSubview(vibrancyEffectView)
|
||||
|
||||
/*let view = UIView()
|
||||
view.tag = 123
|
||||
view.layer.compositingFilter = "sourceOverCompositing"
|
||||
view.backgroundColor = .white
|
||||
view.frame = CGRect(origin: CGPoint(), size: CGSize(width: 100.0, height: 200.0))
|
||||
self.addSubview(view)*/
|
||||
}
|
||||
|
||||
if let view = self.viewWithTag(123) {
|
||||
view.frame = CGRect(origin: CGPoint(), size: availableSize)
|
||||
}*/
|
||||
|
||||
self.update(size: availableSize, transition: transition.containedViewLayoutTransition)
|
||||
|
||||
if let tintContainerView = self.tintContainerView {
|
||||
transition.setFrame(view: tintContainerView, frame: CGRect(origin: CGPoint(), size: availableSize))
|
||||
}
|
||||
if let vibrancyEffectView = self.vibrancyEffectView {
|
||||
transition.setFrame(view: vibrancyEffectView, frame: CGRect(origin: CGPoint(), size: availableSize))
|
||||
}
|
||||
|
||||
return availableSize
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user