mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +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:
@@ -8088,6 +8088,71 @@ open class LazyTimelineItemProviderSDKMock: MatrixRustSDK.LazyTimelineItemProvid
|
||||
|
||||
fileprivate var pointer: UnsafeMutableRawPointer!
|
||||
|
||||
//MARK: - containsOnlyEmojis
|
||||
|
||||
var containsOnlyEmojisUnderlyingCallsCount = 0
|
||||
open var containsOnlyEmojisCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return containsOnlyEmojisUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = containsOnlyEmojisUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
containsOnlyEmojisUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
containsOnlyEmojisUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var containsOnlyEmojisCalled: Bool {
|
||||
return containsOnlyEmojisCallsCount > 0
|
||||
}
|
||||
|
||||
var containsOnlyEmojisUnderlyingReturnValue: Bool!
|
||||
open var containsOnlyEmojisReturnValue: Bool! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return containsOnlyEmojisUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: Bool? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = containsOnlyEmojisUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
containsOnlyEmojisUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
containsOnlyEmojisUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var containsOnlyEmojisClosure: (() -> Bool)?
|
||||
|
||||
open override func containsOnlyEmojis() -> Bool {
|
||||
containsOnlyEmojisCallsCount += 1
|
||||
if let containsOnlyEmojisClosure = containsOnlyEmojisClosure {
|
||||
return containsOnlyEmojisClosure()
|
||||
} else {
|
||||
return containsOnlyEmojisReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - debugInfo
|
||||
|
||||
var debugInfoUnderlyingCallsCount = 0
|
||||
@@ -13988,6 +14053,52 @@ open class RoomSDKMock: MatrixRustSDK.Room, @unchecked Sendable {
|
||||
try await sendCallNotificationIfNeededClosure?()
|
||||
}
|
||||
|
||||
//MARK: - sendLiveLocation
|
||||
|
||||
open var sendLiveLocationGeoUriThrowableError: Error?
|
||||
var sendLiveLocationGeoUriUnderlyingCallsCount = 0
|
||||
open var sendLiveLocationGeoUriCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return sendLiveLocationGeoUriUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = sendLiveLocationGeoUriUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
sendLiveLocationGeoUriUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
sendLiveLocationGeoUriUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var sendLiveLocationGeoUriCalled: Bool {
|
||||
return sendLiveLocationGeoUriCallsCount > 0
|
||||
}
|
||||
open var sendLiveLocationGeoUriReceivedGeoUri: String?
|
||||
open var sendLiveLocationGeoUriReceivedInvocations: [String] = []
|
||||
open var sendLiveLocationGeoUriClosure: ((String) async throws -> Void)?
|
||||
|
||||
open override func sendLiveLocation(geoUri: String) async throws {
|
||||
if let error = sendLiveLocationGeoUriThrowableError {
|
||||
throw error
|
||||
}
|
||||
sendLiveLocationGeoUriCallsCount += 1
|
||||
sendLiveLocationGeoUriReceivedGeoUri = geoUri
|
||||
DispatchQueue.main.async {
|
||||
self.sendLiveLocationGeoUriReceivedInvocations.append(geoUri)
|
||||
}
|
||||
try await sendLiveLocationGeoUriClosure?(geoUri)
|
||||
}
|
||||
|
||||
//MARK: - sendRaw
|
||||
|
||||
open var sendRawEventTypeContentThrowableError: Error?
|
||||
@@ -14264,6 +14375,92 @@ open class RoomSDKMock: MatrixRustSDK.Room, @unchecked Sendable {
|
||||
try await setUnreadFlagNewValueClosure?(newValue)
|
||||
}
|
||||
|
||||
//MARK: - startLiveLocationShare
|
||||
|
||||
open var startLiveLocationShareDurationMillisThrowableError: Error?
|
||||
var startLiveLocationShareDurationMillisUnderlyingCallsCount = 0
|
||||
open var startLiveLocationShareDurationMillisCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return startLiveLocationShareDurationMillisUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = startLiveLocationShareDurationMillisUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
startLiveLocationShareDurationMillisUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
startLiveLocationShareDurationMillisUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var startLiveLocationShareDurationMillisCalled: Bool {
|
||||
return startLiveLocationShareDurationMillisCallsCount > 0
|
||||
}
|
||||
open var startLiveLocationShareDurationMillisReceivedDurationMillis: UInt64?
|
||||
open var startLiveLocationShareDurationMillisReceivedInvocations: [UInt64] = []
|
||||
open var startLiveLocationShareDurationMillisClosure: ((UInt64) async throws -> Void)?
|
||||
|
||||
open override func startLiveLocationShare(durationMillis: UInt64) async throws {
|
||||
if let error = startLiveLocationShareDurationMillisThrowableError {
|
||||
throw error
|
||||
}
|
||||
startLiveLocationShareDurationMillisCallsCount += 1
|
||||
startLiveLocationShareDurationMillisReceivedDurationMillis = durationMillis
|
||||
DispatchQueue.main.async {
|
||||
self.startLiveLocationShareDurationMillisReceivedInvocations.append(durationMillis)
|
||||
}
|
||||
try await startLiveLocationShareDurationMillisClosure?(durationMillis)
|
||||
}
|
||||
|
||||
//MARK: - stopLiveLocationShare
|
||||
|
||||
open var stopLiveLocationShareThrowableError: Error?
|
||||
var stopLiveLocationShareUnderlyingCallsCount = 0
|
||||
open var stopLiveLocationShareCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return stopLiveLocationShareUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = stopLiveLocationShareUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
stopLiveLocationShareUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
stopLiveLocationShareUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var stopLiveLocationShareCalled: Bool {
|
||||
return stopLiveLocationShareCallsCount > 0
|
||||
}
|
||||
open var stopLiveLocationShareClosure: (() async throws -> Void)?
|
||||
|
||||
open override func stopLiveLocationShare() async throws {
|
||||
if let error = stopLiveLocationShareThrowableError {
|
||||
throw error
|
||||
}
|
||||
stopLiveLocationShareCallsCount += 1
|
||||
try await stopLiveLocationShareClosure?()
|
||||
}
|
||||
|
||||
//MARK: - subscribeToIdentityStatusChanges
|
||||
|
||||
var subscribeToIdentityStatusChangesListenerUnderlyingCallsCount = 0
|
||||
@@ -14410,6 +14607,77 @@ open class RoomSDKMock: MatrixRustSDK.Room, @unchecked Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - subscribeToLiveLocationShares
|
||||
|
||||
var subscribeToLiveLocationSharesListenerUnderlyingCallsCount = 0
|
||||
open var subscribeToLiveLocationSharesListenerCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return subscribeToLiveLocationSharesListenerUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = subscribeToLiveLocationSharesListenerUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
subscribeToLiveLocationSharesListenerUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
subscribeToLiveLocationSharesListenerUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var subscribeToLiveLocationSharesListenerCalled: Bool {
|
||||
return subscribeToLiveLocationSharesListenerCallsCount > 0
|
||||
}
|
||||
open var subscribeToLiveLocationSharesListenerReceivedListener: LiveLocationShareListener?
|
||||
open var subscribeToLiveLocationSharesListenerReceivedInvocations: [LiveLocationShareListener] = []
|
||||
|
||||
var subscribeToLiveLocationSharesListenerUnderlyingReturnValue: TaskHandle!
|
||||
open var subscribeToLiveLocationSharesListenerReturnValue: TaskHandle! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return subscribeToLiveLocationSharesListenerUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: TaskHandle? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = subscribeToLiveLocationSharesListenerUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
subscribeToLiveLocationSharesListenerUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
subscribeToLiveLocationSharesListenerUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var subscribeToLiveLocationSharesListenerClosure: ((LiveLocationShareListener) -> TaskHandle)?
|
||||
|
||||
open override func subscribeToLiveLocationShares(listener: LiveLocationShareListener) -> TaskHandle {
|
||||
subscribeToLiveLocationSharesListenerCallsCount += 1
|
||||
subscribeToLiveLocationSharesListenerReceivedListener = listener
|
||||
DispatchQueue.main.async {
|
||||
self.subscribeToLiveLocationSharesListenerReceivedInvocations.append(listener)
|
||||
}
|
||||
if let subscribeToLiveLocationSharesListenerClosure = subscribeToLiveLocationSharesListenerClosure {
|
||||
return subscribeToLiveLocationSharesListenerClosure(listener)
|
||||
} else {
|
||||
return subscribeToLiveLocationSharesListenerReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - subscribeToRoomInfoUpdates
|
||||
|
||||
var subscribeToRoomInfoUpdatesListenerUnderlyingCallsCount = 0
|
||||
@@ -19713,81 +19981,6 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline, @unchecked Sendable {
|
||||
await fetchMembersClosure?()
|
||||
}
|
||||
|
||||
//MARK: - focusedPaginateForwards
|
||||
|
||||
open var focusedPaginateForwardsNumEventsThrowableError: Error?
|
||||
var focusedPaginateForwardsNumEventsUnderlyingCallsCount = 0
|
||||
open var focusedPaginateForwardsNumEventsCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return focusedPaginateForwardsNumEventsUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = focusedPaginateForwardsNumEventsUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
focusedPaginateForwardsNumEventsUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
focusedPaginateForwardsNumEventsUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var focusedPaginateForwardsNumEventsCalled: Bool {
|
||||
return focusedPaginateForwardsNumEventsCallsCount > 0
|
||||
}
|
||||
open var focusedPaginateForwardsNumEventsReceivedNumEvents: UInt16?
|
||||
open var focusedPaginateForwardsNumEventsReceivedInvocations: [UInt16] = []
|
||||
|
||||
var focusedPaginateForwardsNumEventsUnderlyingReturnValue: Bool!
|
||||
open var focusedPaginateForwardsNumEventsReturnValue: Bool! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return focusedPaginateForwardsNumEventsUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: Bool? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = focusedPaginateForwardsNumEventsUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
focusedPaginateForwardsNumEventsUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
focusedPaginateForwardsNumEventsUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var focusedPaginateForwardsNumEventsClosure: ((UInt16) async throws -> Bool)?
|
||||
|
||||
open override func focusedPaginateForwards(numEvents: UInt16) async throws -> Bool {
|
||||
if let error = focusedPaginateForwardsNumEventsThrowableError {
|
||||
throw error
|
||||
}
|
||||
focusedPaginateForwardsNumEventsCallsCount += 1
|
||||
focusedPaginateForwardsNumEventsReceivedNumEvents = numEvents
|
||||
DispatchQueue.main.async {
|
||||
self.focusedPaginateForwardsNumEventsReceivedInvocations.append(numEvents)
|
||||
}
|
||||
if let focusedPaginateForwardsNumEventsClosure = focusedPaginateForwardsNumEventsClosure {
|
||||
return try await focusedPaginateForwardsNumEventsClosure(numEvents)
|
||||
} else {
|
||||
return focusedPaginateForwardsNumEventsReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - getEventTimelineItemByEventId
|
||||
|
||||
open var getEventTimelineItemByEventIdEventIdThrowableError: Error?
|
||||
@@ -20059,6 +20252,81 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline, @unchecked Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - paginateForwards
|
||||
|
||||
open var paginateForwardsNumEventsThrowableError: Error?
|
||||
var paginateForwardsNumEventsUnderlyingCallsCount = 0
|
||||
open var paginateForwardsNumEventsCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return paginateForwardsNumEventsUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = paginateForwardsNumEventsUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
paginateForwardsNumEventsUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
paginateForwardsNumEventsUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var paginateForwardsNumEventsCalled: Bool {
|
||||
return paginateForwardsNumEventsCallsCount > 0
|
||||
}
|
||||
open var paginateForwardsNumEventsReceivedNumEvents: UInt16?
|
||||
open var paginateForwardsNumEventsReceivedInvocations: [UInt16] = []
|
||||
|
||||
var paginateForwardsNumEventsUnderlyingReturnValue: Bool!
|
||||
open var paginateForwardsNumEventsReturnValue: Bool! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return paginateForwardsNumEventsUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: Bool? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = paginateForwardsNumEventsUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
paginateForwardsNumEventsUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
paginateForwardsNumEventsUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var paginateForwardsNumEventsClosure: ((UInt16) async throws -> Bool)?
|
||||
|
||||
open override func paginateForwards(numEvents: UInt16) async throws -> Bool {
|
||||
if let error = paginateForwardsNumEventsThrowableError {
|
||||
throw error
|
||||
}
|
||||
paginateForwardsNumEventsCallsCount += 1
|
||||
paginateForwardsNumEventsReceivedNumEvents = numEvents
|
||||
DispatchQueue.main.async {
|
||||
self.paginateForwardsNumEventsReceivedInvocations.append(numEvents)
|
||||
}
|
||||
if let paginateForwardsNumEventsClosure = paginateForwardsNumEventsClosure {
|
||||
return try await paginateForwardsNumEventsClosure(numEvents)
|
||||
} else {
|
||||
return paginateForwardsNumEventsReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - pinEvent
|
||||
|
||||
open var pinEventEventIdThrowableError: Error?
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
//
|
||||
// Copyright 2023, 2024 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
// Taken from https://gist.github.com/krummler/879e1ce942893db3104783d1d0e67b34
|
||||
extension Character {
|
||||
/// A simple emoji is one scalar and presented to the user as an Emoji
|
||||
var isSimpleEmoji: Bool {
|
||||
unicodeScalars.count == 1 && unicodeScalars.first?.properties.isEmojiPresentation ?? false
|
||||
}
|
||||
|
||||
/// Checks if the scalars will be merged into and emoji
|
||||
var isCombinedIntoEmoji: Bool {
|
||||
unicodeScalars.count > 1 &&
|
||||
unicodeScalars.contains { $0.properties.isJoinControl || $0.properties.isVariationSelector }
|
||||
}
|
||||
|
||||
var isEmoji: Bool {
|
||||
isSimpleEmoji || isCombinedIntoEmoji
|
||||
}
|
||||
}
|
||||
|
||||
extension String {
|
||||
var containsOnlyEmoji: Bool {
|
||||
!isEmpty && !contains { !$0.isEmoji }
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ extension ClientBuilder {
|
||||
.roomDecryptionTrustRequirement(trustRequirement: .crossSignedOrLegacy)
|
||||
} else {
|
||||
builder = builder
|
||||
.roomKeyRecipientStrategy(strategy: .deviceBasedStrategy(onlyAllowTrustedDevices: false, errorOnVerifiedUserProblem: true))
|
||||
.roomKeyRecipientStrategy(strategy: .errorOnVerifiedUserProblem)
|
||||
.roomDecryptionTrustRequirement(trustRequirement: .untrusted)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
+2
-2
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +137,8 @@ class EventTimelineItemProxy {
|
||||
|
||||
lazy var sendHandle = item.lazyProvider.getSendHandle()
|
||||
|
||||
lazy var shouldBoost = item.lazyProvider.containsOnlyEmojis()
|
||||
|
||||
lazy var readReceipts = item.readReceipts
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -14,6 +14,8 @@ struct AudioRoomTimelineItem: EventBasedMessageTimelineItemProtocol, Equatable {
|
||||
let isEditable: Bool
|
||||
let canBeRepliedTo: Bool
|
||||
let isThreaded: Bool
|
||||
var shouldBoost = false
|
||||
|
||||
let sender: TimelineItemSender
|
||||
|
||||
let content: AudioRoomTimelineItemContent
|
||||
|
||||
+1
-1
@@ -14,8 +14,8 @@ struct FileRoomTimelineItem: EventBasedMessageTimelineItemProtocol, Equatable {
|
||||
let isOutgoing: Bool
|
||||
let isEditable: Bool
|
||||
let canBeRepliedTo: Bool
|
||||
|
||||
let isThreaded: Bool
|
||||
var shouldBoost = false
|
||||
|
||||
let sender: TimelineItemSender
|
||||
|
||||
|
||||
+1
@@ -15,6 +15,7 @@ struct ImageRoomTimelineItem: EventBasedMessageTimelineItemProtocol, Equatable {
|
||||
let isEditable: Bool
|
||||
let canBeRepliedTo: Bool
|
||||
let isThreaded: Bool
|
||||
var shouldBoost = false
|
||||
|
||||
let sender: TimelineItemSender
|
||||
|
||||
|
||||
+1
-1
@@ -14,8 +14,8 @@ struct TextRoomTimelineItem: TextBasedRoomTimelineItem, Equatable {
|
||||
let isOutgoing: Bool
|
||||
let isEditable: Bool
|
||||
let canBeRepliedTo: Bool
|
||||
|
||||
let isThreaded: Bool
|
||||
var shouldBoost = false
|
||||
|
||||
let sender: TimelineItemSender
|
||||
|
||||
|
||||
+1
@@ -15,6 +15,7 @@ struct VideoRoomTimelineItem: EventBasedMessageTimelineItemProtocol, Equatable {
|
||||
let isEditable: Bool
|
||||
let canBeRepliedTo: Bool
|
||||
let isThreaded: Bool
|
||||
var shouldBoost = false
|
||||
|
||||
let sender: TimelineItemSender
|
||||
|
||||
|
||||
@@ -205,6 +205,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
isEditable: eventItemProxy.isEditable,
|
||||
canBeRepliedTo: eventItemProxy.canBeRepliedTo,
|
||||
isThreaded: messageContent.threadRoot != nil,
|
||||
shouldBoost: eventItemProxy.shouldBoost,
|
||||
sender: eventItemProxy.sender,
|
||||
content: buildTextTimelineItemContent(textMessageContent),
|
||||
replyDetails: buildReplyToDetailsFromDetailsIfAvailable(details: messageContent.inReplyTo),
|
||||
@@ -225,6 +226,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
isEditable: eventItemProxy.isEditable,
|
||||
canBeRepliedTo: eventItemProxy.canBeRepliedTo,
|
||||
isThreaded: messageContent.threadRoot != nil,
|
||||
shouldBoost: eventItemProxy.shouldBoost,
|
||||
sender: eventItemProxy.sender,
|
||||
content: buildImageTimelineItemContent(imageMessageContent),
|
||||
replyDetails: buildReplyToDetailsFromDetailsIfAvailable(details: messageContent.inReplyTo),
|
||||
@@ -245,6 +247,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
isEditable: eventItemProxy.isEditable,
|
||||
canBeRepliedTo: eventItemProxy.canBeRepliedTo,
|
||||
isThreaded: messageContent.threadRoot != nil,
|
||||
shouldBoost: eventItemProxy.shouldBoost,
|
||||
sender: eventItemProxy.sender,
|
||||
content: buildVideoTimelineItemContent(videoMessageContent),
|
||||
replyDetails: buildReplyToDetailsFromDetailsIfAvailable(details: messageContent.inReplyTo),
|
||||
@@ -265,6 +268,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
isEditable: eventItemProxy.isEditable,
|
||||
canBeRepliedTo: eventItemProxy.canBeRepliedTo,
|
||||
isThreaded: messageContent.threadRoot != nil,
|
||||
shouldBoost: eventItemProxy.shouldBoost,
|
||||
sender: eventItemProxy.sender,
|
||||
content: buildAudioTimelineItemContent(audioMessageContent),
|
||||
replyDetails: buildReplyToDetailsFromDetailsIfAvailable(details: messageContent.inReplyTo),
|
||||
@@ -305,6 +309,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
isEditable: eventItemProxy.isEditable,
|
||||
canBeRepliedTo: eventItemProxy.canBeRepliedTo,
|
||||
isThreaded: messageContent.threadRoot != nil,
|
||||
shouldBoost: eventItemProxy.shouldBoost,
|
||||
sender: eventItemProxy.sender,
|
||||
content: buildFileTimelineItemContent(fileMessageContent),
|
||||
replyDetails: buildReplyToDetailsFromDetailsIfAvailable(details: messageContent.inReplyTo),
|
||||
|
||||
@@ -142,7 +142,7 @@ final class TimelineProxy: TimelineProxyProtocol {
|
||||
do {
|
||||
let timelineEndReached = switch direction {
|
||||
case .backwards: try await timeline.paginateBackwards(numEvents: requestSize)
|
||||
case .forwards: try await timeline.focusedPaginateForwards(numEvents: requestSize)
|
||||
case .forwards: try await timeline.paginateForwards(numEvents: requestSize)
|
||||
}
|
||||
MXLog.info("Finished paginating \(direction.rawValue)")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user