mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Update SDK to 1.0.106-alpha (#1480)
This commit is contained in:
@@ -5402,7 +5402,7 @@
|
||||
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
|
||||
requirement = {
|
||||
kind = exactVersion;
|
||||
version = "1.0.105-alpha";
|
||||
version = "1.0.106-alpha";
|
||||
};
|
||||
};
|
||||
821C67C9A7F8CC3FD41B28B4 /* XCRemoteSwiftPackageReference "emojibase-bindings" */ = {
|
||||
|
||||
@@ -129,8 +129,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
|
||||
"state" : {
|
||||
"revision" : "ce67b9e191755f8562f1f1eccc195ebbb696cfb2",
|
||||
"version" : "1.0.105-alpha"
|
||||
"revision" : "e9c185dc6a9d01c198fae36161b0e4180dfcfdd6",
|
||||
"version" : "1.0.106-alpha"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -322,27 +322,27 @@ class NotificationSettingsProxyMock: NotificationSettingsProxyProtocol {
|
||||
|
||||
//MARK: - getNotificationSettings
|
||||
|
||||
var getNotificationSettingsRoomIdIsEncryptedActiveMembersCountThrowableError: Error?
|
||||
var getNotificationSettingsRoomIdIsEncryptedActiveMembersCountCallsCount = 0
|
||||
var getNotificationSettingsRoomIdIsEncryptedActiveMembersCountCalled: Bool {
|
||||
return getNotificationSettingsRoomIdIsEncryptedActiveMembersCountCallsCount > 0
|
||||
var getNotificationSettingsRoomIdIsEncryptedIsOneToOneThrowableError: Error?
|
||||
var getNotificationSettingsRoomIdIsEncryptedIsOneToOneCallsCount = 0
|
||||
var getNotificationSettingsRoomIdIsEncryptedIsOneToOneCalled: Bool {
|
||||
return getNotificationSettingsRoomIdIsEncryptedIsOneToOneCallsCount > 0
|
||||
}
|
||||
var getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReceivedArguments: (roomId: String, isEncrypted: Bool, activeMembersCount: UInt64)?
|
||||
var getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReceivedInvocations: [(roomId: String, isEncrypted: Bool, activeMembersCount: UInt64)] = []
|
||||
var getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReturnValue: RoomNotificationSettingsProxyProtocol!
|
||||
var getNotificationSettingsRoomIdIsEncryptedActiveMembersCountClosure: ((String, Bool, UInt64) async throws -> RoomNotificationSettingsProxyProtocol)?
|
||||
var getNotificationSettingsRoomIdIsEncryptedIsOneToOneReceivedArguments: (roomId: String, isEncrypted: Bool, isOneToOne: Bool)?
|
||||
var getNotificationSettingsRoomIdIsEncryptedIsOneToOneReceivedInvocations: [(roomId: String, isEncrypted: Bool, isOneToOne: Bool)] = []
|
||||
var getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue: RoomNotificationSettingsProxyProtocol!
|
||||
var getNotificationSettingsRoomIdIsEncryptedIsOneToOneClosure: ((String, Bool, Bool) async throws -> RoomNotificationSettingsProxyProtocol)?
|
||||
|
||||
func getNotificationSettings(roomId: String, isEncrypted: Bool, activeMembersCount: UInt64) async throws -> RoomNotificationSettingsProxyProtocol {
|
||||
if let error = getNotificationSettingsRoomIdIsEncryptedActiveMembersCountThrowableError {
|
||||
func getNotificationSettings(roomId: String, isEncrypted: Bool, isOneToOne: Bool) async throws -> RoomNotificationSettingsProxyProtocol {
|
||||
if let error = getNotificationSettingsRoomIdIsEncryptedIsOneToOneThrowableError {
|
||||
throw error
|
||||
}
|
||||
getNotificationSettingsRoomIdIsEncryptedActiveMembersCountCallsCount += 1
|
||||
getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReceivedArguments = (roomId: roomId, isEncrypted: isEncrypted, activeMembersCount: activeMembersCount)
|
||||
getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReceivedInvocations.append((roomId: roomId, isEncrypted: isEncrypted, activeMembersCount: activeMembersCount))
|
||||
if let getNotificationSettingsRoomIdIsEncryptedActiveMembersCountClosure = getNotificationSettingsRoomIdIsEncryptedActiveMembersCountClosure {
|
||||
return try await getNotificationSettingsRoomIdIsEncryptedActiveMembersCountClosure(roomId, isEncrypted, activeMembersCount)
|
||||
getNotificationSettingsRoomIdIsEncryptedIsOneToOneCallsCount += 1
|
||||
getNotificationSettingsRoomIdIsEncryptedIsOneToOneReceivedArguments = (roomId: roomId, isEncrypted: isEncrypted, isOneToOne: isOneToOne)
|
||||
getNotificationSettingsRoomIdIsEncryptedIsOneToOneReceivedInvocations.append((roomId: roomId, isEncrypted: isEncrypted, isOneToOne: isOneToOne))
|
||||
if let getNotificationSettingsRoomIdIsEncryptedIsOneToOneClosure = getNotificationSettingsRoomIdIsEncryptedIsOneToOneClosure {
|
||||
return try await getNotificationSettingsRoomIdIsEncryptedIsOneToOneClosure(roomId, isEncrypted, isOneToOne)
|
||||
} else {
|
||||
return getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReturnValue
|
||||
return getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - setNotificationMode
|
||||
@@ -367,23 +367,23 @@ class NotificationSettingsProxyMock: NotificationSettingsProxyProtocol {
|
||||
}
|
||||
//MARK: - getDefaultNotificationRoomMode
|
||||
|
||||
var getDefaultNotificationRoomModeIsEncryptedActiveMembersCountCallsCount = 0
|
||||
var getDefaultNotificationRoomModeIsEncryptedActiveMembersCountCalled: Bool {
|
||||
return getDefaultNotificationRoomModeIsEncryptedActiveMembersCountCallsCount > 0
|
||||
var getDefaultNotificationRoomModeIsEncryptedIsOneToOneCallsCount = 0
|
||||
var getDefaultNotificationRoomModeIsEncryptedIsOneToOneCalled: Bool {
|
||||
return getDefaultNotificationRoomModeIsEncryptedIsOneToOneCallsCount > 0
|
||||
}
|
||||
var getDefaultNotificationRoomModeIsEncryptedActiveMembersCountReceivedArguments: (isEncrypted: Bool, activeMembersCount: UInt64)?
|
||||
var getDefaultNotificationRoomModeIsEncryptedActiveMembersCountReceivedInvocations: [(isEncrypted: Bool, activeMembersCount: UInt64)] = []
|
||||
var getDefaultNotificationRoomModeIsEncryptedActiveMembersCountReturnValue: RoomNotificationModeProxy!
|
||||
var getDefaultNotificationRoomModeIsEncryptedActiveMembersCountClosure: ((Bool, UInt64) async -> RoomNotificationModeProxy)?
|
||||
var getDefaultNotificationRoomModeIsEncryptedIsOneToOneReceivedArguments: (isEncrypted: Bool, isOneToOne: Bool)?
|
||||
var getDefaultNotificationRoomModeIsEncryptedIsOneToOneReceivedInvocations: [(isEncrypted: Bool, isOneToOne: Bool)] = []
|
||||
var getDefaultNotificationRoomModeIsEncryptedIsOneToOneReturnValue: RoomNotificationModeProxy!
|
||||
var getDefaultNotificationRoomModeIsEncryptedIsOneToOneClosure: ((Bool, Bool) async -> RoomNotificationModeProxy)?
|
||||
|
||||
func getDefaultNotificationRoomMode(isEncrypted: Bool, activeMembersCount: UInt64) async -> RoomNotificationModeProxy {
|
||||
getDefaultNotificationRoomModeIsEncryptedActiveMembersCountCallsCount += 1
|
||||
getDefaultNotificationRoomModeIsEncryptedActiveMembersCountReceivedArguments = (isEncrypted: isEncrypted, activeMembersCount: activeMembersCount)
|
||||
getDefaultNotificationRoomModeIsEncryptedActiveMembersCountReceivedInvocations.append((isEncrypted: isEncrypted, activeMembersCount: activeMembersCount))
|
||||
if let getDefaultNotificationRoomModeIsEncryptedActiveMembersCountClosure = getDefaultNotificationRoomModeIsEncryptedActiveMembersCountClosure {
|
||||
return await getDefaultNotificationRoomModeIsEncryptedActiveMembersCountClosure(isEncrypted, activeMembersCount)
|
||||
func getDefaultNotificationRoomMode(isEncrypted: Bool, isOneToOne: Bool) async -> RoomNotificationModeProxy {
|
||||
getDefaultNotificationRoomModeIsEncryptedIsOneToOneCallsCount += 1
|
||||
getDefaultNotificationRoomModeIsEncryptedIsOneToOneReceivedArguments = (isEncrypted: isEncrypted, isOneToOne: isOneToOne)
|
||||
getDefaultNotificationRoomModeIsEncryptedIsOneToOneReceivedInvocations.append((isEncrypted: isEncrypted, isOneToOne: isOneToOne))
|
||||
if let getDefaultNotificationRoomModeIsEncryptedIsOneToOneClosure = getDefaultNotificationRoomModeIsEncryptedIsOneToOneClosure {
|
||||
return await getDefaultNotificationRoomModeIsEncryptedIsOneToOneClosure(isEncrypted, isOneToOne)
|
||||
} else {
|
||||
return getDefaultNotificationRoomModeIsEncryptedActiveMembersCountReturnValue
|
||||
return getDefaultNotificationRoomModeIsEncryptedIsOneToOneReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - restoreDefaultNotificationMode
|
||||
@@ -425,23 +425,23 @@ class NotificationSettingsProxyMock: NotificationSettingsProxyProtocol {
|
||||
}
|
||||
//MARK: - unmuteRoom
|
||||
|
||||
var unmuteRoomRoomIdIsEncryptedActiveMembersCountThrowableError: Error?
|
||||
var unmuteRoomRoomIdIsEncryptedActiveMembersCountCallsCount = 0
|
||||
var unmuteRoomRoomIdIsEncryptedActiveMembersCountCalled: Bool {
|
||||
return unmuteRoomRoomIdIsEncryptedActiveMembersCountCallsCount > 0
|
||||
var unmuteRoomRoomIdIsEncryptedIsOneToOneThrowableError: Error?
|
||||
var unmuteRoomRoomIdIsEncryptedIsOneToOneCallsCount = 0
|
||||
var unmuteRoomRoomIdIsEncryptedIsOneToOneCalled: Bool {
|
||||
return unmuteRoomRoomIdIsEncryptedIsOneToOneCallsCount > 0
|
||||
}
|
||||
var unmuteRoomRoomIdIsEncryptedActiveMembersCountReceivedArguments: (roomId: String, isEncrypted: Bool, activeMembersCount: UInt64)?
|
||||
var unmuteRoomRoomIdIsEncryptedActiveMembersCountReceivedInvocations: [(roomId: String, isEncrypted: Bool, activeMembersCount: UInt64)] = []
|
||||
var unmuteRoomRoomIdIsEncryptedActiveMembersCountClosure: ((String, Bool, UInt64) async throws -> Void)?
|
||||
var unmuteRoomRoomIdIsEncryptedIsOneToOneReceivedArguments: (roomId: String, isEncrypted: Bool, isOneToOne: Bool)?
|
||||
var unmuteRoomRoomIdIsEncryptedIsOneToOneReceivedInvocations: [(roomId: String, isEncrypted: Bool, isOneToOne: Bool)] = []
|
||||
var unmuteRoomRoomIdIsEncryptedIsOneToOneClosure: ((String, Bool, Bool) async throws -> Void)?
|
||||
|
||||
func unmuteRoom(roomId: String, isEncrypted: Bool, activeMembersCount: UInt64) async throws {
|
||||
if let error = unmuteRoomRoomIdIsEncryptedActiveMembersCountThrowableError {
|
||||
func unmuteRoom(roomId: String, isEncrypted: Bool, isOneToOne: Bool) async throws {
|
||||
if let error = unmuteRoomRoomIdIsEncryptedIsOneToOneThrowableError {
|
||||
throw error
|
||||
}
|
||||
unmuteRoomRoomIdIsEncryptedActiveMembersCountCallsCount += 1
|
||||
unmuteRoomRoomIdIsEncryptedActiveMembersCountReceivedArguments = (roomId: roomId, isEncrypted: isEncrypted, activeMembersCount: activeMembersCount)
|
||||
unmuteRoomRoomIdIsEncryptedActiveMembersCountReceivedInvocations.append((roomId: roomId, isEncrypted: isEncrypted, activeMembersCount: activeMembersCount))
|
||||
try await unmuteRoomRoomIdIsEncryptedActiveMembersCountClosure?(roomId, isEncrypted, activeMembersCount)
|
||||
unmuteRoomRoomIdIsEncryptedIsOneToOneCallsCount += 1
|
||||
unmuteRoomRoomIdIsEncryptedIsOneToOneReceivedArguments = (roomId: roomId, isEncrypted: isEncrypted, isOneToOne: isOneToOne)
|
||||
unmuteRoomRoomIdIsEncryptedIsOneToOneReceivedInvocations.append((roomId: roomId, isEncrypted: isEncrypted, isOneToOne: isOneToOne))
|
||||
try await unmuteRoomRoomIdIsEncryptedIsOneToOneClosure?(roomId, isEncrypted, isOneToOne)
|
||||
}
|
||||
//MARK: - isRoomMentionEnabled
|
||||
|
||||
|
||||
@@ -34,19 +34,19 @@ extension NotificationSettingsProxyMock {
|
||||
self.init()
|
||||
|
||||
callbacks = configuration.callback
|
||||
getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReturnValue = configuration.roomMode
|
||||
getDefaultNotificationRoomModeIsEncryptedActiveMembersCountReturnValue = configuration.defaultRoomMode
|
||||
getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue = configuration.roomMode
|
||||
getDefaultNotificationRoomModeIsEncryptedIsOneToOneReturnValue = configuration.defaultRoomMode
|
||||
|
||||
setNotificationModeRoomIdModeClosure = { [weak self] _, mode in
|
||||
guard let self else { return }
|
||||
self.getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: mode, isDefault: false))
|
||||
self.getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: mode, isDefault: false))
|
||||
Task {
|
||||
self.callbacks.send(.settingsDidChange)
|
||||
}
|
||||
}
|
||||
restoreDefaultNotificationModeRoomIdClosure = { [weak self] _ in
|
||||
guard let self else { return }
|
||||
self.getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: configuration.defaultRoomMode, isDefault: true))
|
||||
self.getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: configuration.defaultRoomMode, isDefault: true))
|
||||
Task {
|
||||
self.callbacks.send(.settingsDidChange)
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
||||
do {
|
||||
let notificationMode = try await notificationSettingsProxy.getNotificationSettings(roomId: roomProxy.id,
|
||||
isEncrypted: roomProxy.isEncrypted,
|
||||
activeMembersCount: UInt64(roomProxy.activeMembersCount))
|
||||
isOneToOne: roomProxy.activeMembersCount == 2)
|
||||
state.notificationSettingsState = .loaded(settings: notificationMode)
|
||||
} catch {
|
||||
state.notificationSettingsState = .error
|
||||
@@ -213,7 +213,7 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
||||
do {
|
||||
try await notificationSettingsProxy.unmuteRoom(roomId: roomProxy.id,
|
||||
isEncrypted: roomProxy.isEncrypted,
|
||||
activeMembersCount: UInt64(roomProxy.activeMembersCount))
|
||||
isOneToOne: roomProxy.activeMembersCount == 2)
|
||||
} catch {
|
||||
state.bindings.alertInfo = AlertInfo(id: .alert,
|
||||
title: L10n.commonError,
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ class RoomNotificationSettingsScreenViewModel: RoomNotificationSettingsScreenVie
|
||||
do {
|
||||
let settings = try await notificationSettingsProxy.getNotificationSettings(roomId: roomProxy.id,
|
||||
isEncrypted: roomProxy.isEncrypted,
|
||||
activeMembersCount: UInt64(roomProxy.activeMembersCount))
|
||||
isOneToOne: roomProxy.activeMembersCount == 2)
|
||||
guard !Task.isCancelled else { return }
|
||||
state.notificationSettingsState = .loaded(settings: settings)
|
||||
if !state.isRestoringDefautSetting {
|
||||
|
||||
+4
-6
@@ -121,15 +121,13 @@ class NotificationSettingsScreenViewModel: NotificationSettingsScreenViewModelTy
|
||||
fetchSettingsTask = Task {
|
||||
// Group chats
|
||||
// A group chat is a chat having more than 2 active members
|
||||
let groupChatActiveMembers: UInt64 = 3
|
||||
var groupChatsMode = await notificationSettingsProxy.getDefaultNotificationRoomMode(isEncrypted: false, activeMembersCount: groupChatActiveMembers)
|
||||
let encryptedGroupChatsMode = await notificationSettingsProxy.getDefaultNotificationRoomMode(isEncrypted: true, activeMembersCount: groupChatActiveMembers)
|
||||
var groupChatsMode = await notificationSettingsProxy.getDefaultNotificationRoomMode(isEncrypted: false, isOneToOne: false)
|
||||
let encryptedGroupChatsMode = await notificationSettingsProxy.getDefaultNotificationRoomMode(isEncrypted: true, isOneToOne: false)
|
||||
|
||||
// Direct chats
|
||||
// A direct chat is a chat having exactly 2 active members
|
||||
let directChatActiveMembers: UInt64 = 2
|
||||
var directChatsMode = await notificationSettingsProxy.getDefaultNotificationRoomMode(isEncrypted: false, activeMembersCount: directChatActiveMembers)
|
||||
let encryptedDirectChatsMode = await notificationSettingsProxy.getDefaultNotificationRoomMode(isEncrypted: true, activeMembersCount: directChatActiveMembers)
|
||||
var directChatsMode = await notificationSettingsProxy.getDefaultNotificationRoomMode(isEncrypted: false, isOneToOne: true)
|
||||
let encryptedDirectChatsMode = await notificationSettingsProxy.getDefaultNotificationRoomMode(isEncrypted: true, isOneToOne: true)
|
||||
|
||||
// Old clients were having specific settings for encrypted and unencrypted rooms,
|
||||
// so it's possible for `group chats` and `direct chats` settings to be inconsistent (e.g. encrypted `direct chats` can have a different mode that unencrypted `direct chats`)
|
||||
|
||||
+3
-3
@@ -183,9 +183,9 @@ struct NotificationSettingsScreen_Previews: PreviewProvider {
|
||||
let notificationCenter = UserNotificationCenterMock()
|
||||
notificationCenter.authorizationStatusReturnValue = .notDetermined
|
||||
let notificationSettingsProxy = NotificationSettingsProxyMock(with: .init())
|
||||
notificationSettingsProxy.getDefaultNotificationRoomModeIsEncryptedActiveMembersCountClosure = { isEncrypted, activeMembersCount in
|
||||
switch (isEncrypted, activeMembersCount) {
|
||||
case (_, 2):
|
||||
notificationSettingsProxy.getDefaultNotificationRoomModeIsEncryptedIsOneToOneClosure = { isEncrypted, isOneToOne in
|
||||
switch (isEncrypted, isOneToOne) {
|
||||
case (_, true):
|
||||
return .allMessages
|
||||
default:
|
||||
return .mentionsAndKeywordsOnly
|
||||
|
||||
@@ -46,8 +46,8 @@ final class NotificationSettingsProxy: NotificationSettingsProxyProtocol {
|
||||
notificationSettings.setDelegate(delegate: WeakNotificationSettingsProxy(proxy: self))
|
||||
}
|
||||
|
||||
func getNotificationSettings(roomId: String, isEncrypted: Bool, activeMembersCount: UInt64) async throws -> RoomNotificationSettingsProxyProtocol {
|
||||
let roomMotificationSettings = try await notificationSettings.getRoomNotificationSettings(roomId: roomId, isEncrypted: isEncrypted, activeMembersCount: activeMembersCount)
|
||||
func getNotificationSettings(roomId: String, isEncrypted: Bool, isOneToOne: Bool) async throws -> RoomNotificationSettingsProxyProtocol {
|
||||
let roomMotificationSettings = try await notificationSettings.getRoomNotificationSettings(roomId: roomId, isEncrypted: isEncrypted, isOneToOne: isOneToOne)
|
||||
return RoomNotificationSettingsProxy(roomNotificationSettings: roomMotificationSettings)
|
||||
}
|
||||
|
||||
@@ -68,8 +68,8 @@ final class NotificationSettingsProxy: NotificationSettingsProxyProtocol {
|
||||
await updatedSettings()
|
||||
}
|
||||
|
||||
func getDefaultNotificationRoomMode(isEncrypted: Bool, activeMembersCount: UInt64) async -> RoomNotificationModeProxy {
|
||||
let roomNotificationMode = await notificationSettings.getDefaultRoomNotificationMode(isEncrypted: isEncrypted, activeMembersCount: activeMembersCount)
|
||||
func getDefaultNotificationRoomMode(isEncrypted: Bool, isOneToOne: Bool) async -> RoomNotificationModeProxy {
|
||||
let roomNotificationMode = await notificationSettings.getDefaultRoomNotificationMode(isEncrypted: isEncrypted, isOneToOne: isOneToOne)
|
||||
return RoomNotificationModeProxy.from(roomNotificationMode: roomNotificationMode)
|
||||
}
|
||||
|
||||
@@ -85,11 +85,11 @@ final class NotificationSettingsProxy: NotificationSettingsProxyProtocol {
|
||||
await notificationSettings.containsKeywordsRules()
|
||||
}
|
||||
|
||||
func unmuteRoom(roomId: String, isEncrypted: Bool, activeMembersCount: UInt64) async throws {
|
||||
func unmuteRoom(roomId: String, isEncrypted: Bool, isOneToOne: Bool) async throws {
|
||||
let backgroundTask = await backgroundTaskService?.startBackgroundTask(withName: "unmuteRoom")
|
||||
defer { backgroundTask?.stop() }
|
||||
|
||||
try await notificationSettings.unmuteRoom(roomId: roomId, isEncrypted: isEncrypted, membersCount: activeMembersCount)
|
||||
try await notificationSettings.unmuteRoom(roomId: roomId, isEncrypted: isEncrypted, isOneToOne: isOneToOne)
|
||||
await updatedSettings()
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -26,12 +26,12 @@ enum NotificationSettingsProxyCallback {
|
||||
protocol NotificationSettingsProxyProtocol {
|
||||
var callbacks: PassthroughSubject<NotificationSettingsProxyCallback, Never> { get }
|
||||
|
||||
func getNotificationSettings(roomId: String, isEncrypted: Bool, activeMembersCount: UInt64) async throws -> RoomNotificationSettingsProxyProtocol
|
||||
func getNotificationSettings(roomId: String, isEncrypted: Bool, isOneToOne: Bool) async throws -> RoomNotificationSettingsProxyProtocol
|
||||
func setNotificationMode(roomId: String, mode: RoomNotificationModeProxy) async throws
|
||||
func getDefaultNotificationRoomMode(isEncrypted: Bool, activeMembersCount: UInt64) async -> RoomNotificationModeProxy
|
||||
func getDefaultNotificationRoomMode(isEncrypted: Bool, isOneToOne: Bool) async -> RoomNotificationModeProxy
|
||||
func restoreDefaultNotificationMode(roomId: String) async throws
|
||||
func containsKeywordsRules() async -> Bool
|
||||
func unmuteRoom(roomId: String, isEncrypted: Bool, activeMembersCount: UInt64) async throws
|
||||
func unmuteRoom(roomId: String, isEncrypted: Bool, isOneToOne: Bool) async throws
|
||||
func isRoomMentionEnabled() async throws -> Bool
|
||||
func setRoomMentionEnabled(enabled: Bool) async throws
|
||||
func isUserMentionEnabled() async throws -> Bool
|
||||
|
||||
@@ -73,7 +73,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
self.roomList = roomList
|
||||
|
||||
do {
|
||||
let listUpdatesSubscriptionResult = try roomList.entries(listener: RoomListEntriesListenerProxy { [weak self] updates in
|
||||
let listUpdatesSubscriptionResult = roomList.entries(listener: RoomListEntriesListenerProxy { [weak self] updates in
|
||||
guard let self else { return }
|
||||
MXLog.info("\(name): Received list update")
|
||||
diffsPublisher.send(updates)
|
||||
|
||||
@@ -34,7 +34,7 @@ class NotificationSettingsScreenViewModelTests: XCTestCase {
|
||||
userNotificationCenter.authorizationStatusReturnValue = .authorized
|
||||
appSettings = AppSettings()
|
||||
notificationSettingsProxy = NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration())
|
||||
notificationSettingsProxy.getDefaultNotificationRoomModeIsEncryptedActiveMembersCountReturnValue = .allMessages
|
||||
notificationSettingsProxy.getDefaultNotificationRoomModeIsEncryptedIsOneToOneReturnValue = .allMessages
|
||||
notificationSettingsProxy.isRoomMentionEnabledReturnValue = true
|
||||
notificationSettingsProxy.isCallEnabledReturnValue = true
|
||||
|
||||
@@ -58,9 +58,9 @@ class NotificationSettingsScreenViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testFetchSettings() async throws {
|
||||
notificationSettingsProxy.getDefaultNotificationRoomModeIsEncryptedActiveMembersCountClosure = { isEncrypted, activeMembersCount in
|
||||
switch (isEncrypted, activeMembersCount) {
|
||||
case (_, 2):
|
||||
notificationSettingsProxy.getDefaultNotificationRoomModeIsEncryptedIsOneToOneClosure = { isEncrypted, isOneToOne in
|
||||
switch (isEncrypted, isOneToOne) {
|
||||
case (_, true):
|
||||
return .allMessages
|
||||
case (_, _):
|
||||
return .mentionsAndKeywordsOnly
|
||||
@@ -71,7 +71,7 @@ class NotificationSettingsScreenViewModelTests: XCTestCase {
|
||||
notificationSettingsProxy.callbacks.send(.settingsDidChange)
|
||||
try await deferred.fulfill()
|
||||
|
||||
XCTAssertEqual(notificationSettingsProxy.getDefaultNotificationRoomModeIsEncryptedActiveMembersCountCallsCount, 4)
|
||||
XCTAssertEqual(notificationSettingsProxy.getDefaultNotificationRoomModeIsEncryptedIsOneToOneCallsCount, 4)
|
||||
XCTAssert(notificationSettingsProxy.isRoomMentionEnabledCalled)
|
||||
XCTAssert(notificationSettingsProxy.isCallEnabledCalled)
|
||||
|
||||
@@ -82,11 +82,11 @@ class NotificationSettingsScreenViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testInconsistentGroupChatsSettings() async throws {
|
||||
notificationSettingsProxy.getDefaultNotificationRoomModeIsEncryptedActiveMembersCountClosure = { isEncrypted, activeMembersCount in
|
||||
switch (isEncrypted, activeMembersCount) {
|
||||
case (true, 3):
|
||||
notificationSettingsProxy.getDefaultNotificationRoomModeIsEncryptedIsOneToOneClosure = { isEncrypted, isOneToOne in
|
||||
switch (isEncrypted, isOneToOne) {
|
||||
case (true, false):
|
||||
return .allMessages
|
||||
case (false, 3):
|
||||
case (false, false):
|
||||
return .mentionsAndKeywordsOnly
|
||||
default:
|
||||
return .allMessages
|
||||
@@ -103,11 +103,11 @@ class NotificationSettingsScreenViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testInconsistentDirectChatsSettings() async throws {
|
||||
notificationSettingsProxy.getDefaultNotificationRoomModeIsEncryptedActiveMembersCountClosure = { isEncrypted, activeMembersCount in
|
||||
switch (isEncrypted, activeMembersCount) {
|
||||
case (true, 2):
|
||||
notificationSettingsProxy.getDefaultNotificationRoomModeIsEncryptedIsOneToOneClosure = { isEncrypted, isOneToOne in
|
||||
switch (isEncrypted, isOneToOne) {
|
||||
case (true, true):
|
||||
return .allMessages
|
||||
case (false, 2):
|
||||
case (false, true):
|
||||
return .mentionsAndKeywordsOnly
|
||||
default:
|
||||
return .allMessages
|
||||
|
||||
@@ -381,7 +381,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
|
||||
// MARK: - Notifications
|
||||
|
||||
func testNotificationLoadingSettingsFailure() async throws {
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedActiveMembersCountThrowableError = NotificationSettingsError.Generic(message: "error")
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneThrowableError = NotificationSettingsError.Generic(message: "error")
|
||||
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
|
||||
roomProxy: roomProxyMock,
|
||||
mediaProvider: MockMediaProvider(),
|
||||
@@ -403,7 +403,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testNotificationDefaultMode() async throws {
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .allMessages, isDefault: true))
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .allMessages, isDefault: true))
|
||||
let deferred = deferFulfillment(context.$viewState.map(\.notificationSettingsState).first(where: \.isLoaded))
|
||||
notificationSettingsProxyMock.callbacks.send(.settingsDidChange)
|
||||
try await deferred.fulfill()
|
||||
@@ -412,7 +412,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testNotificationCustomMode() async throws {
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .allMessages, isDefault: false))
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .allMessages, isDefault: false))
|
||||
let deferred = deferFulfillment(context.$viewState.map(\.notificationSettingsState).first(where: \.isCustom))
|
||||
notificationSettingsProxyMock.callbacks.send(.settingsDidChange)
|
||||
try await deferred.fulfill()
|
||||
@@ -421,7 +421,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testNotificationRoomMuted() async throws {
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .mute, isDefault: false))
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .mute, isDefault: false))
|
||||
let deferred = deferFulfillment(context.$viewState.map(\.notificationSettingsState).first(where: \.isLoaded))
|
||||
notificationSettingsProxyMock.callbacks.send(.settingsDidChange)
|
||||
try await deferred.fulfill()
|
||||
@@ -431,7 +431,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testNotificationRoomNotMuted() async throws {
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .mentionsAndKeywordsOnly, isDefault: false))
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .mentionsAndKeywordsOnly, isDefault: false))
|
||||
let deferred = deferFulfillment(context.$viewState.map(\.notificationSettingsState).first(where: \.isLoaded))
|
||||
notificationSettingsProxyMock.callbacks.send(.settingsDidChange)
|
||||
try await deferred.fulfill()
|
||||
@@ -444,7 +444,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
|
||||
try await testNotificationRoomMuted()
|
||||
|
||||
let expectation = expectation(description: #function)
|
||||
notificationSettingsProxyMock.unmuteRoomRoomIdIsEncryptedActiveMembersCountClosure = { _, _, _ in
|
||||
notificationSettingsProxyMock.unmuteRoomRoomIdIsEncryptedIsOneToOneClosure = { _, _, _ in
|
||||
defer {
|
||||
expectation.fulfill()
|
||||
}
|
||||
@@ -495,7 +495,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
|
||||
|
||||
let expectation = expectation(description: #function)
|
||||
notificationSettingsProxyMock.setNotificationModeRoomIdModeClosure = { [weak notificationSettingsProxyMock] _, mode in
|
||||
notificationSettingsProxyMock?.getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: mode, isDefault: false))
|
||||
notificationSettingsProxyMock?.getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: mode, isDefault: false))
|
||||
expectation.fulfill()
|
||||
}
|
||||
context.send(viewAction: .processToogleMuteNotifications)
|
||||
@@ -521,8 +521,8 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
|
||||
try await testNotificationRoomMuted()
|
||||
|
||||
let expectation = expectation(description: #function)
|
||||
notificationSettingsProxyMock.unmuteRoomRoomIdIsEncryptedActiveMembersCountClosure = { [weak notificationSettingsProxyMock] _, _, _ in
|
||||
notificationSettingsProxyMock?.getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .allMessages, isDefault: false))
|
||||
notificationSettingsProxyMock.unmuteRoomRoomIdIsEncryptedIsOneToOneClosure = { [weak notificationSettingsProxyMock] _, _, _ in
|
||||
notificationSettingsProxyMock?.getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .allMessages, isDefault: false))
|
||||
expectation.fulfill()
|
||||
}
|
||||
context.send(viewAction: .processToogleMuteNotifications)
|
||||
|
||||
@@ -34,7 +34,7 @@ class RoomNotificationSettingsScreenViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testInitialStateDefaultMode() async throws {
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .mentionsAndKeywordsOnly, isDefault: true))
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .mentionsAndKeywordsOnly, isDefault: true))
|
||||
viewModel = RoomNotificationSettingsScreenViewModel(notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
roomProxy: roomProxyMock)
|
||||
let deferred = deferFulfillment(context.$viewState.map(\.notificationSettingsState)
|
||||
@@ -46,7 +46,7 @@ class RoomNotificationSettingsScreenViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testInitialStateCustomMode() async throws {
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .mentionsAndKeywordsOnly, isDefault: false))
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .mentionsAndKeywordsOnly, isDefault: false))
|
||||
viewModel = RoomNotificationSettingsScreenViewModel(notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
roomProxy: roomProxyMock)
|
||||
let deferred = deferFulfillment(context.$viewState.map(\.notificationSettingsState)
|
||||
@@ -58,7 +58,7 @@ class RoomNotificationSettingsScreenViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testInitialStateFailure() async throws {
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedActiveMembersCountThrowableError = NotificationSettingsError.Generic(message: "error")
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneThrowableError = NotificationSettingsError.Generic(message: "error")
|
||||
viewModel = RoomNotificationSettingsScreenViewModel(notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
roomProxy: roomProxyMock)
|
||||
let deferred = deferFulfillment(context.$viewState.map(\.notificationSettingsState)
|
||||
@@ -75,7 +75,7 @@ class RoomNotificationSettingsScreenViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testToggleAllCustomSettingOff() async throws {
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .mentionsAndKeywordsOnly, isDefault: false))
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .mentionsAndKeywordsOnly, isDefault: false))
|
||||
viewModel = RoomNotificationSettingsScreenViewModel(notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
roomProxy: roomProxyMock)
|
||||
let deferred = deferFulfillment(context.$viewState.map(\.notificationSettingsState)
|
||||
@@ -96,7 +96,7 @@ class RoomNotificationSettingsScreenViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testToggleAllCustomSettingOffOn() async throws {
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .mentionsAndKeywordsOnly, isDefault: true))
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .mentionsAndKeywordsOnly, isDefault: true))
|
||||
viewModel = RoomNotificationSettingsScreenViewModel(notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
roomProxy: roomProxyMock)
|
||||
var deferred = deferFulfillment(context.$viewState.map(\.notificationSettingsState).first(where: \.isLoaded))
|
||||
@@ -114,7 +114,7 @@ class RoomNotificationSettingsScreenViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testSetCustomMode() async throws {
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedActiveMembersCountReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .mentionsAndKeywordsOnly, isDefault: false))
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .mentionsAndKeywordsOnly, isDefault: false))
|
||||
viewModel = RoomNotificationSettingsScreenViewModel(notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
roomProxy: roomProxyMock)
|
||||
let deferredState = deferFulfillment(context.$viewState.map(\.notificationSettingsState).first(where: \.isLoaded))
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ include:
|
||||
packages:
|
||||
MatrixRustSDK:
|
||||
url: https://github.com/matrix-org/matrix-rust-components-swift
|
||||
exactVersion: 1.0.105-alpha
|
||||
exactVersion: 1.0.106-alpha
|
||||
# path: ../matrix-rust-sdk
|
||||
DesignKit:
|
||||
path: DesignKit
|
||||
|
||||
Reference in New Issue
Block a user