mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Bump SDK + Mention Badge fix (#2367)
This commit is contained in:
@@ -510,21 +510,24 @@ class ClientProxy: ClientProxyProtocol {
|
||||
name: "AllRooms",
|
||||
shouldUpdateVisibleRange: true,
|
||||
notificationSettings: notificationSettings,
|
||||
backgroundTaskService: backgroundTaskService)
|
||||
backgroundTaskService: backgroundTaskService,
|
||||
appSettings: appSettings)
|
||||
try await roomSummaryProvider?.setRoomList(roomListService.allRooms())
|
||||
|
||||
messageForwardingRoomSummaryProvider = RoomSummaryProvider(roomListService: roomListService,
|
||||
eventStringBuilder: eventStringBuilder,
|
||||
name: "MessageForwarding",
|
||||
notificationSettings: notificationSettings,
|
||||
backgroundTaskService: backgroundTaskService)
|
||||
backgroundTaskService: backgroundTaskService,
|
||||
appSettings: appSettings)
|
||||
try await messageForwardingRoomSummaryProvider?.setRoomList(roomListService.allRooms())
|
||||
|
||||
inviteSummaryProvider = RoomSummaryProvider(roomListService: roomListService,
|
||||
eventStringBuilder: eventStringBuilder,
|
||||
name: "Invites",
|
||||
notificationSettings: notificationSettings,
|
||||
backgroundTaskService: backgroundTaskService)
|
||||
backgroundTaskService: backgroundTaskService,
|
||||
appSettings: appSettings)
|
||||
try await inviteSummaryProvider?.setRoomList(roomListService.invites())
|
||||
|
||||
self.syncService = syncService
|
||||
|
||||
@@ -328,9 +328,9 @@ class RoomProxy: RoomProxyProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func canUserRedact(userID: String) async -> Result<Bool, RoomProxyError> {
|
||||
func canUserRedactOther(userID: String) async -> Result<Bool, RoomProxyError> {
|
||||
do {
|
||||
return try await .success(room.canUserRedact(userId: userID))
|
||||
return try await .success(room.canUserRedactOther(userId: userID))
|
||||
} catch {
|
||||
MXLog.error("Failed checking if the user can redact with error: \(error)")
|
||||
return .failure(.failedCheckingPermission)
|
||||
|
||||
@@ -97,7 +97,7 @@ protocol RoomProxyProtocol {
|
||||
|
||||
func uploadAvatar(media: MediaInfo) async -> Result<Void, RoomProxyError>
|
||||
|
||||
func canUserRedact(userID: String) async -> Result<Bool, RoomProxyError>
|
||||
func canUserRedactOther(userID: String) async -> Result<Bool, RoomProxyError>
|
||||
|
||||
func canUserTriggerRoomNotification(userID: String) async -> Result<Bool, RoomProxyError>
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ extension Array where Element == RoomSummary {
|
||||
avatarURL: nil,
|
||||
lastMessage: AttributedString("I do not wish to take the trouble to understand mysticism"),
|
||||
lastMessageFormattedTimestamp: "14:56",
|
||||
unreadMessagesCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
notificationMode: .allMessages,
|
||||
canonicalAlias: nil,
|
||||
@@ -95,7 +95,7 @@ extension Array where Element == RoomSummary {
|
||||
avatarURL: URL.picturesDirectory,
|
||||
lastMessage: AttributedString("How do you see the Emperor then? You think he keeps office hours?"),
|
||||
lastMessageFormattedTimestamp: "2:56 PM",
|
||||
unreadMessagesCount: 2,
|
||||
unreadNotificationsCount: 2,
|
||||
unreadMentionsCount: 0,
|
||||
notificationMode: .mute,
|
||||
canonicalAlias: nil,
|
||||
@@ -107,7 +107,7 @@ extension Array where Element == RoomSummary {
|
||||
avatarURL: nil,
|
||||
lastMessage: try? AttributedString(markdown: "He certainly seemed no *mental genius* to me"),
|
||||
lastMessageFormattedTimestamp: "Some time ago",
|
||||
unreadMessagesCount: 3,
|
||||
unreadNotificationsCount: 3,
|
||||
unreadMentionsCount: 0,
|
||||
notificationMode: .mentionsAndKeywordsOnly,
|
||||
canonicalAlias: nil,
|
||||
@@ -119,7 +119,7 @@ extension Array where Element == RoomSummary {
|
||||
avatarURL: nil,
|
||||
lastMessage: AttributedString("There's an archaic measure of time that's called the month"),
|
||||
lastMessageFormattedTimestamp: "Just now",
|
||||
unreadMessagesCount: 2,
|
||||
unreadNotificationsCount: 2,
|
||||
unreadMentionsCount: 2,
|
||||
notificationMode: .allMessages,
|
||||
canonicalAlias: nil,
|
||||
@@ -131,7 +131,7 @@ extension Array where Element == RoomSummary {
|
||||
avatarURL: nil,
|
||||
lastMessage: AttributedString("Clearly, if Earth is powerful enough to do that, it might also be capable of adjusting minds in order to force belief in its radioactivity"),
|
||||
lastMessageFormattedTimestamp: "1986",
|
||||
unreadMessagesCount: 1,
|
||||
unreadNotificationsCount: 1,
|
||||
unreadMentionsCount: 1,
|
||||
notificationMode: .allMessages,
|
||||
canonicalAlias: nil,
|
||||
@@ -143,7 +143,7 @@ extension Array where Element == RoomSummary {
|
||||
avatarURL: nil,
|
||||
lastMessage: AttributedString("Are you groping for the word 'paranoia'?"),
|
||||
lastMessageFormattedTimestamp: "きょうはじゅういちがつじゅういちにちです",
|
||||
unreadMessagesCount: 6,
|
||||
unreadNotificationsCount: 6,
|
||||
unreadMentionsCount: 0,
|
||||
notificationMode: .mute,
|
||||
canonicalAlias: nil,
|
||||
@@ -155,7 +155,7 @@ extension Array where Element == RoomSummary {
|
||||
avatarURL: nil,
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: nil,
|
||||
@@ -167,51 +167,51 @@ extension Array where Element == RoomSummary {
|
||||
static let mockRoomsWithNotificationsState: [Element] = [
|
||||
.filled(details: RoomSummaryDetails(id: "1",
|
||||
settingsMode: .allMessages,
|
||||
hasUnreadMessages: false,
|
||||
hasUnreadNotifications: false,
|
||||
hasUnreadMentions: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "2",
|
||||
settingsMode: .allMessages,
|
||||
hasUnreadMessages: true,
|
||||
hasUnreadNotifications: true,
|
||||
hasUnreadMentions: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "3",
|
||||
settingsMode: .allMessages,
|
||||
hasUnreadMessages: true,
|
||||
hasUnreadNotifications: true,
|
||||
hasUnreadMentions: true)),
|
||||
.filled(details: RoomSummaryDetails(id: "4",
|
||||
settingsMode: .allMessages,
|
||||
hasUnreadMessages: false,
|
||||
hasUnreadNotifications: false,
|
||||
hasUnreadMentions: true)),
|
||||
.filled(details: RoomSummaryDetails(id: "5",
|
||||
settingsMode: .mentionsAndKeywordsOnly,
|
||||
hasUnreadMessages: false,
|
||||
hasUnreadNotifications: false,
|
||||
hasUnreadMentions: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "6",
|
||||
settingsMode: .mentionsAndKeywordsOnly,
|
||||
hasUnreadMessages: true,
|
||||
hasUnreadNotifications: true,
|
||||
hasUnreadMentions: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "7",
|
||||
settingsMode: .mentionsAndKeywordsOnly,
|
||||
hasUnreadMessages: true,
|
||||
hasUnreadNotifications: true,
|
||||
hasUnreadMentions: true)),
|
||||
.filled(details: RoomSummaryDetails(id: "8",
|
||||
settingsMode: .mentionsAndKeywordsOnly,
|
||||
hasUnreadMessages: false,
|
||||
hasUnreadNotifications: false,
|
||||
hasUnreadMentions: true)),
|
||||
.filled(details: RoomSummaryDetails(id: "9",
|
||||
settingsMode: .mute,
|
||||
hasUnreadMessages: false,
|
||||
hasUnreadNotifications: false,
|
||||
hasUnreadMentions: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "10",
|
||||
settingsMode: .mute,
|
||||
hasUnreadMessages: true,
|
||||
hasUnreadNotifications: true,
|
||||
hasUnreadMentions: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "11",
|
||||
settingsMode: .mute,
|
||||
hasUnreadMessages: true,
|
||||
hasUnreadNotifications: true,
|
||||
hasUnreadMentions: true)),
|
||||
.filled(details: RoomSummaryDetails(id: "12",
|
||||
settingsMode: .mute,
|
||||
hasUnreadMessages: false,
|
||||
hasUnreadNotifications: false,
|
||||
hasUnreadMentions: true))
|
||||
]
|
||||
|
||||
@@ -221,7 +221,7 @@ extension Array where Element == RoomSummary {
|
||||
avatarURL: URL.picturesDirectory,
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: "#footest:somewhere.org",
|
||||
@@ -233,7 +233,7 @@ extension Array where Element == RoomSummary {
|
||||
avatarURL: nil,
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: nil,
|
||||
|
||||
@@ -24,7 +24,7 @@ struct RoomSummaryDetails {
|
||||
let avatarURL: URL?
|
||||
let lastMessage: AttributedString?
|
||||
let lastMessageFormattedTimestamp: String?
|
||||
let unreadMessagesCount: UInt
|
||||
let unreadNotificationsCount: UInt
|
||||
let unreadMentionsCount: UInt
|
||||
let notificationMode: RoomNotificationModeProxy?
|
||||
let canonicalAlias: String?
|
||||
@@ -34,20 +34,20 @@ struct RoomSummaryDetails {
|
||||
|
||||
extension RoomSummaryDetails: CustomStringConvertible {
|
||||
var description: String {
|
||||
"RoomSummaryDetails: - id: \(id) - isDirect: \(isDirect) - unreadMessagesCount: \(unreadMessagesCount) - unreadMentionsCount: \(unreadMentionsCount) - notificationMode: \(notificationMode?.rawValue ?? "nil")"
|
||||
"RoomSummaryDetails: - id: \(id) - isDirect: \(isDirect) - unreadNotificationsCount: \(unreadNotificationsCount) - unreadMentionsCount: \(unreadMentionsCount) - notificationMode: \(notificationMode?.rawValue ?? "nil")"
|
||||
}
|
||||
}
|
||||
|
||||
extension RoomSummaryDetails {
|
||||
init(id: String, settingsMode: RoomNotificationModeProxy, hasUnreadMessages: Bool, hasUnreadMentions: Bool) {
|
||||
init(id: String, settingsMode: RoomNotificationModeProxy, hasUnreadNotifications: Bool, hasUnreadMentions: Bool) {
|
||||
self.id = id
|
||||
let string = "\(settingsMode) - hasUnreadMessages: \(hasUnreadMessages) - hasUnreadMentions: \(hasUnreadMentions)"
|
||||
let string = "\(settingsMode) - hasUnreadNotifications: \(hasUnreadNotifications) - hasUnreadMentions: \(hasUnreadMentions)"
|
||||
name = string
|
||||
isDirect = true
|
||||
avatarURL = nil
|
||||
lastMessage = AttributedString(string)
|
||||
lastMessageFormattedTimestamp = "Now"
|
||||
unreadMessagesCount = hasUnreadMessages ? 1 : 0
|
||||
unreadNotificationsCount = hasUnreadNotifications ? 1 : 0
|
||||
unreadMentionsCount = hasUnreadMentions ? 1 : 0
|
||||
notificationMode = settingsMode
|
||||
canonicalAlias = nil
|
||||
|
||||
@@ -25,6 +25,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
private let shouldUpdateVisibleRange: Bool
|
||||
private let notificationSettings: NotificationSettingsProxyProtocol
|
||||
private let backgroundTaskService: BackgroundTaskServiceProtocol
|
||||
private let appSettings: AppSettings
|
||||
|
||||
private let roomListPageSize = 200
|
||||
|
||||
@@ -67,7 +68,8 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
name: String,
|
||||
shouldUpdateVisibleRange: Bool = false,
|
||||
notificationSettings: NotificationSettingsProxyProtocol,
|
||||
backgroundTaskService: BackgroundTaskServiceProtocol) {
|
||||
backgroundTaskService: BackgroundTaskServiceProtocol,
|
||||
appSettings: AppSettings) {
|
||||
self.roomListService = roomListService
|
||||
serialDispatchQueue = DispatchQueue(label: "io.element.elementx.roomsummaryprovider", qos: .default)
|
||||
self.eventStringBuilder = eventStringBuilder
|
||||
@@ -75,6 +77,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
self.shouldUpdateVisibleRange = shouldUpdateVisibleRange
|
||||
self.notificationSettings = notificationSettings
|
||||
self.backgroundTaskService = backgroundTaskService
|
||||
self.appSettings = appSettings
|
||||
|
||||
diffsPublisher
|
||||
.receive(on: serialDispatchQueue)
|
||||
@@ -245,7 +248,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
avatarURL: roomInfo.avatarUrl.flatMap(URL.init(string:)),
|
||||
lastMessage: attributedLastMessage,
|
||||
lastMessageFormattedTimestamp: lastMessageFormattedTimestamp,
|
||||
unreadMessagesCount: UInt(roomInfo.notificationCount),
|
||||
unreadNotificationsCount: appSettings.mentionsBadgeEnabled ? UInt(roomInfo.numUnreadNotifications) : UInt(roomInfo.notificationCount),
|
||||
unreadMentionsCount: UInt(roomInfo.numUnreadMentions),
|
||||
notificationMode: notificationMode,
|
||||
canonicalAlias: roomInfo.canonicalAlias,
|
||||
|
||||
Reference in New Issue
Block a user