Update SDK to 1.0.102-alpha (#1408)

* Update SDK to 1.0.102-alpha

* Log error

* Notification Improvements API part 1 (#1410)

* changes

* WIP

* progress

* updated test

* removed unused

* code improvement

* Process diffs as batches provided by the SDK.

---------

Co-authored-by: Mauro <34335419+Velin92@users.noreply.github.com>
Co-authored-by: Doug <douglase@element.io>
This commit is contained in:
Alfonso Grillo
2023-07-27 11:48:56 +02:00
committed by GitHub
parent 188d41e59d
commit 1529b5b8ca
12 changed files with 117 additions and 160 deletions
@@ -1,59 +0,0 @@
//
// Copyright 2023 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
import MatrixRustSDK
protocol TimelineEventProxyProtocol {
var type: TimelineEventType? { get }
var eventID: String { get }
var senderID: String { get }
var timestamp: Date { get }
}
final class TimelineEventProxy: TimelineEventProxyProtocol {
private let timelineEvent: TimelineEvent
init(timelineEvent: TimelineEvent) {
self.timelineEvent = timelineEvent
}
var eventID: String {
timelineEvent.eventId()
}
var senderID: String {
timelineEvent.senderId()
}
var type: TimelineEventType? {
try? timelineEvent.eventType()
}
var timestamp: Date {
Date(timeIntervalSince1970: TimeInterval(timelineEvent.timestamp() / 1000))
}
}
struct MockTimelineEventProxy: TimelineEventProxyProtocol {
let eventID: String
let senderID = ""
let type: TimelineEventType? = nil
let timestamp = Date()
}
@@ -90,6 +90,8 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
avatarURLString: avatarUrl,
previousAvatarURLString: prevAvatarUrl,
isOutgoing: isOutgoing)
case .poll, .pollEnd:
return nil
}
}
@@ -498,7 +500,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
return .notLoaded(eventID: details.eventId)
case .pending:
return .loading(eventID: details.eventId)
case let .ready(message, senderID, senderProfile):
case let .ready(timelineItem, senderID, senderProfile):
let sender: TimelineItemSender
switch senderProfile {
case let .ready(displayName, _, avatarUrl):
@@ -512,7 +514,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
}
let replyContent: EventBasedMessageTimelineItemContentType
switch message.msgtype() {
switch timelineItem.asMessage()?.msgtype() {
case .audio(let content):
replyContent = .audio(buildAudioTimelineItemContent(content))
case .emote(let content):