Fix crash

This commit is contained in:
Ilya Laktyushin 2022-06-11 16:46:07 +04:00
parent 2178261bad
commit f68632cb36
2 changed files with 37 additions and 37 deletions

View File

@ -819,41 +819,41 @@ private final class LimitSheetContent: CombinedComponent {
reachedMaximumLimit = false
}
let title = title.update(
component: MultilineTextComponent(
text: .plain(NSAttributedString(
string: titleText,
font: Font.semibold(17.0),
textColor: theme.actionSheet.primaryTextColor,
paragraphAlignment: .center
)),
horizontalAlignment: .center,
maximumNumberOfLines: 1
),
availableSize: CGSize(width: context.availableSize.width - sideInset * 2.0, height: CGFloat.greatestFiniteMagnitude),
transition: .immediate
)
let textFont = Font.regular(17.0)
let boldTextFont = Font.semibold(17.0)
let textColor = theme.actionSheet.primaryTextColor
let markdownAttributes = MarkdownAttributes(body: MarkdownAttributeSet(font: textFont, textColor: textColor), bold: MarkdownAttributeSet(font: boldTextFont, textColor: textColor), link: MarkdownAttributeSet(font: textFont, textColor: textColor), linkAttribute: { _ in
return nil
})
let text = text.update(
component: MultilineTextComponent(
text: .markdown(text: string, attributes: markdownAttributes),
horizontalAlignment: .center,
maximumNumberOfLines: 0,
lineSpacing: 0.0
),
availableSize: CGSize(width: context.availableSize.width - textSideInset * 2.0, height: context.availableSize.height),
transition: .immediate
)
let contentSize: CGSize
if state.initialized {
let title = title.update(
component: MultilineTextComponent(
text: .plain(NSAttributedString(
string: titleText,
font: Font.semibold(17.0),
textColor: theme.actionSheet.primaryTextColor,
paragraphAlignment: .center
)),
horizontalAlignment: .center,
maximumNumberOfLines: 1
),
availableSize: CGSize(width: context.availableSize.width - sideInset * 2.0, height: CGFloat.greatestFiniteMagnitude),
transition: .immediate
)
let textFont = Font.regular(17.0)
let boldTextFont = Font.semibold(17.0)
let textColor = theme.actionSheet.primaryTextColor
let markdownAttributes = MarkdownAttributes(body: MarkdownAttributeSet(font: textFont, textColor: textColor), bold: MarkdownAttributeSet(font: boldTextFont, textColor: textColor), link: MarkdownAttributeSet(font: textFont, textColor: textColor), linkAttribute: { _ in
return nil
})
let text = text.update(
component: MultilineTextComponent(
text: .markdown(text: string, attributes: markdownAttributes),
horizontalAlignment: .center,
maximumNumberOfLines: 0,
lineSpacing: 0.0
),
availableSize: CGSize(width: context.availableSize.width - textSideInset * 2.0, height: context.availableSize.height),
transition: .immediate
)
let gradientColors: [UIColor]
if isPremiumDisabled {
gradientColors = [

View File

@ -128,10 +128,10 @@ public final class SolidRoundedButtonNode: ASDisplayNode {
if self.gloss {
self.animationTimer?.invalidate()
Queue.mainQueue().after(0.75) {
Queue.mainQueue().after(1.25) {
self.animationNode?.play()
let timer = SwiftSignalKit.Timer(timeout: 3.0, repeat: true, completion: { [weak self] in
let timer = SwiftSignalKit.Timer(timeout: 4.0, repeat: true, completion: { [weak self] in
self?.animationNode?.play()
}, queue: Queue.mainQueue())
self.animationTimer = timer
@ -672,10 +672,10 @@ public final class SolidRoundedButtonView: UIView {
if self.gloss {
self.animationTimer?.invalidate()
Queue.mainQueue().after(0.75) {
Queue.mainQueue().after(1.25) {
self.animationNode?.play()
let timer = SwiftSignalKit.Timer(timeout: 3.0, repeat: true, completion: { [weak self] in
let timer = SwiftSignalKit.Timer(timeout: 4.0, repeat: true, completion: { [weak self] in
self?.animationNode?.play()
}, queue: Queue.mainQueue())
self.animationTimer = timer