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:
Stefan Ceriu
2025-01-27 19:49:44 +02:00
committed by GitHub
parent fa72e5e4b6
commit d585e208a1
21 changed files with 383 additions and 181 deletions
@@ -19,6 +19,7 @@ struct AudioRoomTimelineView: View {
caption: timelineItem.content.caption,
formattedCaption: timelineItem.content.formattedCaption,
additionalWhitespaces: timelineItem.additionalWhitespaces(),
shouldBoost: timelineItem.shouldBoost,
isAudioFile: true) {
context?.send(viewAction: .mediaTapped(itemID: timelineItem.id))
}
@@ -18,7 +18,8 @@ struct FileRoomTimelineView: View {
fileSize: timelineItem.content.fileSize,
caption: timelineItem.content.caption,
formattedCaption: timelineItem.content.formattedCaption,
additionalWhitespaces: timelineItem.additionalWhitespaces()) {
additionalWhitespaces: timelineItem.additionalWhitespaces(),
shouldBoost: timelineItem.shouldBoost) {
context?.send(viewAction: .mediaTapped(itemID: timelineItem.id))
}
.accessibilityLabel(L10n.commonFile)
@@ -34,6 +35,7 @@ struct MediaFileRoomTimelineContent: View {
let caption: String?
let formattedCaption: AttributedString?
let additionalWhitespaces: Int
var shouldBoost = false
var isAudioFile = false
var onMediaTap: (() -> Void)?
@@ -55,10 +57,12 @@ struct MediaFileRoomTimelineContent: View {
if let formattedCaption {
FormattedBodyText(attributedString: formattedCaption,
additionalWhitespacesCount: additionalWhitespaces)
additionalWhitespacesCount: additionalWhitespaces,
boostFontSize: shouldBoost)
} else if let caption {
FormattedBodyText(text: caption,
additionalWhitespacesCount: additionalWhitespaces)
additionalWhitespacesCount: additionalWhitespaces,
boostFontSize: shouldBoost)
}
}
}
@@ -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()
@@ -30,11 +30,11 @@ struct ImageRoomTimelineView: View {
if let attributedCaption = timelineItem.content.formattedCaption {
FormattedBodyText(attributedString: attributedCaption,
additionalWhitespacesCount: timelineItem.additionalWhitespaces(),
boostEmojiSize: true)
boostFontSize: timelineItem.shouldBoost)
} else if let caption = timelineItem.content.caption {
FormattedBodyText(text: caption,
additionalWhitespacesCount: timelineItem.additionalWhitespaces(),
boostEmojiSize: true)
boostFontSize: timelineItem.shouldBoost)
}
}
}
@@ -16,11 +16,11 @@ struct TextRoomTimelineView: View, TextBasedRoomTimelineViewProtocol {
if let attributedString = timelineItem.content.formattedBody {
FormattedBodyText(attributedString: attributedString,
additionalWhitespacesCount: timelineItem.additionalWhitespaces(),
boostEmojiSize: true)
boostFontSize: timelineItem.shouldBoost)
} else {
FormattedBodyText(text: timelineItem.body,
additionalWhitespacesCount: timelineItem.additionalWhitespaces(),
boostEmojiSize: true)
boostFontSize: timelineItem.shouldBoost)
}
}
}
@@ -31,11 +31,11 @@ struct VideoRoomTimelineView: View {
if let attributedCaption = timelineItem.content.formattedCaption {
FormattedBodyText(attributedString: attributedCaption,
additionalWhitespacesCount: timelineItem.additionalWhitespaces(),
boostEmojiSize: true)
boostFontSize: timelineItem.shouldBoost)
} else if let caption = timelineItem.content.caption {
FormattedBodyText(text: caption,
additionalWhitespacesCount: timelineItem.additionalWhitespaces(),
boostEmojiSize: true)
boostFontSize: timelineItem.shouldBoost)
}
}
}