mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Run SwiftFormat.
This commit is contained in:
@@ -44,11 +44,11 @@ final class RoomDetailsScreenCoordinator: CoordinatorProtocol {
|
||||
|
||||
private let actionsSubject: PassthroughSubject<RoomDetailsScreenCoordinatorAction, Never> = .init()
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
|
||||
var actions: AnyPublisher<RoomDetailsScreenCoordinatorAction, Never> {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
|
||||
init(parameters: RoomDetailsScreenCoordinatorParameters) {
|
||||
isSpace = parameters.roomProxy.infoPublisher.value.isSpace
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: parameters.roomProxy,
|
||||
|
||||
@@ -45,7 +45,7 @@ struct RoomDetailsScreenViewState: BindableState {
|
||||
var isEncrypted: Bool
|
||||
var isDirect: Bool
|
||||
var permalink: URL?
|
||||
|
||||
|
||||
var topic: AttributedString?
|
||||
var topicSummary: AttributedString?
|
||||
|
||||
@@ -67,9 +67,9 @@ struct RoomDetailsScreenViewState: BindableState {
|
||||
|
||||
var isKnockableRoom = false
|
||||
var knockRequestsCount = 0
|
||||
|
||||
|
||||
var reportRoomEnabled = false
|
||||
|
||||
|
||||
var canSeeKnockingRequests: Bool {
|
||||
dmRecipientInfo == nil && isKnockableRoom && (canInviteUsers || canKickUsers || canBanUsers)
|
||||
}
|
||||
@@ -85,9 +85,9 @@ struct RoomDetailsScreenViewState: BindableState {
|
||||
var hasTopicSection: Bool {
|
||||
topic != nil || canEditRoomTopic
|
||||
}
|
||||
|
||||
|
||||
var bindings: RoomDetailsScreenViewStateBindings
|
||||
|
||||
|
||||
var dmRecipientInfo: DMRecipientInfo?
|
||||
var accountOwner: RoomMemberDetails?
|
||||
|
||||
@@ -135,31 +135,31 @@ struct RoomDetailsScreenViewStateBindings {
|
||||
case ignore
|
||||
case unignore
|
||||
}
|
||||
|
||||
|
||||
let action: Action
|
||||
let cancelTitle = L10n.actionCancel
|
||||
|
||||
|
||||
var title: String {
|
||||
switch action {
|
||||
case .ignore: return L10n.screenDmDetailsBlockUser
|
||||
case .unignore: return L10n.screenDmDetailsUnblockUser
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var confirmationTitle: String {
|
||||
switch action {
|
||||
case .ignore: return L10n.screenDmDetailsBlockAlertAction
|
||||
case .unignore: return L10n.screenDmDetailsUnblockAlertAction
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var description: String {
|
||||
switch action {
|
||||
case .ignore: return L10n.screenDmDetailsBlockAlertDescription
|
||||
case .unignore: return L10n.screenDmDetailsUnblockAlertDescription
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var viewAction: RoomDetailsScreenViewAction {
|
||||
switch action {
|
||||
case .ignore: return .ignoreConfirmed
|
||||
@@ -169,7 +169,7 @@ struct RoomDetailsScreenViewStateBindings {
|
||||
}
|
||||
|
||||
var isFavourite = false
|
||||
|
||||
|
||||
/// Information describing the currently displayed alert.
|
||||
var alertInfo: AlertInfo<RoomDetailsScreenErrorType>?
|
||||
var leaveRoomAlertItem: LeaveRoomAlertItem?
|
||||
@@ -188,7 +188,7 @@ struct LeaveRoomAlertItem: AlertProtocol {
|
||||
case `public`
|
||||
case `private`
|
||||
}
|
||||
|
||||
|
||||
let roomID: String
|
||||
let isDM: Bool
|
||||
let state: RoomState
|
||||
@@ -198,7 +198,7 @@ struct LeaveRoomAlertItem: AlertProtocol {
|
||||
var title: String {
|
||||
isDM ? L10n.actionLeaveConversation : L10n.actionLeaveRoom
|
||||
}
|
||||
|
||||
|
||||
var subtitle: String {
|
||||
switch state {
|
||||
case .empty: return L10n.leaveRoomAlertEmptySubtitle
|
||||
|
||||
@@ -19,7 +19,7 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
||||
private let notificationSettingsProxy: NotificationSettingsProxyProtocol
|
||||
private let attributedStringBuilder: AttributedStringBuilderProtocol
|
||||
private let appSettings: AppSettings
|
||||
|
||||
|
||||
private var pinnedEventsTimelineItemProvider: TimelineItemProviderProtocol? {
|
||||
didSet {
|
||||
guard let pinnedEventsTimelineItemProvider else {
|
||||
@@ -90,7 +90,7 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
||||
}
|
||||
|
||||
updateRoomInfo(roomProxy.infoPublisher.value)
|
||||
|
||||
|
||||
setupRoomSubscription()
|
||||
Task { await fetchMembersIfNeeded() }
|
||||
|
||||
@@ -421,9 +421,9 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
||||
analyticsService.trackInteraction(name: .MobileRoomFavouriteToggle)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static let leaveRoomLoadingID = "LeaveRoomLoading"
|
||||
|
||||
|
||||
private func leaveRoom() async {
|
||||
userIndicatorController.submitIndicator(UserIndicator(id: Self.leaveRoomLoadingID, type: .modal, title: L10n.commonLeavingRoom, persistent: true))
|
||||
let result = await roomProxy.leaveRoom()
|
||||
@@ -435,7 +435,7 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
||||
actionsSubject.send(.leftRoom)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private func ignore() async {
|
||||
guard let dmUserID = state.dmRecipientInfo?.member.id else {
|
||||
MXLog.error("Attempting to ignore a nil DM Recipient")
|
||||
@@ -456,7 +456,7 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
||||
state.bindings.alertInfo = .init(id: .unknown)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private func unignore() async {
|
||||
guard let dmUserID = state.dmRecipientInfo?.member.id else {
|
||||
MXLog.error("Attempting to unignore a nil DM Recipient")
|
||||
|
||||
@@ -17,7 +17,7 @@ struct RoomDetailsScreen: View {
|
||||
var body: some View {
|
||||
Form {
|
||||
roomHeaderSection
|
||||
|
||||
|
||||
topicSection
|
||||
|
||||
aboutSection
|
||||
@@ -32,9 +32,9 @@ struct RoomDetailsScreen: View {
|
||||
if context.viewState.dmRecipientInfo == nil {
|
||||
peopleSection
|
||||
}
|
||||
|
||||
|
||||
securitySection
|
||||
|
||||
|
||||
if let recipient = context.viewState.dmRecipientInfo?.member {
|
||||
ignoreUserSection(user: recipient)
|
||||
}
|
||||
@@ -147,7 +147,7 @@ struct RoomDetailsScreen: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private var aboutSection: some View {
|
||||
Section {
|
||||
ListRow(label: .default(title: L10n.screenMediaBrowserTitle, icon: \.image),
|
||||
@@ -245,7 +245,7 @@ struct RoomDetailsScreen: View {
|
||||
})
|
||||
.accessibilityIdentifier(A11yIdentifiers.roomDetailsScreen.people)
|
||||
}
|
||||
|
||||
|
||||
if context.viewState.canSeeKnockingRequests {
|
||||
ListRow(label: .default(title: L10n.screenRoomDetailsRequestsToJoinTitle, icon: \.askToJoin),
|
||||
details: context.viewState.knockRequestsCount > 0 ? .counter(context.viewState.knockRequestsCount) : nil,
|
||||
@@ -320,7 +320,7 @@ struct RoomDetailsScreen: View {
|
||||
.disabled(context.viewState.isProcessingIgnoreRequest)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ViewBuilder
|
||||
private func leaveRoomAlertActions(_ item: LeaveRoomAlertItem) -> some View {
|
||||
Button(item.cancelTitle, role: .cancel) { }
|
||||
@@ -328,11 +328,11 @@ struct RoomDetailsScreen: View {
|
||||
context.send(viewAction: .confirmLeave)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private func leaveRoomAlertMessage(_ item: LeaveRoomAlertItem) -> some View {
|
||||
Text(item.subtitle)
|
||||
}
|
||||
|
||||
|
||||
@ViewBuilder
|
||||
private func blockUserAlertActions(_ item: RoomDetailsScreenViewStateBindings.IgnoreUserAlertItem) -> some View {
|
||||
Button(item.cancelTitle, role: .cancel) { }
|
||||
@@ -341,7 +341,7 @@ struct RoomDetailsScreen: View {
|
||||
context.send(viewAction: item.viewAction)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private func blockUserAlertMessage(_ item: RoomDetailsScreenViewStateBindings.IgnoreUserAlertItem) -> some View {
|
||||
Text(item.description)
|
||||
}
|
||||
@@ -417,7 +417,7 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
|
||||
notificationSettingsProxyMockConfiguration.roomMode.isDefault = false
|
||||
|
||||
let notificationSettingsProxy = NotificationSettingsProxyMock(with: notificationSettingsProxyMockConfiguration)
|
||||
|
||||
|
||||
return .init(roomProxy: roomProxy,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
@@ -445,7 +445,7 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
|
||||
joinRule: .knock))
|
||||
|
||||
let notificationSettingsProxy = NotificationSettingsProxyMock(with: .init())
|
||||
|
||||
|
||||
return .init(roomProxy: roomProxy,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
@@ -483,7 +483,7 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
|
||||
}
|
||||
|
||||
let notificationSettingsProxy = NotificationSettingsProxyMock(with: .init())
|
||||
|
||||
|
||||
return .init(roomProxy: roomProxy,
|
||||
userSession: UserSessionMock(.init(clientProxy: clientProxyMock)),
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
|
||||
Reference in New Issue
Block a user