Various fixes

This commit is contained in:
Ilya Laktyushin 2023-04-23 20:28:51 +04:00
parent 0908a3cf63
commit a375a49dfd
3 changed files with 4 additions and 7 deletions

View File

@ -478,7 +478,7 @@ public class CheckLayer: CALayer {
case let .counter(number):
let text = NSAttributedString(string: "\(number)", font: Font.with(size: 16.0, design: .round, weight: .regular, traits: []), textColor: parameters.theme.strokeColor.withMultipliedAlpha(parameters.animationProgress))
let textRect = text.boundingRect(with: CGSize(width: 100.0, height: 100.0), options: [.usesLineFragmentOrigin], context: nil)
text.draw(at: CGPoint(x: UIScreenPixel + textRect.minX + floor((size.width - textRect.width) * 0.5), y: textRect.minY + floor((size.height - textRect.height) * 0.5)))
text.draw(at: CGPoint(x: UIScreenPixel + textRect.minX + floor((size.width - textRect.width) * 0.5), y: textRect.minY + floorToScreenPixels((size.height - textRect.height) * 0.5)))
}
}
}

View File

@ -1452,13 +1452,13 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
}
}
selectionState.setItem(item, selected: value)
let success = selectionState.setItem(item, selected: value)
if showUndo {
self.showSelectionUndo(item: item)
}
return true
return success
} else {
return false
}

View File

@ -205,10 +205,7 @@ public func chatTranslationState(context: AccountContext, peerId: EnginePeer.Id)
var fromLangs: [String: Int] = [:]
var count = 0
for message in messages {
if let _ = URL(string: message.text) {
continue
}
if message.text.count >= 10 {
if message.effectivelyIncoming(context.account.peerId), message.text.count >= 10 {
var text = String(message.text.prefix(256))
if var entities = message.textEntitiesAttribute?.entities.filter({ [.Pre, .Code, .Url, .Email, .Mention, .Hashtag, .BotCommand].contains($0.type) }) {
entities = entities.sorted(by: { $0.range.lowerBound > $1.range.lowerBound })