Various tweaks (#381)

* Add the message delivery status to the plain timeline styler and display it outside of the main content

* Fix glitchy timeline scroll to bottom button

* Fixed bubbled reactions padding

* Simplified the emoji picker, double tapping a timeline item directly opens it now and added a context menu option. Linked it to rust side reaction sending

* Fix the sliding sync cold cache: treat invalidated rooms as filled

* Make splash screen view full screen

* Fix the offline indicator popping up when first setting up the network monitor

* Expose presentationDetents on the NavigationStackCoordinator and start using them for the EmojiPicker

* Fix link tint color

* Linked TimelineReactionsView reaction sending

* Remove now unused/unnecessary classes

* Add changelog

* Fix formatting issue
This commit is contained in:
Stefan Ceriu
2022-12-21 11:18:45 +02:00
committed by GitHub
parent 5b9d45e461
commit 71f1f044c7
33 changed files with 170 additions and 534 deletions
+19 -12
View File
@@ -27,7 +27,7 @@ class RoomProxy: RoomProxyProtocol {
private let serialDispatchQueue = DispatchQueue(label: "io.element.elementx.roomproxy.serial")
private var sendMessageBgTask: BackgroundTaskProtocol?
private var sendMessageBackgroundTask: BackgroundTaskProtocol?
private var memberAvatars = [String: String]()
private var memberDisplayNames = [String: String]()
@@ -151,10 +151,7 @@ class RoomProxy: RoomProxyProtocol {
do {
let outcome: PaginationOutcome = try await Task.dispatch(on: .global()) {
Benchmark.startTrackingForIdentifier("BackPagination \(id)", message: "Backpaginating \(count) message(s) in room \(id)")
let outcome = try self.room.paginateBackwards(limit: UInt16(count))
Benchmark.endTrackingForIdentifier("BackPagination \(id)", message: "Finished backpaginating \(count) message(s) in room \(id)")
return outcome
try self.room.paginateBackwards(limit: UInt16(count))
}
update(backPaginationOutcome: outcome)
return .success(())
@@ -164,9 +161,9 @@ class RoomProxy: RoomProxyProtocol {
}
func sendMessage(_ message: String, inReplyToEventId: String? = nil) async -> Result<Void, RoomProxyError> {
sendMessageBgTask = backgroundTaskService.startBackgroundTask(withName: "SendMessage", isReusable: true)
sendMessageBackgroundTask = backgroundTaskService.startBackgroundTask(withName: "SendMessage", isReusable: true)
defer {
sendMessageBgTask?.stop()
sendMessageBackgroundTask?.stop()
}
let transactionId = genTransactionId()
@@ -187,15 +184,25 @@ class RoomProxy: RoomProxyProtocol {
}
func sendReaction(_ reaction: String, for eventId: String) async -> Result<Void, RoomProxyError> {
await Task.dispatch(on: .global()) {
.success(())
sendMessageBackgroundTask = backgroundTaskService.startBackgroundTask(withName: "SendMessage", isReusable: true)
defer {
sendMessageBackgroundTask?.stop()
}
return await Task.dispatch(on: .global()) {
do {
try self.room.sendReaction(eventId: eventId, key: reaction)
return .success(())
} catch {
return .failure(.failedSendingReaction)
}
}
}
func editMessage(_ newMessage: String, originalEventId: String) async -> Result<Void, RoomProxyError> {
sendMessageBgTask = backgroundTaskService.startBackgroundTask(withName: "SendMessage", isReusable: true)
sendMessageBackgroundTask = backgroundTaskService.startBackgroundTask(withName: "SendMessage", isReusable: true)
defer {
sendMessageBgTask?.stop()
sendMessageBackgroundTask?.stop()
}
let transactionId = genTransactionId()
@@ -205,7 +212,7 @@ class RoomProxy: RoomProxyProtocol {
try self.room.edit(newMsg: newMessage, originalEventId: originalEventId, txnId: transactionId)
return .success(())
} catch {
return .failure(.failedSendingMessage)
return .failure(.failedEditingMessage)
}
}
}
@@ -23,6 +23,8 @@ enum RoomProxyError: Error {
case failedRetrievingMemberAvatarURL
case failedRetrievingMemberDisplayName
case failedSendingMessage
case failedSendingReaction
case failedEditingMessage
case failedRedactingEvent
case failedAddingTimelineListener
case failedRetrievingMembers
@@ -161,8 +161,8 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
return buildEmptyRoomSummary()
case .filled(let roomId):
return buildRoomSummaryForIdentifier(roomId)
case .invalidated:
return buildEmptyRoomSummary()
case .invalidated(let roomId):
return buildRoomSummaryForIdentifier(roomId)
}
}