Fixes #2320 - Implement support for (un)marking rooms as favourite from the room list and room detail screens

This commit is contained in:
Stefan Ceriu
2024-02-19 15:13:15 +02:00
parent 3887403150
commit 6d9271ce59
60 changed files with 372 additions and 179 deletions
+3 -2
View File
@@ -36,14 +36,15 @@ class HomeScreenRoomTests: XCTestCase {
avatarURL: nil,
lastMessage: nil,
lastMessageFormattedTimestamp: nil,
isMarkedUnread: isMarkedUnread,
unreadMessagesCount: unreadMessagesCount,
unreadMentionsCount: unreadMentionsCount,
unreadNotificationsCount: unreadNotificationsCount,
notificationMode: notificationMode,
canonicalAlias: nil,
inviter: nil,
hasOngoingCall: hasOngoingCall)
hasOngoingCall: hasOngoingCall,
isMarkedUnread: isMarkedUnread,
isFavourite: false)
}
func testNoBadge() {
@@ -35,8 +35,9 @@ class HomeScreenViewModelTests: XCTestCase {
viewModel = HomeScreenViewModel(userSession: MockUserSession(clientProxy: clientProxy,
mediaProvider: MockMediaProvider(),
voiceMessageMediaManager: VoiceMessageMediaManagerMock()),
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
analyticsService: ServiceLocator.shared.analytics,
appSettings: ServiceLocator.shared.settings,
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
userIndicatorController: ServiceLocator.shared.userIndicatorController)
}
+3 -2
View File
@@ -229,14 +229,15 @@ class LoggingTests: XCTestCase {
avatarURL: nil,
lastMessage: AttributedString(lastMessage),
lastMessageFormattedTimestamp: "Now",
isMarkedUnread: false,
unreadMessagesCount: 0,
unreadMentionsCount: 0,
unreadNotificationsCount: 0,
notificationMode: nil,
canonicalAlias: nil,
inviter: nil,
hasOngoingCall: false)
hasOngoingCall: false,
isMarkedUnread: false,
isFavourite: false)
// When logging that value
XCTAssert(MXLogger.logFiles.isEmpty)
@@ -36,6 +36,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
analyticsService: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationSettingsProxy: notificationSettingsProxyMock,
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL,
@@ -50,6 +51,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
analyticsService: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL,
@@ -71,6 +73,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
analyticsService: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL,
@@ -93,6 +96,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
analyticsService: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL,
@@ -145,6 +149,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
analyticsService: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL,
@@ -171,6 +176,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
analyticsService: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL,
@@ -206,6 +212,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
analyticsService: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL,
@@ -242,6 +249,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
analyticsService: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL,
@@ -277,6 +285,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
analyticsService: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL,
@@ -311,6 +320,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
analyticsService: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL,
@@ -327,6 +337,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
analyticsService: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL,
@@ -360,6 +371,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
analyticsService: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL,
@@ -380,6 +392,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
analyticsService: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL,
@@ -400,6 +413,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
analyticsService: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL,
@@ -420,6 +434,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
analyticsService: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL,
@@ -439,6 +454,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
analyticsService: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL,
@@ -456,6 +472,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
analyticsService: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
notificationSettingsProxy: notificationSettingsProxyMock,
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL,