mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 20:09:04 +00:00
Bump the RustSDK to 25.01.27, adopt the new emoji boosting API. (#3708)
* Bump the RustSDK to v27.01.22, adopt the new emoji boosting API. * SDK version 25.01.22 😅 --------- Co-authored-by: Doug <douglase@element.io>
This commit is contained in:
@@ -12,7 +12,7 @@ struct FormattedBodyText: View {
|
||||
|
||||
private let attributedString: AttributedString
|
||||
private let additionalWhitespacesCount: Int
|
||||
private let boostEmojiSize: Bool
|
||||
private let boostFontSize: Bool
|
||||
|
||||
private let defaultAttributesContainer: AttributeContainer = {
|
||||
var container = AttributeContainer()
|
||||
@@ -35,9 +35,7 @@ struct FormattedBodyText: View {
|
||||
|
||||
let string = String(attributedString.characters)
|
||||
|
||||
if boostEmojiSize,
|
||||
string.containsOnlyEmoji,
|
||||
let range = adjustedAttributedString.range(of: string) {
|
||||
if boostFontSize, let range = adjustedAttributedString.range(of: string) {
|
||||
adjustedAttributedString[range].font = UIFont.systemFont(ofSize: 48.0)
|
||||
}
|
||||
|
||||
@@ -46,16 +44,16 @@ struct FormattedBodyText: View {
|
||||
|
||||
init(attributedString: AttributedString,
|
||||
additionalWhitespacesCount: Int = 0,
|
||||
boostEmojiSize: Bool = false) {
|
||||
boostFontSize: Bool = false) {
|
||||
self.attributedString = attributedString
|
||||
self.additionalWhitespacesCount = additionalWhitespacesCount
|
||||
self.boostEmojiSize = boostEmojiSize
|
||||
self.boostFontSize = boostFontSize
|
||||
}
|
||||
|
||||
init(text: String, additionalWhitespacesCount: Int = 0, boostEmojiSize: Bool = false) {
|
||||
init(text: String, additionalWhitespacesCount: Int = 0, boostFontSize: Bool = false) {
|
||||
self.init(attributedString: AttributedString(text),
|
||||
additionalWhitespacesCount: additionalWhitespacesCount,
|
||||
boostEmojiSize: boostEmojiSize)
|
||||
boostFontSize: boostFontSize)
|
||||
}
|
||||
|
||||
// These is needed to create the slightly off inlined timestamp effect
|
||||
@@ -199,7 +197,7 @@ struct FormattedBodyText_Previews: PreviewProvider, TestablePreview {
|
||||
FormattedBodyText(text: "Some plain text that's not an attributed component. This one is really long.")
|
||||
.bubbleBackground()
|
||||
|
||||
FormattedBodyText(text: "❤️", boostEmojiSize: true)
|
||||
FormattedBodyText(text: "❤️", boostFontSize: true)
|
||||
.bubbleBackground()
|
||||
}
|
||||
.padding()
|
||||
|
||||
Reference in New Issue
Block a user