Change in behaviour: mute should actually mean mute on update now.

This commit is contained in:
langleyd
2021-07-04 17:06:19 +01:00
parent d225adfc47
commit 5d6bf6d8fe
@@ -61,8 +61,7 @@ final class RoomNotificationSettingsViewModel: RoomNotificationSettingsViewModel
self.state.notificationState = state
case .save:
self.state.saving = true
let updateState = Self.mapNotificationStateOnUpdate(encrypted: self.state.roomEncrypted, state: state.notificationState)
roomNotificationRepository.update(state: updateState) { [weak self] in
roomNotificationRepository.update(state: state.notificationState) { [weak self] in
guard let self = self else { return }
self.state.saving = false
self.coordinatorDelegate?.roomNotificationSettingsViewModelDidComplete(self)
@@ -83,15 +82,6 @@ final class RoomNotificationSettingsViewModel: RoomNotificationSettingsViewModel
}
}
private static func mapNotificationStateOnUpdate(encrypted: Bool, state: RoomNotificationState) -> RoomNotificationState {
if encrypted, case .mute = state {
// Notifications not supported on encrypted rooms, map mute to mentions only on update
return .mentionsOnly
} else {
return state
}
}
private func update(viewState: RoomNotificationSettingsViewStateType) {
self.viewDelegate?.roomNotificationSettingsViewModel(self, didUpdateViewState: viewState)
}