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(
|
||||
InteractiveStickerButtonContent(
|
||||
theme: theme,
|
||||
title: "LOCATION",
|
||||
title: strings.MediaEditor_AddLocationShort,
|
||||
iconName: "Chat/Attach Menu/Location",
|
||||
useOpaqueTheme: useOpaqueTheme,
|
||||
tintContainerView: self.tintContainerView
|
||||
@@ -2380,7 +2380,7 @@ final class StoryStickersContentView: UIView, EmojiCustomContentView {
|
||||
component: AnyComponent(
|
||||
InteractiveStickerButtonContent(
|
||||
theme: theme,
|
||||
title: "AUDIO",
|
||||
title: strings.MediaEditor_AddAudio,
|
||||
iconName: "Media Editor/Audio",
|
||||
useOpaqueTheme: useOpaqueTheme,
|
||||
tintContainerView: self.tintContainerView
|
||||
|
||||
@@ -279,6 +279,7 @@ public class PremiumLimitDisplayComponent: Component {
|
||||
private let badgeForeground: SimpleLayer
|
||||
private let badgeIcon: UIImageView
|
||||
private let badgeCountLabel: RollingLabel
|
||||
private let countMaskView = UIImageView()
|
||||
|
||||
private let hapticFeedback = HapticFeedback()
|
||||
|
||||
@@ -314,6 +315,7 @@ public class PremiumLimitDisplayComponent: Component {
|
||||
self.badgeCountLabel.font = Font.with(size: 24.0, design: .round, weight: .semibold, traits: [])
|
||||
self.badgeCountLabel.textColor = .white
|
||||
self.badgeCountLabel.configure(with: "0")
|
||||
self.badgeCountLabel.mask = self.countMaskView
|
||||
|
||||
super.init(frame: frame)
|
||||
|
||||
@@ -327,6 +329,24 @@ public class PremiumLimitDisplayComponent: Component {
|
||||
self.badgeView.addSubview(self.badgeIcon)
|
||||
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
|
||||
}
|
||||
|
||||
@@ -360,7 +380,7 @@ public class PremiumLimitDisplayComponent: Component {
|
||||
Queue.mainQueue().after(0.5, {
|
||||
let bounceAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
|
||||
bounceAnimation.fromValue = -0.26 as NSNumber
|
||||
bounceAnimation.toValue = 0.035 as NSNumber
|
||||
bounceAnimation.toValue = 0.04 as NSNumber
|
||||
bounceAnimation.duration = 0.2
|
||||
bounceAnimation.fillMode = .forwards
|
||||
bounceAnimation.timingFunction = CAMediaTimingFunction(name: .easeOut)
|
||||
@@ -374,7 +394,7 @@ public class PremiumLimitDisplayComponent: Component {
|
||||
|
||||
Queue.mainQueue().after(0.2) {
|
||||
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.duration = 0.15
|
||||
returnAnimation.fillMode = .forwards
|
||||
@@ -390,7 +410,7 @@ public class PremiumLimitDisplayComponent: Component {
|
||||
}
|
||||
|
||||
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.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 !self.didPlayAppearanceAnimation {
|
||||
@@ -1425,6 +1446,7 @@ private final class LimitSheetContent: CombinedComponent {
|
||||
transition.animateAlpha(view: view, from: 0.0, to: 1.0)
|
||||
}))
|
||||
.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.setAlpha(view: view, alpha: 0.0, completion: { _ in
|
||||
completion()
|
||||
|
||||
@@ -37,18 +37,14 @@ open class RollingLabel: UILabel {
|
||||
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.clean()
|
||||
self.setupSubviews()
|
||||
|
||||
self.text = " "
|
||||
self.animate(duration: duration)
|
||||
}
|
||||
|
||||
private func animate(ascending: Bool = true, duration: Double) {
|
||||
self.createAnimations(ascending: ascending, duration: duration)
|
||||
self.animate(increment: increment, duration: duration)
|
||||
}
|
||||
|
||||
private func clean() {
|
||||
@@ -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
|
||||
|
||||
for scrollLayer in scrollLayers {
|
||||
for scrollLayer in self.scrollLayers {
|
||||
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")
|
||||
animation.duration = duration + offset
|
||||
@@ -179,7 +176,11 @@ open class RollingLabel: UILabel {
|
||||
|
||||
let verticalOffset = 20.0
|
||||
if ascending {
|
||||
if increment {
|
||||
animation.fromValue = height + verticalOffset
|
||||
} else {
|
||||
animation.fromValue = maxY + verticalOffset
|
||||
}
|
||||
animation.toValue = 0
|
||||
} else {
|
||||
animation.fromValue = 0
|
||||
|
||||
@@ -474,7 +474,7 @@ private enum StatsEntry: ItemListNodeEntry {
|
||||
})
|
||||
case let .booster(_, _, dateTimeFormat, peer, expires):
|
||||
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)
|
||||
}, setPeerIdWithRevealedOptions: { _, _ in }, removePeer: { _ in })
|
||||
case let .boostersExpand(theme, title):
|
||||
|
||||
Reference in New Issue
Block a user