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