mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
MentionBadge FF (#2281)
This commit is contained in:
parent
a96057009e
commit
f844cd1a2f
@ -6650,7 +6650,7 @@
|
||||
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
|
||||
requirement = {
|
||||
kind = exactVersion;
|
||||
version = "0.0.1-december23";
|
||||
version = 1.1.31;
|
||||
};
|
||||
};
|
||||
821C67C9A7F8CC3FD41B28B4 /* XCRemoteSwiftPackageReference "emojibase-bindings" */ = {
|
||||
|
@ -130,8 +130,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
|
||||
"state" : {
|
||||
"revision" : "c0027815b6ac690837e4f437ae874e7a4b5bc2a7",
|
||||
"version" : "0.0.1-december23"
|
||||
"revision" : "c9c6725af2c9fa93c19f710e307b0b25e0f1fa26",
|
||||
"version" : "1.1.31"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -45,6 +45,7 @@ final class AppSettings {
|
||||
case shouldCollapseRoomStateEvents
|
||||
case userSuggestionsEnabled
|
||||
case swiftUITimelineEnabled
|
||||
case mentionsBadgeEnabled
|
||||
}
|
||||
|
||||
private static var suiteName: String = InfoPlistReader.main.appGroupIdentifier
|
||||
@ -266,6 +267,9 @@ final class AppSettings {
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.swiftUITimelineEnabled, defaultValue: false, storageType: .volatile)
|
||||
var swiftUITimelineEnabled
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.mentionsBadgeEnabled, defaultValue: false, storageType: .userDefaults(store))
|
||||
var mentionsBadgeEnabled
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -147,6 +147,8 @@ struct HomeScreenRoom: Identifiable, Equatable {
|
||||
|
||||
var hasUnreads = false
|
||||
|
||||
var hasMentions = false
|
||||
|
||||
var hasOngoingCall = false
|
||||
|
||||
var timestamp: String?
|
||||
@ -164,6 +166,7 @@ struct HomeScreenRoom: Identifiable, Equatable {
|
||||
roomId: nil,
|
||||
name: "Placeholder room name",
|
||||
hasUnreads: false,
|
||||
hasMentions: false,
|
||||
timestamp: "Now",
|
||||
lastMessage: placeholderLastMessage,
|
||||
isPlaceholder: true)
|
||||
|
@ -287,18 +287,18 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
|
||||
private func buildRoom(with details: RoomSummaryDetails, invalidated: Bool) -> HomeScreenRoom {
|
||||
let identifier = invalidated ? "invalidated-" + details.id : details.id
|
||||
|
||||
let notificationMode = details.notificationMode == .allMessages ? nil : details.notificationMode
|
||||
let hasMentions = appSettings.mentionsBadgeEnabled ? details.unreadMentionsCount > 0 : false
|
||||
|
||||
return HomeScreenRoom(id: identifier,
|
||||
roomId: details.id,
|
||||
name: details.name,
|
||||
hasUnreads: details.unreadNotificationCount > 0,
|
||||
hasUnreads: details.unreadMessagesCount > 0,
|
||||
hasMentions: hasMentions,
|
||||
hasOngoingCall: details.hasOngoingCall,
|
||||
timestamp: details.lastMessageFormattedTimestamp,
|
||||
lastMessage: details.lastMessage,
|
||||
avatarURL: details.avatarURL,
|
||||
notificationMode: notificationMode)
|
||||
notificationMode: details.notificationMode)
|
||||
}
|
||||
|
||||
private func updateVisibleRange(_ range: Range<Int>) {
|
||||
|
@ -95,8 +95,8 @@ struct HomeScreenRoomCell: View {
|
||||
|
||||
if let timestamp = room.timestamp {
|
||||
Text(timestamp)
|
||||
.font(room.hasUnreads ? .compound.bodySMSemibold : .compound.bodySM)
|
||||
.foregroundColor(room.hasUnreads ? .compound.textActionAccent : .compound.textSecondary)
|
||||
.font(isHighlighted ? .compound.bodySMSemibold : .compound.bodySM)
|
||||
.foregroundColor(isHighlighted ? .compound.textActionAccent : .compound.textSecondary)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -119,33 +119,48 @@ struct HomeScreenRoomCell: View {
|
||||
HStack(spacing: 8) {
|
||||
if room.hasOngoingCall {
|
||||
CompoundIcon(\.videoCallSolid, size: .xSmall, relativeTo: .compound.bodySM)
|
||||
.foregroundColor(room.hasUnreads ? .compound.iconAccentTertiary : .compound.iconQuaternary)
|
||||
.foregroundColor(isHighlighted ? .compound.iconAccentTertiary : .compound.iconQuaternary)
|
||||
}
|
||||
|
||||
if room.notificationMode == .mute {
|
||||
CompoundIcon(\.notificationsSolidOff, size: .custom(15), relativeTo: .compound.bodyMD)
|
||||
.accessibilityLabel(L10n.a11yNotificationsMuted)
|
||||
.foregroundColor(.compound.iconQuaternary)
|
||||
}
|
||||
|
||||
notificationModeIcon
|
||||
.foregroundColor(room.hasUnreads ? .compound.iconAccentTertiary : .compound.iconQuaternary)
|
||||
if room.hasMentions, room.notificationMode != .mute {
|
||||
mentionIcon
|
||||
.foregroundColor(.compound.iconAccentTertiary)
|
||||
}
|
||||
|
||||
if room.hasUnreads {
|
||||
if hasNewContent {
|
||||
Circle()
|
||||
.frame(width: 12, height: 12)
|
||||
.foregroundColor(.compound.iconAccentTertiary)
|
||||
.foregroundColor(isHighlighted ? .compound.iconAccentTertiary : .compound.iconQuaternary)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var notificationModeIcon: some View {
|
||||
switch room.notificationMode {
|
||||
case .none, .allMessages:
|
||||
EmptyView()
|
||||
case .mentionsAndKeywordsOnly:
|
||||
CompoundIcon(\.mention, size: .custom(15), relativeTo: .compound.bodyMD)
|
||||
.accessibilityLabel(L10n.a11yNotificationsMentionsOnly)
|
||||
case .mute:
|
||||
CompoundIcon(\.notificationsSolidOff, size: .custom(15), relativeTo: .compound.bodyMD)
|
||||
.accessibilityLabel(L10n.a11yNotificationsMuted)
|
||||
private var hasNewContent: Bool {
|
||||
room.hasUnreads || room.hasMentions
|
||||
}
|
||||
|
||||
private var isHighlighted: Bool {
|
||||
guard !room.isPlaceholder else {
|
||||
return false
|
||||
}
|
||||
return (isNotificationModeUnrestricted && hasNewContent) ||
|
||||
(room.notificationMode == .mentionsAndKeywordsOnly && room.hasMentions)
|
||||
}
|
||||
|
||||
private var isNotificationModeUnrestricted: Bool {
|
||||
room.notificationMode == nil || room.notificationMode == .allMessages
|
||||
}
|
||||
|
||||
private var mentionIcon: some View {
|
||||
CompoundIcon(\.mention, size: .custom(15), relativeTo: .compound.bodyMD)
|
||||
.accessibilityLabel(L10n.a11yNotificationsMentionsOnly)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
@ -178,41 +193,67 @@ private extension View {
|
||||
}
|
||||
|
||||
struct HomeScreenRoomCell_Previews: PreviewProvider, TestablePreview {
|
||||
static var previews: some View {
|
||||
let summaryProvider = MockRoomSummaryProvider(state: .loaded(.mockRooms))
|
||||
|
||||
let userSession = MockUserSession(clientProxy: MockClientProxy(userID: "John Doe", roomSummaryProvider: summaryProvider),
|
||||
static let summaryProviderGeneric = MockRoomSummaryProvider(state: .loaded(.mockRooms))
|
||||
static let viewModelGeneric = {
|
||||
let userSession = MockUserSession(clientProxy: MockClientProxy(userID: "John Doe", roomSummaryProvider: summaryProviderGeneric),
|
||||
mediaProvider: MockMediaProvider(),
|
||||
voiceMessageMediaManager: VoiceMessageMediaManagerMock())
|
||||
|
||||
let viewModel = HomeScreenViewModel(userSession: userSession,
|
||||
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController)
|
||||
|
||||
let rooms: [HomeScreenRoom] = summaryProvider.roomListPublisher.value.compactMap { summary -> HomeScreenRoom? in
|
||||
switch summary {
|
||||
case .empty:
|
||||
return nil
|
||||
case .invalidated(let details), .filled(let details):
|
||||
return HomeScreenRoom(id: UUID().uuidString,
|
||||
roomId: details.id,
|
||||
name: details.name,
|
||||
hasUnreads: details.unreadNotificationCount > 0,
|
||||
hasOngoingCall: details.hasOngoingCall,
|
||||
timestamp: Date(timeIntervalSinceReferenceDate: 0).formattedMinimal(),
|
||||
lastMessage: details.lastMessage,
|
||||
notificationMode: details.notificationMode)
|
||||
}
|
||||
}
|
||||
return HomeScreenViewModel(userSession: userSession,
|
||||
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController)
|
||||
}()
|
||||
|
||||
static let summaryProviderForNotificationsState = MockRoomSummaryProvider(state: .loaded(.mockRoomsWithNotificationsState))
|
||||
static let viewModelForNotificationsState = {
|
||||
let userSession = MockUserSession(clientProxy: MockClientProxy(userID: "John Doe", roomSummaryProvider: summaryProviderForNotificationsState),
|
||||
mediaProvider: MockMediaProvider(),
|
||||
voiceMessageMediaManager: VoiceMessageMediaManagerMock())
|
||||
|
||||
return VStack(spacing: 0) {
|
||||
ForEach(rooms) { room in
|
||||
HomeScreenRoomCell(room: room, context: viewModel.context, isSelected: false)
|
||||
}
|
||||
|
||||
HomeScreenRoomCell(room: .placeholder(), context: viewModel.context, isSelected: false)
|
||||
.redacted(reason: .placeholder)
|
||||
return HomeScreenViewModel(userSession: userSession,
|
||||
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController)
|
||||
}()
|
||||
|
||||
static func mockRoom(summary: RoomSummary) -> HomeScreenRoom? {
|
||||
switch summary {
|
||||
case .empty:
|
||||
return nil
|
||||
case .invalidated(let details), .filled(let details):
|
||||
return HomeScreenRoom(id: UUID().uuidString,
|
||||
roomId: details.id,
|
||||
name: details.name,
|
||||
hasUnreads: details.unreadMessagesCount > 0, hasMentions: details.unreadMentionsCount > 0,
|
||||
hasOngoingCall: details.hasOngoingCall,
|
||||
timestamp: Date(timeIntervalSinceReferenceDate: 0).formattedMinimal(),
|
||||
lastMessage: details.lastMessage,
|
||||
notificationMode: details.notificationMode)
|
||||
}
|
||||
}
|
||||
|
||||
static var previews: some View {
|
||||
let genericRooms: [HomeScreenRoom] = summaryProviderGeneric.roomListPublisher.value.compactMap(mockRoom)
|
||||
|
||||
let notificationsStateRooms: [HomeScreenRoom] = summaryProviderForNotificationsState.roomListPublisher.value.compactMap(mockRoom)
|
||||
|
||||
VStack(spacing: 0) {
|
||||
ForEach(genericRooms) { room in
|
||||
HomeScreenRoomCell(room: room, context: viewModelGeneric.context, isSelected: false)
|
||||
}
|
||||
|
||||
HomeScreenRoomCell(room: .placeholder(), context: viewModelGeneric.context, isSelected: false)
|
||||
.redacted(reason: .placeholder)
|
||||
}
|
||||
.previewDisplayName("Generic")
|
||||
|
||||
VStack(spacing: 0) {
|
||||
ForEach(notificationsStateRooms) { room in
|
||||
HomeScreenRoomCell(room: room, context: viewModelForNotificationsState.context, isSelected: false)
|
||||
}
|
||||
}
|
||||
.previewLayout(.sizeThatFits)
|
||||
.previewDisplayName("Notifications State")
|
||||
}
|
||||
}
|
||||
|
@ -186,7 +186,8 @@ private extension InvitesScreenRoomDetails {
|
||||
avatarURL: nil,
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadNotificationCount: 0,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: "#footest:somewhere.org",
|
||||
inviter: inviter,
|
||||
@ -206,7 +207,8 @@ private extension InvitesScreenRoomDetails {
|
||||
avatarURL: avatarURL,
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadNotificationCount: 0,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: alias,
|
||||
inviter: inviter,
|
||||
|
@ -49,6 +49,7 @@ protocol DeveloperOptionsProtocol: AnyObject {
|
||||
var shouldCollapseRoomStateEvents: Bool { get set }
|
||||
var userSuggestionsEnabled: Bool { get set }
|
||||
var swiftUITimelineEnabled: Bool { get set }
|
||||
var mentionsBadgeEnabled: Bool { get set }
|
||||
|
||||
var elementCallBaseURL: URL { get set }
|
||||
var elementCallUseEncryption: Bool { get set }
|
||||
|
@ -49,6 +49,13 @@ struct DeveloperOptionsScreen: View {
|
||||
}
|
||||
}
|
||||
|
||||
Section("Mentions") {
|
||||
Toggle(isOn: $context.mentionsBadgeEnabled) {
|
||||
Text("Mentions badge")
|
||||
Text("Requires app reboot")
|
||||
}
|
||||
}
|
||||
|
||||
Section("Element Call") {
|
||||
TextField(context.elementCallBaseURL.absoluteString, text: $elementCallBaseURLString)
|
||||
.submitLabel(.done)
|
||||
|
@ -17,7 +17,7 @@
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
|
||||
enum RoomNotificationModeProxy {
|
||||
enum RoomNotificationModeProxy: String {
|
||||
case allMessages
|
||||
case mentionsAndKeywordsOnly
|
||||
case mute
|
||||
|
@ -83,7 +83,8 @@ extension Array where Element == RoomSummary {
|
||||
avatarURL: nil,
|
||||
lastMessage: AttributedString("I do not wish to take the trouble to understand mysticism"),
|
||||
lastMessageFormattedTimestamp: "14:56",
|
||||
unreadNotificationCount: 0,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
notificationMode: .allMessages,
|
||||
canonicalAlias: nil,
|
||||
inviter: nil,
|
||||
@ -94,7 +95,8 @@ 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",
|
||||
unreadNotificationCount: 2,
|
||||
unreadMessagesCount: 2,
|
||||
unreadMentionsCount: 0,
|
||||
notificationMode: .mute,
|
||||
canonicalAlias: nil,
|
||||
inviter: nil,
|
||||
@ -105,7 +107,8 @@ extension Array where Element == RoomSummary {
|
||||
avatarURL: nil,
|
||||
lastMessage: try? AttributedString(markdown: "He certainly seemed no *mental genius* to me"),
|
||||
lastMessageFormattedTimestamp: "Some time ago",
|
||||
unreadNotificationCount: 3,
|
||||
unreadMessagesCount: 3,
|
||||
unreadMentionsCount: 0,
|
||||
notificationMode: .mentionsAndKeywordsOnly,
|
||||
canonicalAlias: nil,
|
||||
inviter: nil,
|
||||
@ -116,7 +119,8 @@ extension Array where Element == RoomSummary {
|
||||
avatarURL: nil,
|
||||
lastMessage: AttributedString("There's an archaic measure of time that's called the month"),
|
||||
lastMessageFormattedTimestamp: "Just now",
|
||||
unreadNotificationCount: 4,
|
||||
unreadMessagesCount: 2,
|
||||
unreadMentionsCount: 2,
|
||||
notificationMode: .allMessages,
|
||||
canonicalAlias: nil,
|
||||
inviter: nil,
|
||||
@ -127,7 +131,8 @@ 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",
|
||||
unreadNotificationCount: 5,
|
||||
unreadMessagesCount: 1,
|
||||
unreadMentionsCount: 1,
|
||||
notificationMode: .allMessages,
|
||||
canonicalAlias: nil,
|
||||
inviter: nil,
|
||||
@ -138,7 +143,8 @@ extension Array where Element == RoomSummary {
|
||||
avatarURL: nil,
|
||||
lastMessage: AttributedString("Are you groping for the word 'paranoia'?"),
|
||||
lastMessageFormattedTimestamp: "きょうはじゅういちがつじゅういちにちです",
|
||||
unreadNotificationCount: 6,
|
||||
unreadMessagesCount: 6,
|
||||
unreadMentionsCount: 0,
|
||||
notificationMode: .mute,
|
||||
canonicalAlias: nil,
|
||||
inviter: nil,
|
||||
@ -149,7 +155,8 @@ extension Array where Element == RoomSummary {
|
||||
avatarURL: nil,
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadNotificationCount: 0,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: nil,
|
||||
inviter: nil,
|
||||
@ -157,13 +164,65 @@ extension Array where Element == RoomSummary {
|
||||
.empty
|
||||
]
|
||||
|
||||
static let mockRoomsWithNotificationsState: [Element] = [
|
||||
.filled(details: RoomSummaryDetails(id: "1",
|
||||
settingsMode: .allMessages,
|
||||
hasUnreadMessages: false,
|
||||
hasUnreadMentions: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "2",
|
||||
settingsMode: .allMessages,
|
||||
hasUnreadMessages: true,
|
||||
hasUnreadMentions: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "3",
|
||||
settingsMode: .allMessages,
|
||||
hasUnreadMessages: true,
|
||||
hasUnreadMentions: true)),
|
||||
.filled(details: RoomSummaryDetails(id: "4",
|
||||
settingsMode: .allMessages,
|
||||
hasUnreadMessages: false,
|
||||
hasUnreadMentions: true)),
|
||||
.filled(details: RoomSummaryDetails(id: "5",
|
||||
settingsMode: .mentionsAndKeywordsOnly,
|
||||
hasUnreadMessages: false,
|
||||
hasUnreadMentions: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "6",
|
||||
settingsMode: .mentionsAndKeywordsOnly,
|
||||
hasUnreadMessages: true,
|
||||
hasUnreadMentions: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "7",
|
||||
settingsMode: .mentionsAndKeywordsOnly,
|
||||
hasUnreadMessages: true,
|
||||
hasUnreadMentions: true)),
|
||||
.filled(details: RoomSummaryDetails(id: "8",
|
||||
settingsMode: .mentionsAndKeywordsOnly,
|
||||
hasUnreadMessages: false,
|
||||
hasUnreadMentions: true)),
|
||||
.filled(details: RoomSummaryDetails(id: "9",
|
||||
settingsMode: .mute,
|
||||
hasUnreadMessages: false,
|
||||
hasUnreadMentions: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "10",
|
||||
settingsMode: .mute,
|
||||
hasUnreadMessages: true,
|
||||
hasUnreadMentions: false)),
|
||||
.filled(details: RoomSummaryDetails(id: "11",
|
||||
settingsMode: .mute,
|
||||
hasUnreadMessages: true,
|
||||
hasUnreadMentions: true)),
|
||||
.filled(details: RoomSummaryDetails(id: "12",
|
||||
settingsMode: .mute,
|
||||
hasUnreadMessages: false,
|
||||
hasUnreadMentions: true))
|
||||
]
|
||||
|
||||
static let mockInvites: [Element] = [
|
||||
.filled(details: RoomSummaryDetails(id: "someAwesomeRoomId1", name: "First room",
|
||||
isDirect: false,
|
||||
avatarURL: URL.picturesDirectory,
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadNotificationCount: 0,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: "#footest:somewhere.org",
|
||||
inviter: RoomMemberProxyMock.mockCharlie,
|
||||
@ -174,7 +233,8 @@ extension Array where Element == RoomSummary {
|
||||
avatarURL: nil,
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadNotificationCount: 0,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: nil,
|
||||
inviter: RoomMemberProxyMock.mockCharlie,
|
||||
|
@ -24,7 +24,8 @@ struct RoomSummaryDetails {
|
||||
let avatarURL: URL?
|
||||
let lastMessage: AttributedString?
|
||||
let lastMessageFormattedTimestamp: String?
|
||||
let unreadNotificationCount: UInt
|
||||
let unreadMessagesCount: UInt
|
||||
let unreadMentionsCount: UInt
|
||||
let notificationMode: RoomNotificationModeProxy?
|
||||
let canonicalAlias: String?
|
||||
let inviter: RoomMemberProxyProtocol?
|
||||
@ -33,6 +34,24 @@ struct RoomSummaryDetails {
|
||||
|
||||
extension RoomSummaryDetails: CustomStringConvertible {
|
||||
var description: String {
|
||||
"id: \"\(id)\", isDirect: \"\(isDirect)\", unreadNotificationCount: \"\(unreadNotificationCount)\""
|
||||
"RoomSummaryDetails: - id: \(id) - isDirect: \(isDirect) - unreadMessagesCount: \(unreadMessagesCount) - unreadMentionsCount: \(unreadMentionsCount) - notificationMode: \(notificationMode?.rawValue ?? "nil")"
|
||||
}
|
||||
}
|
||||
|
||||
extension RoomSummaryDetails {
|
||||
init(id: String, settingsMode: RoomNotificationModeProxy, hasUnreadMessages: Bool, hasUnreadMentions: Bool) {
|
||||
self.id = id
|
||||
let string = "\(settingsMode) - hasUnreadMessages: \(hasUnreadMessages) - hasUnreadMentions: \(hasUnreadMentions)"
|
||||
name = string
|
||||
isDirect = true
|
||||
avatarURL = nil
|
||||
lastMessage = AttributedString(string)
|
||||
lastMessageFormattedTimestamp = "Now"
|
||||
unreadMessagesCount = hasUnreadMessages ? 1 : 0
|
||||
unreadMentionsCount = hasUnreadMentions ? 1 : 0
|
||||
notificationMode = settingsMode
|
||||
canonicalAlias = nil
|
||||
inviter = nil
|
||||
hasOngoingCall = false
|
||||
}
|
||||
}
|
||||
|
@ -245,7 +245,8 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
avatarURL: roomInfo.avatarUrl.flatMap(URL.init(string:)),
|
||||
lastMessage: attributedLastMessage,
|
||||
lastMessageFormattedTimestamp: lastMessageFormattedTimestamp,
|
||||
unreadNotificationCount: UInt(roomInfo.notificationCount),
|
||||
unreadMessagesCount: UInt(roomInfo.notificationCount),
|
||||
unreadMentionsCount: UInt(roomInfo.numUnreadMentions),
|
||||
notificationMode: notificationMode,
|
||||
canonicalAlias: roomInfo.canonicalAlias,
|
||||
inviter: inviterProxy,
|
||||
|
@ -229,7 +229,8 @@ class LoggingTests: XCTestCase {
|
||||
avatarURL: nil,
|
||||
lastMessage: AttributedString(lastMessage),
|
||||
lastMessageFormattedTimestamp: "Now",
|
||||
unreadNotificationCount: 0,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: nil,
|
||||
inviter: nil,
|
||||
|
BIN
UnitTests/__Snapshots__/PreviewTests/test_homeScreen.Loaded.png
(Stored with Git LFS)
BIN
UnitTests/__Snapshots__/PreviewTests/test_homeScreen.Loaded.png
(Stored with Git LFS)
Binary file not shown.
BIN
UnitTests/__Snapshots__/PreviewTests/test_homeScreenRoomCell.1.png
(Stored with Git LFS)
BIN
UnitTests/__Snapshots__/PreviewTests/test_homeScreenRoomCell.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
UnitTests/__Snapshots__/PreviewTests/test_homeScreenRoomCell.Generic.png
(Stored with Git LFS)
Normal file
BIN
UnitTests/__Snapshots__/PreviewTests/test_homeScreenRoomCell.Generic.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnitTests/__Snapshots__/PreviewTests/test_homeScreenRoomCell.Notifications-State.png
(Stored with Git LFS)
Normal file
BIN
UnitTests/__Snapshots__/PreviewTests/test_homeScreenRoomCell.Notifications-State.png
(Stored with Git LFS)
Normal file
Binary file not shown.
1
changelog.d/2281.feature
Normal file
1
changelog.d/2281.feature
Normal file
@ -0,0 +1 @@
|
||||
Added back the mention badge option but only behind a feature flag.
|
@ -47,7 +47,7 @@ packages:
|
||||
# Element/Matrix dependencies
|
||||
MatrixRustSDK:
|
||||
url: https://github.com/matrix-org/matrix-rust-components-swift
|
||||
exactVersion: 0.0.1-december23
|
||||
exactVersion: 1.1.31
|
||||
# path: ../matrix-rust-sdk
|
||||
Compound:
|
||||
url: https://github.com/element-hq/compound-ios
|
||||
|
Loading…
x
Reference in New Issue
Block a user