mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 16:13:42 +02:00
Configured and applied SwiftFormat
This commit is contained in:
committed by
Stefan Ceriu
parent
ff2e6ddfa7
commit
43c28d23b7
+8
-9
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -14,12 +14,11 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
import Foundation
|
||||
import MatrixSDK
|
||||
|
||||
class SpaceSelectorService: SpaceSelectorServiceProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -65,7 +64,7 @@ class SpaceSelectorService: SpaceSelectorServiceProtocol {
|
||||
|
||||
var itemList: [SpaceSelectorListItemData] = []
|
||||
itemList.append(contentsOf: invitedSpaces)
|
||||
if showHomeSpace && parentSpaceId == nil {
|
||||
if showHomeSpace, parentSpaceId == nil {
|
||||
itemList.append(SpaceSelectorListItemData(id: SpaceSelectorConstants.homeSpaceId, icon: Asset.Images.sideMenuActionIconFeedback.image, displayName: VectorL10n.allChatsTitle, isJoined: true))
|
||||
}
|
||||
itemList.append(contentsOf: joinedSpaces)
|
||||
@@ -93,14 +92,14 @@ class SpaceSelectorService: SpaceSelectorServiceProtocol {
|
||||
self.session = session
|
||||
self.parentSpaceId = parentSpaceId
|
||||
self.showHomeSpace = showHomeSpace
|
||||
self.spaceListSubject = CurrentValueSubject([])
|
||||
self.parentSpaceNameSubject = CurrentValueSubject(nil)
|
||||
spaceListSubject = CurrentValueSubject([])
|
||||
parentSpaceNameSubject = CurrentValueSubject(nil)
|
||||
self.selectedSpaceId = selectedSpaceId
|
||||
|
||||
spaceListSubject.send(spaceList)
|
||||
parentSpaceNameSubject.send(parentSpaceName)
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(self.spaceServiceDidUpdate), name: MXSpaceService.didBuildSpaceGraph, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(spaceServiceDidUpdate), name: MXSpaceService.didBuildSpaceGraph, object: nil)
|
||||
}
|
||||
|
||||
@objc private func spaceServiceDidUpdate() {
|
||||
@@ -108,7 +107,7 @@ class SpaceSelectorService: SpaceSelectorServiceProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate extension SpaceSelectorListItemData {
|
||||
private extension SpaceSelectorListItemData {
|
||||
static func itemData(with space: MXSpace, notificationCounter: MXSpaceNotificationCounter) -> SpaceSelectorListItemData? {
|
||||
guard let summary = space.summary else {
|
||||
return nil
|
||||
@@ -116,7 +115,7 @@ fileprivate extension SpaceSelectorListItemData {
|
||||
|
||||
let notificationState = notificationCounter.notificationState(forSpaceWithId: space.spaceId)
|
||||
|
||||
return SpaceSelectorListItemData(id:summary.roomId,
|
||||
return SpaceSelectorListItemData(id: summary.roomId,
|
||||
avatar: summary.room.avatarData,
|
||||
displayName: summary.displayname,
|
||||
notificationCount: notificationState?.groupMissedDiscussionsCount ?? 0,
|
||||
|
||||
+4
-5
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -14,12 +14,11 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
class MockSpaceSelectorService: SpaceSelectorServiceProtocol {
|
||||
|
||||
static let homeItem = SpaceSelectorListItemData(id: SpaceSelectorConstants.homeSpaceId, avatar: nil, icon: UIImage(systemName: "house"), displayName: "All Chats", notificationCount: 0, highlightedNotificationCount: 0, hasSubItems: false)
|
||||
static let defaultSpaceList = [
|
||||
homeItem,
|
||||
@@ -35,8 +34,8 @@ class MockSpaceSelectorService: SpaceSelectorServiceProtocol {
|
||||
var selectedSpaceId: String?
|
||||
|
||||
init(spaceList: [SpaceSelectorListItemData] = defaultSpaceList, parentSpaceName: String? = nil, selectedSpaceId: String = SpaceSelectorConstants.homeSpaceId) {
|
||||
self.spaceListSubject = CurrentValueSubject(spaceList)
|
||||
self.parentSpaceNameSubject = CurrentValueSubject(parentSpaceName)
|
||||
spaceListSubject = CurrentValueSubject(spaceList)
|
||||
parentSpaceNameSubject = CurrentValueSubject(parentSpaceName)
|
||||
self.selectedSpaceId = selectedSpaceId
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
import Foundation
|
||||
|
||||
protocol SpaceSelectorServiceProtocol {
|
||||
var spaceListSubject: CurrentValueSubject<[SpaceSelectorListItemData], Never> { get }
|
||||
|
||||
Reference in New Issue
Block a user