Configured and applied SwiftFormat

This commit is contained in:
Stefan Ceriu
2022-09-27 10:17:22 +03:00
committed by Stefan Ceriu
parent ff2e6ddfa7
commit 43c28d23b7
663 changed files with 2329 additions and 2840 deletions
@@ -16,11 +16,10 @@
limitations under the License.
*/
import Foundation
import Combine
import Foundation
class RoomNotificationSettingsViewModel: RoomNotificationSettingsViewModelType {
// MARK: - Properties
// MARK: Private
@@ -40,12 +39,10 @@ class RoomNotificationSettingsViewModel: RoomNotificationSettingsViewModelType {
// MARK: - Setup
init(
roomNotificationService: RoomNotificationSettingsServiceType,
initialState: RoomNotificationSettingsViewState
) {
init(roomNotificationService: RoomNotificationSettingsServiceType,
initialState: RoomNotificationSettingsViewState) {
self.roomNotificationService = roomNotificationService
self.state = initialState
state = initialState
self.roomNotificationService.observeNotificationState { [weak self] state in
guard let self = self else { return }
@@ -53,12 +50,10 @@ class RoomNotificationSettingsViewModel: RoomNotificationSettingsViewModelType {
}
}
convenience init(
roomNotificationService: RoomNotificationSettingsServiceType,
avatarData: AvatarProtocol?,
displayName: String?,
roomEncrypted: Bool
) {
convenience init(roomNotificationService: RoomNotificationSettingsServiceType,
avatarData: AvatarProtocol?,
displayName: String?,
roomEncrypted: Bool) {
let notificationState = Self.mapNotificationStateOnRead(encrypted: roomEncrypted, state: roomNotificationService.notificationState)
let initialState = RoomNotificationSettingsViewState(
@@ -71,16 +66,16 @@ class RoomNotificationSettingsViewModel: RoomNotificationSettingsViewModelType {
self.init(roomNotificationService: roomNotificationService, initialState: initialState)
}
// MARK: - Public
// MARK: - Public
func process(viewAction: RoomNotificationSettingsViewAction) {
switch viewAction {
case .load:
update(viewState: self.state)
update(viewState: state)
case .selectNotificationState(let state):
self.state.notificationState = state
case .save:
self.state.saving = true
state.saving = true
roomNotificationService.update(state: state.notificationState) { [weak self] in
guard let self = self else { return }
self.state.saving = false
@@ -103,6 +98,6 @@ class RoomNotificationSettingsViewModel: RoomNotificationSettingsViewModelType {
}
func update(viewState: RoomNotificationSettingsViewState) {
self.viewDelegate?.roomNotificationSettingsViewModel(self, didUpdateViewState: viewState)
viewDelegate?.roomNotificationSettingsViewModel(self, didUpdateViewState: viewState)
}
}