mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
Various fixes
This commit is contained in:
@@ -2357,7 +2357,7 @@ final class StoryStickersContentView: UIView, EmojiCustomContentView {
|
|||||||
component: AnyComponent(
|
component: AnyComponent(
|
||||||
InteractiveStickerButtonContent(
|
InteractiveStickerButtonContent(
|
||||||
theme: theme,
|
theme: theme,
|
||||||
title: "LOCATION",
|
title: strings.MediaEditor_AddLocationShort,
|
||||||
iconName: "Chat/Attach Menu/Location",
|
iconName: "Chat/Attach Menu/Location",
|
||||||
useOpaqueTheme: useOpaqueTheme,
|
useOpaqueTheme: useOpaqueTheme,
|
||||||
tintContainerView: self.tintContainerView
|
tintContainerView: self.tintContainerView
|
||||||
@@ -2380,7 +2380,7 @@ final class StoryStickersContentView: UIView, EmojiCustomContentView {
|
|||||||
component: AnyComponent(
|
component: AnyComponent(
|
||||||
InteractiveStickerButtonContent(
|
InteractiveStickerButtonContent(
|
||||||
theme: theme,
|
theme: theme,
|
||||||
title: "AUDIO",
|
title: strings.MediaEditor_AddAudio,
|
||||||
iconName: "Media Editor/Audio",
|
iconName: "Media Editor/Audio",
|
||||||
useOpaqueTheme: useOpaqueTheme,
|
useOpaqueTheme: useOpaqueTheme,
|
||||||
tintContainerView: self.tintContainerView
|
tintContainerView: self.tintContainerView
|
||||||
|
|||||||
@@ -279,6 +279,7 @@ public class PremiumLimitDisplayComponent: Component {
|
|||||||
private let badgeForeground: SimpleLayer
|
private let badgeForeground: SimpleLayer
|
||||||
private let badgeIcon: UIImageView
|
private let badgeIcon: UIImageView
|
||||||
private let badgeCountLabel: RollingLabel
|
private let badgeCountLabel: RollingLabel
|
||||||
|
private let countMaskView = UIImageView()
|
||||||
|
|
||||||
private let hapticFeedback = HapticFeedback()
|
private let hapticFeedback = HapticFeedback()
|
||||||
|
|
||||||
@@ -309,11 +310,12 @@ public class PremiumLimitDisplayComponent: Component {
|
|||||||
|
|
||||||
self.badgeIcon = UIImageView()
|
self.badgeIcon = UIImageView()
|
||||||
self.badgeIcon.contentMode = .center
|
self.badgeIcon.contentMode = .center
|
||||||
|
|
||||||
self.badgeCountLabel = RollingLabel()
|
self.badgeCountLabel = RollingLabel()
|
||||||
self.badgeCountLabel.font = Font.with(size: 24.0, design: .round, weight: .semibold, traits: [])
|
self.badgeCountLabel.font = Font.with(size: 24.0, design: .round, weight: .semibold, traits: [])
|
||||||
self.badgeCountLabel.textColor = .white
|
self.badgeCountLabel.textColor = .white
|
||||||
self.badgeCountLabel.configure(with: "0")
|
self.badgeCountLabel.configure(with: "0")
|
||||||
|
self.badgeCountLabel.mask = self.countMaskView
|
||||||
|
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
|
|
||||||
@@ -327,6 +329,24 @@ public class PremiumLimitDisplayComponent: Component {
|
|||||||
self.badgeView.addSubview(self.badgeIcon)
|
self.badgeView.addSubview(self.badgeIcon)
|
||||||
self.badgeView.addSubview(self.badgeCountLabel)
|
self.badgeView.addSubview(self.badgeCountLabel)
|
||||||
|
|
||||||
|
self.countMaskView.contentMode = .scaleToFill
|
||||||
|
self.countMaskView.image = generateImage(CGSize(width: 2.0, height: 48.0), rotatedContext: { size, context in
|
||||||
|
let bounds = CGRect(origin: .zero, size: size)
|
||||||
|
context.clear(bounds)
|
||||||
|
|
||||||
|
let colorsArray: [CGColor] = [
|
||||||
|
UIColor(rgb: 0xffffff, alpha: 0.0).cgColor,
|
||||||
|
UIColor(rgb: 0xffffff).cgColor,
|
||||||
|
UIColor(rgb: 0xffffff).cgColor,
|
||||||
|
UIColor(rgb: 0xffffff, alpha: 0.0).cgColor,
|
||||||
|
UIColor(rgb: 0xffffff, alpha: 0.0).cgColor
|
||||||
|
]
|
||||||
|
var locations: [CGFloat] = [0.0, 0.11, 0.46, 0.57, 1.0]
|
||||||
|
let gradient = CGGradient(colorsSpace: deviceColorSpace, colors: colorsArray as CFArray, locations: &locations)!
|
||||||
|
|
||||||
|
context.drawLinearGradient(gradient, start: CGPoint(x: 0.0, y: 0.0), end: CGPoint(x: 0.0, y: size.height), options: CGGradientDrawingOptions())
|
||||||
|
})
|
||||||
|
|
||||||
self.isUserInteractionEnabled = false
|
self.isUserInteractionEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,7 +380,7 @@ public class PremiumLimitDisplayComponent: Component {
|
|||||||
Queue.mainQueue().after(0.5, {
|
Queue.mainQueue().after(0.5, {
|
||||||
let bounceAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
|
let bounceAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
|
||||||
bounceAnimation.fromValue = -0.26 as NSNumber
|
bounceAnimation.fromValue = -0.26 as NSNumber
|
||||||
bounceAnimation.toValue = 0.035 as NSNumber
|
bounceAnimation.toValue = 0.04 as NSNumber
|
||||||
bounceAnimation.duration = 0.2
|
bounceAnimation.duration = 0.2
|
||||||
bounceAnimation.fillMode = .forwards
|
bounceAnimation.fillMode = .forwards
|
||||||
bounceAnimation.timingFunction = CAMediaTimingFunction(name: .easeOut)
|
bounceAnimation.timingFunction = CAMediaTimingFunction(name: .easeOut)
|
||||||
@@ -374,7 +394,7 @@ public class PremiumLimitDisplayComponent: Component {
|
|||||||
|
|
||||||
Queue.mainQueue().after(0.2) {
|
Queue.mainQueue().after(0.2) {
|
||||||
let returnAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
|
let returnAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
|
||||||
returnAnimation.fromValue = 0.035 as NSNumber
|
returnAnimation.fromValue = 0.04 as NSNumber
|
||||||
returnAnimation.toValue = 0.0 as NSNumber
|
returnAnimation.toValue = 0.0 as NSNumber
|
||||||
returnAnimation.duration = 0.15
|
returnAnimation.duration = 0.15
|
||||||
returnAnimation.fillMode = .forwards
|
returnAnimation.fillMode = .forwards
|
||||||
@@ -390,7 +410,7 @@ public class PremiumLimitDisplayComponent: Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let badgeText = component.badgeText {
|
if let badgeText = component.badgeText {
|
||||||
self.badgeCountLabel.configure(with: badgeText, duration: from != nil ? 0.3 : 0.5)
|
self.badgeCountLabel.configure(with: badgeText, increment: from != nil, duration: from != nil ? 0.3 : 0.5)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -671,6 +691,7 @@ public class PremiumLimitDisplayComponent: Component {
|
|||||||
|
|
||||||
self.badgeIcon.frame = CGRect(x: 10.0, y: 9.0, width: 30.0, height: 30.0)
|
self.badgeIcon.frame = CGRect(x: 10.0, y: 9.0, width: 30.0, height: 30.0)
|
||||||
self.badgeCountLabel.frame = CGRect(x: badgeFullSize.width - countWidth - 11.0, y: 10.0, width: countWidth, height: 48.0)
|
self.badgeCountLabel.frame = CGRect(x: badgeFullSize.width - countWidth - 11.0, y: 10.0, width: countWidth, height: 48.0)
|
||||||
|
self.countMaskView.frame = CGRect(x: 0.0, y: 0.0, width: countWidth, height: 48.0)
|
||||||
|
|
||||||
if component.isPremiumDisabled {
|
if component.isPremiumDisabled {
|
||||||
if !self.didPlayAppearanceAnimation {
|
if !self.didPlayAppearanceAnimation {
|
||||||
@@ -1425,6 +1446,7 @@ private final class LimitSheetContent: CombinedComponent {
|
|||||||
transition.animateAlpha(view: view, from: 0.0, to: 1.0)
|
transition.animateAlpha(view: view, from: 0.0, to: 1.0)
|
||||||
}))
|
}))
|
||||||
.disappear(Transition.Disappear({ view, transition, completion in
|
.disappear(Transition.Disappear({ view, transition, completion in
|
||||||
|
view.superview?.sendSubviewToBack(view)
|
||||||
transition.animatePosition(view: view, from: .zero, to: CGPoint(x: 0.0, y: -64.0), additive: true)
|
transition.animatePosition(view: view, from: .zero, to: CGPoint(x: 0.0, y: -64.0), additive: true)
|
||||||
transition.setAlpha(view: view, alpha: 0.0, completion: { _ in
|
transition.setAlpha(view: view, alpha: 0.0, completion: { _ in
|
||||||
completion()
|
completion()
|
||||||
|
|||||||
@@ -37,20 +37,16 @@ open class RollingLabel: UILabel {
|
|||||||
self.suffix = suffix
|
self.suffix = suffix
|
||||||
}
|
}
|
||||||
|
|
||||||
func configure(with string: String, duration: Double = 0.9) {
|
func configure(with string: String, increment: Bool = false, duration: Double = 0.0) {
|
||||||
self.fullText = string
|
self.fullText = string
|
||||||
|
|
||||||
self.clean()
|
self.clean()
|
||||||
self.setupSubviews()
|
self.setupSubviews()
|
||||||
|
|
||||||
self.text = " "
|
self.text = " "
|
||||||
self.animate(duration: duration)
|
self.animate(increment: increment, duration: duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func animate(ascending: Bool = true, duration: Double) {
|
|
||||||
self.createAnimations(ascending: ascending, duration: duration)
|
|
||||||
}
|
|
||||||
|
|
||||||
private func clean() {
|
private func clean() {
|
||||||
self.text = nil
|
self.text = nil
|
||||||
self.subviews.forEach { $0.removeFromSuperview() }
|
self.subviews.forEach { $0.removeFromSuperview() }
|
||||||
@@ -167,11 +163,12 @@ open class RollingLabel: UILabel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func createAnimations(ascending: Bool, duration: Double) {
|
private func animate(ascending: Bool = true, increment: Bool, duration: Double) {
|
||||||
var offset: CFTimeInterval = 0.0
|
var offset: CFTimeInterval = 0.0
|
||||||
|
|
||||||
for scrollLayer in scrollLayers {
|
for scrollLayer in self.scrollLayers {
|
||||||
let maxY = scrollLayer.sublayers?.last?.frame.origin.y ?? 0.0
|
let maxY = scrollLayer.sublayers?.last?.frame.origin.y ?? 0.0
|
||||||
|
let height = scrollLayer.sublayers?.last?.frame.size.height ?? 0.0
|
||||||
|
|
||||||
let animation = CABasicAnimation(keyPath: "sublayerTransform.translation.y")
|
let animation = CABasicAnimation(keyPath: "sublayerTransform.translation.y")
|
||||||
animation.duration = duration + offset
|
animation.duration = duration + offset
|
||||||
@@ -179,7 +176,11 @@ open class RollingLabel: UILabel {
|
|||||||
|
|
||||||
let verticalOffset = 20.0
|
let verticalOffset = 20.0
|
||||||
if ascending {
|
if ascending {
|
||||||
animation.fromValue = maxY + verticalOffset
|
if increment {
|
||||||
|
animation.fromValue = height + verticalOffset
|
||||||
|
} else {
|
||||||
|
animation.fromValue = maxY + verticalOffset
|
||||||
|
}
|
||||||
animation.toValue = 0
|
animation.toValue = 0
|
||||||
} else {
|
} else {
|
||||||
animation.fromValue = 0
|
animation.fromValue = 0
|
||||||
|
|||||||
@@ -474,7 +474,7 @@ private enum StatsEntry: ItemListNodeEntry {
|
|||||||
})
|
})
|
||||||
case let .booster(_, _, dateTimeFormat, peer, expires):
|
case let .booster(_, _, dateTimeFormat, peer, expires):
|
||||||
let expiresValue = stringForFullDate(timestamp: expires, strings: presentationData.strings, dateTimeFormat: dateTimeFormat)
|
let expiresValue = stringForFullDate(timestamp: expires, strings: presentationData.strings, dateTimeFormat: dateTimeFormat)
|
||||||
return ItemListPeerItem(presentationData: presentationData, dateTimeFormat: PresentationDateTimeFormat(), nameDisplayOrder: presentationData.nameDisplayOrder, context: arguments.context, peer: peer, presence: nil, text: .text(presentationData.strings.Stats_Boosts_ExpiresOn(expiresValue).string, .secondary), label: .none, editing: ItemListPeerItemEditing(editable: false, editing: false, revealed: false), switchValue: nil, enabled: true, selectable: true, sectionId: self.section, action: {
|
return ItemListPeerItem(presentationData: presentationData, dateTimeFormat: PresentationDateTimeFormat(), nameDisplayOrder: presentationData.nameDisplayOrder, context: arguments.context, peer: peer, presence: nil, text: .text(presentationData.strings.Stats_Boosts_ExpiresOn(expiresValue).string, .secondary), label: .none, editing: ItemListPeerItemEditing(editable: false, editing: false, revealed: false), switchValue: nil, enabled: true, selectable: peer.id != arguments.context.account.peerId, sectionId: self.section, action: {
|
||||||
arguments.openPeer(peer)
|
arguments.openPeer(peer)
|
||||||
}, setPeerIdWithRevealedOptions: { _, _ in }, removePeer: { _ in })
|
}, setPeerIdWithRevealedOptions: { _, _ in }, removePeer: { _ in })
|
||||||
case let .boostersExpand(theme, title):
|
case let .boostersExpand(theme, title):
|
||||||
|
|||||||
Reference in New Issue
Block a user