mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
element-hq/element-x-ios/issues/2670 - Show invites as part of the room list
This commit is contained in:
committed by
Stefan Ceriu
parent
d34ec30ca6
commit
064626fbbe
@@ -48,6 +48,9 @@ enum HomeScreenViewAction {
|
||||
case markRoomAsRead(roomIdentifier: String)
|
||||
case markRoomAsFavourite(roomIdentifier: String, isFavourite: Bool)
|
||||
case selectRoomDirectorySearch
|
||||
|
||||
case acceptInvite(roomIdentifier: String)
|
||||
case declineInvite(roomIdentifier: String)
|
||||
}
|
||||
|
||||
enum HomeScreenRoomListMode: CustomStringConvertible {
|
||||
@@ -130,6 +133,18 @@ struct HomeScreenViewStateBindings {
|
||||
}
|
||||
|
||||
struct HomeScreenRoom: Identifiable, Equatable {
|
||||
enum RoomType {
|
||||
case placeholder
|
||||
case room
|
||||
case invite
|
||||
}
|
||||
|
||||
struct InviterDetails: Equatable {
|
||||
let userID: String
|
||||
let displayName: String?
|
||||
let avatarURL: URL?
|
||||
}
|
||||
|
||||
static let placeholderLastMessage = AttributedString("Hidden last message")
|
||||
|
||||
/// The list item identifier can be a real room identifier, a custom one for invalidated entries
|
||||
@@ -139,9 +154,9 @@ struct HomeScreenRoom: Identifiable, Equatable {
|
||||
/// The real room identifier this item points to
|
||||
let roomId: String?
|
||||
|
||||
var name = ""
|
||||
let type: RoomType
|
||||
|
||||
var badges: Badges
|
||||
let badges: Badges
|
||||
struct Badges: Equatable {
|
||||
let isDotShown: Bool
|
||||
let isMentionShown: Bool
|
||||
@@ -149,28 +164,38 @@ struct HomeScreenRoom: Identifiable, Equatable {
|
||||
let isCallShown: Bool
|
||||
}
|
||||
|
||||
let name: String
|
||||
|
||||
let isDirect: Bool
|
||||
|
||||
let isHighlighted: Bool
|
||||
|
||||
let isFavourite: Bool
|
||||
|
||||
var timestamp: String?
|
||||
let timestamp: String?
|
||||
|
||||
var lastMessage: AttributedString?
|
||||
let lastMessage: AttributedString?
|
||||
|
||||
var avatarURL: URL?
|
||||
let avatarURL: URL?
|
||||
|
||||
var isPlaceholder = false
|
||||
let inviter: InviterDetails?
|
||||
|
||||
let canonicalAlias: String?
|
||||
|
||||
static func placeholder() -> HomeScreenRoom {
|
||||
HomeScreenRoom(id: UUID().uuidString,
|
||||
roomId: nil,
|
||||
name: "Placeholder room name",
|
||||
type: .placeholder,
|
||||
badges: .init(isDotShown: false, isMentionShown: false, isMuteShown: false, isCallShown: false),
|
||||
name: "Placeholder room name",
|
||||
isDirect: false,
|
||||
isHighlighted: false,
|
||||
isFavourite: false,
|
||||
timestamp: "Now",
|
||||
lastMessage: placeholderLastMessage,
|
||||
isPlaceholder: true)
|
||||
avatarURL: nil,
|
||||
inviter: nil,
|
||||
canonicalAlias: nil)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,17 +211,28 @@ extension HomeScreenRoom {
|
||||
let isCallShown = details.hasOngoingCall
|
||||
let isHighlighted = details.isMarkedUnread || (!details.isMuted && (details.hasUnreadNotifications || details.hasUnreadMentions))
|
||||
|
||||
var inviter: InviterDetails?
|
||||
if let roomMemberProxy = details.inviter {
|
||||
inviter = .init(userID: roomMemberProxy.userID,
|
||||
displayName: roomMemberProxy.displayName,
|
||||
avatarURL: roomMemberProxy.avatarURL)
|
||||
}
|
||||
|
||||
self.init(id: identifier,
|
||||
roomId: details.id,
|
||||
name: details.name,
|
||||
type: details.isInvite ? .invite : .room,
|
||||
badges: .init(isDotShown: isDotShown,
|
||||
isMentionShown: isMentionShown,
|
||||
isMuteShown: isMuteShown,
|
||||
isCallShown: isCallShown),
|
||||
name: details.name,
|
||||
isDirect: details.isDirect,
|
||||
isHighlighted: isHighlighted,
|
||||
isFavourite: details.isFavourite,
|
||||
timestamp: details.lastMessageFormattedTimestamp,
|
||||
lastMessage: details.lastMessage,
|
||||
avatarURL: details.avatarURL)
|
||||
avatarURL: details.avatarURL,
|
||||
inviter: inviter,
|
||||
canonicalAlias: details.canonicalAlias)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,6 +183,12 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
}
|
||||
case .selectRoomDirectorySearch:
|
||||
actionsSubject.send(.presentRoomDirectorySearch)
|
||||
case .acceptInvite(let roomIdentifier):
|
||||
Task {
|
||||
await acceptInvite(roomID: roomIdentifier)
|
||||
}
|
||||
case .declineInvite(let roomIdentifier):
|
||||
showDeclineInviteConfirmationAlert(roomID: roomIdentifier)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -446,4 +452,69 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Invites
|
||||
|
||||
private func acceptInvite(roomID: String) async {
|
||||
defer {
|
||||
userIndicatorController.retractIndicatorWithId(roomID)
|
||||
}
|
||||
|
||||
userIndicatorController.submitIndicator(UserIndicator(id: roomID, type: .modal, title: L10n.commonLoading, persistent: true))
|
||||
|
||||
guard let roomProxy = await userSession.clientProxy.roomForIdentifier(roomID) else {
|
||||
displayError()
|
||||
return
|
||||
}
|
||||
|
||||
switch await roomProxy.acceptInvitation() {
|
||||
case .success:
|
||||
actionsSubject.send(.presentRoom(roomIdentifier: roomID))
|
||||
analyticsService.trackJoinedRoom(isDM: roomProxy.isDirect, isSpace: roomProxy.isSpace, activeMemberCount: UInt(roomProxy.activeMembersCount))
|
||||
case .failure:
|
||||
displayError()
|
||||
}
|
||||
}
|
||||
|
||||
private func showDeclineInviteConfirmationAlert(roomID: String) {
|
||||
guard let room = state.rooms.first(where: { $0.id == roomID }) else {
|
||||
displayError()
|
||||
return
|
||||
}
|
||||
|
||||
let roomPlaceholder = room.isDirect ? (room.inviter?.displayName ?? room.name) : room.name
|
||||
let title = room.isDirect ? L10n.screenInvitesDeclineDirectChatTitle : L10n.screenInvitesDeclineChatTitle
|
||||
let message = room.isDirect ? L10n.screenInvitesDeclineDirectChatMessage(roomPlaceholder) : L10n.screenInvitesDeclineChatMessage(roomPlaceholder)
|
||||
|
||||
state.bindings.alertInfo = .init(id: UUID(),
|
||||
title: title,
|
||||
message: message,
|
||||
primaryButton: .init(title: L10n.actionCancel, role: .cancel, action: nil),
|
||||
secondaryButton: .init(title: L10n.actionDecline, role: .destructive, action: { Task { await self.declineInvite(roomID: room.id) } }))
|
||||
}
|
||||
|
||||
private func declineInvite(roomID: String) async {
|
||||
defer {
|
||||
userIndicatorController.retractIndicatorWithId(roomID)
|
||||
}
|
||||
|
||||
userIndicatorController.submitIndicator(UserIndicator(id: roomID, type: .modal, title: L10n.commonLoading, persistent: true))
|
||||
|
||||
guard let roomProxy = await userSession.clientProxy.roomForIdentifier(roomID) else {
|
||||
displayError()
|
||||
return
|
||||
}
|
||||
|
||||
let result = await roomProxy.rejectInvitation()
|
||||
|
||||
if case .failure = result {
|
||||
displayError()
|
||||
}
|
||||
}
|
||||
|
||||
private func displayError() {
|
||||
state.bindings.alertInfo = .init(id: UUID(),
|
||||
title: L10n.commonError,
|
||||
message: L10n.errorUnknown)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,15 @@ enum RoomListFilter: Int, CaseIterable, Identifiable {
|
||||
case people
|
||||
case rooms
|
||||
case favourites
|
||||
case invites
|
||||
|
||||
static var availableFilters: [RoomListFilter] {
|
||||
if ServiceLocator.shared.settings.roomListInvitesEnabled {
|
||||
return RoomListFilter.allCases
|
||||
} else {
|
||||
return RoomListFilter.allCases.filter { !($0 == .invites) }
|
||||
}
|
||||
}
|
||||
|
||||
var localizedName: String {
|
||||
switch self {
|
||||
@@ -40,20 +49,24 @@ enum RoomListFilter: Int, CaseIterable, Identifiable {
|
||||
return L10n.screenRoomlistFilterUnreads
|
||||
case .favourites:
|
||||
return L10n.screenRoomlistFilterFavourites
|
||||
case .invites:
|
||||
return L10n.screenRoomlistFilterInvites
|
||||
}
|
||||
}
|
||||
|
||||
var incompatibleFilter: RoomListFilter? {
|
||||
var incompatibleFilters: [RoomListFilter] {
|
||||
switch self {
|
||||
case .people:
|
||||
return .rooms
|
||||
return [.rooms, .invites]
|
||||
case .rooms:
|
||||
return .people
|
||||
return [.people, .invites]
|
||||
case .unreads:
|
||||
return nil
|
||||
return [.invites]
|
||||
case .favourites:
|
||||
// When we will have Low Priority we may need to return it here
|
||||
return nil
|
||||
return [.invites]
|
||||
case .invites:
|
||||
return [.rooms, .people, .unreads, .favourites]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +80,8 @@ enum RoomListFilter: Int, CaseIterable, Identifiable {
|
||||
return .unread
|
||||
case .favourites:
|
||||
return .favourite
|
||||
case .invites:
|
||||
return .invite
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,13 +94,13 @@ struct RoomListFiltersState {
|
||||
}
|
||||
|
||||
var availableFilters: [RoomListFilter] {
|
||||
var availableFilters = OrderedSet(RoomListFilter.allCases)
|
||||
var availableFilters = OrderedSet(RoomListFilter.availableFilters)
|
||||
|
||||
for filter in activeFilters {
|
||||
availableFilters.remove(filter)
|
||||
if let incompatibleFilter = filter.incompatibleFilter {
|
||||
availableFilters.remove(incompatibleFilter)
|
||||
}
|
||||
filter.incompatibleFilters.forEach { availableFilters.remove($0) }
|
||||
}
|
||||
|
||||
return availableFilters.elements
|
||||
}
|
||||
|
||||
@@ -94,10 +109,12 @@ struct RoomListFiltersState {
|
||||
}
|
||||
|
||||
mutating func activateFilter(_ filter: RoomListFilter) {
|
||||
if let incompatibleFilter = filter.incompatibleFilter,
|
||||
activeFilters.contains(incompatibleFilter) {
|
||||
fatalError("[RoomListFiltersState] adding mutually exclusive filters is not allowed")
|
||||
filter.incompatibleFilters.forEach { incompatibleFilter in
|
||||
if activeFilters.contains(incompatibleFilter) {
|
||||
fatalError("[RoomListFiltersState] adding mutually exclusive filters is not allowed")
|
||||
}
|
||||
}
|
||||
|
||||
// We always want the most recently enabled filter to be at the bottom of the others.
|
||||
activeFilters.append(filter)
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ struct RoomListFiltersEmptyStateView: View {
|
||||
return L10n.screenRoomlistFilterRoomsEmptyStateTitle
|
||||
case .favourites:
|
||||
return L10n.screenRoomlistFilterFavouritesEmptyStateTitle
|
||||
case .invites:
|
||||
return L10n.screenRoomlistFilterInvitesEmptyStateTitle
|
||||
}
|
||||
}
|
||||
return L10n.screenRoomlistFilterMixedEmptyStateTitle
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
//
|
||||
// Copyright 2024 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
@MainActor
|
||||
struct HomeScreenInviteCell: View {
|
||||
@Environment(\.dynamicTypeSize) var dynamicTypeSize
|
||||
|
||||
let room: HomeScreenRoom
|
||||
let context: HomeScreenViewModel.Context
|
||||
|
||||
var body: some View {
|
||||
HStack(alignment: .top, spacing: 16) {
|
||||
if dynamicTypeSize < .accessibility3 {
|
||||
LoadableAvatarImage(url: room.avatarURL,
|
||||
name: title,
|
||||
contentID: room.id,
|
||||
avatarSize: .custom(52),
|
||||
imageProvider: context.imageProvider)
|
||||
.dynamicTypeSize(dynamicTypeSize < .accessibility1 ? dynamicTypeSize : .accessibility1)
|
||||
.accessibilityHidden(true)
|
||||
}
|
||||
|
||||
mainContent
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(.bottom, 16)
|
||||
.padding(.trailing, 16)
|
||||
.overlay(alignment: .bottom) {
|
||||
separator
|
||||
}
|
||||
}
|
||||
.padding(.top, 12)
|
||||
.padding(.leading, 16)
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private var mainContent: some View {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
HStack(alignment: .firstTextBaseline, spacing: 16) {
|
||||
textualContent
|
||||
badge
|
||||
}
|
||||
|
||||
inviterView
|
||||
.padding(.top, 6)
|
||||
.padding(.trailing, 16)
|
||||
|
||||
buttons
|
||||
.padding(.top, 14)
|
||||
.padding(.trailing, 22)
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var inviterView: some View {
|
||||
if let invitedText = attributedInviteText, let name = room.inviter?.displayName {
|
||||
HStack(alignment: .firstTextBaseline, spacing: 8) {
|
||||
LoadableAvatarImage(url: room.inviter?.avatarURL,
|
||||
name: name,
|
||||
contentID: name,
|
||||
avatarSize: .custom(16),
|
||||
imageProvider: context.imageProvider)
|
||||
.alignmentGuide(.firstTextBaseline) { $0[.bottom] * 0.8 }
|
||||
|
||||
Text(invitedText)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var textualContent: some View {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
Text(title)
|
||||
.font(.compound.bodyLGSemibold)
|
||||
.foregroundColor(.compound.textPrimary)
|
||||
.lineLimit(2)
|
||||
|
||||
if let subtitle {
|
||||
Text(subtitle)
|
||||
.font(.compound.bodyMD)
|
||||
.foregroundColor(.compound.textPlaceholder)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
private var buttons: some View {
|
||||
HStack(spacing: 12) {
|
||||
Button(L10n.actionDecline) {
|
||||
context.send(viewAction: .declineInvite(roomIdentifier: room.id))
|
||||
}
|
||||
.buttonStyle(.compound(.secondary, size: .medium))
|
||||
.accessibilityIdentifier(A11yIdentifiers.invitesScreen.decline)
|
||||
|
||||
Button(L10n.actionAccept) {
|
||||
context.send(viewAction: .acceptInvite(roomIdentifier: room.id))
|
||||
}
|
||||
.buttonStyle(.compound(.primary, size: .medium))
|
||||
.accessibilityIdentifier(A11yIdentifiers.invitesScreen.accept)
|
||||
}
|
||||
}
|
||||
|
||||
private var separator: some View {
|
||||
Rectangle()
|
||||
.fill(Color.compound.borderDisabled)
|
||||
.frame(height: 1 / UIScreen.main.scale)
|
||||
}
|
||||
|
||||
private var title: String {
|
||||
room.name
|
||||
}
|
||||
|
||||
private var subtitle: String? {
|
||||
room.isDirect ? room.inviter?.userID : room.canonicalAlias
|
||||
}
|
||||
|
||||
private var attributedInviteText: AttributedString? {
|
||||
guard
|
||||
room.isDirect == false,
|
||||
let inviterName = room.inviter?.displayName,
|
||||
let inviterID = room.inviter?.userID
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
|
||||
let text = L10n.screenInvitesInvitedYou(inviterName, inviterID)
|
||||
var attributedString = AttributedString(text)
|
||||
attributedString.font = .compound.bodyMD
|
||||
attributedString.foregroundColor = .compound.textPlaceholder
|
||||
if let range = attributedString.range(of: inviterName) {
|
||||
attributedString[range].foregroundColor = .compound.textPrimary
|
||||
attributedString[range].font = .compound.bodyMDSemibold
|
||||
}
|
||||
return attributedString
|
||||
}
|
||||
|
||||
private var badge: some View {
|
||||
Circle()
|
||||
.scaledFrame(size: 12)
|
||||
.foregroundColor(.compound.iconAccentTertiary)
|
||||
}
|
||||
}
|
||||
|
||||
struct HomeScreenInviteCell_Previews: PreviewProvider, TestablePreview {
|
||||
static var previews: some View {
|
||||
ScrollView {
|
||||
VStack(spacing: 0) {
|
||||
HomeScreenInviteCell(room: .dmInvite,
|
||||
context: viewModel().context)
|
||||
|
||||
HomeScreenInviteCell(room: .dmInvite,
|
||||
context: viewModel().context)
|
||||
|
||||
HomeScreenInviteCell(room: .roomInvite(),
|
||||
context: viewModel().context)
|
||||
|
||||
HomeScreenInviteCell(room: .roomInvite(),
|
||||
context: viewModel().context)
|
||||
|
||||
HomeScreenInviteCell(room: .roomInvite(alias: "#footest:somewhere.org", avatarURL: .picturesDirectory),
|
||||
context: viewModel().context)
|
||||
|
||||
HomeScreenInviteCell(room: .roomInvite(alias: "#footest:somewhere.org"),
|
||||
context: viewModel().context)
|
||||
.dynamicTypeSize(.accessibility1)
|
||||
.previewDisplayName("Aliased room (AX1)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static func viewModel() -> HomeScreenViewModel {
|
||||
let clientProxy = ClientProxyMock(.init())
|
||||
|
||||
let userSession = MockUserSession(clientProxy: clientProxy,
|
||||
mediaProvider: MockMediaProvider(),
|
||||
voiceMessageMediaManager: VoiceMessageMediaManagerMock())
|
||||
|
||||
return HomeScreenViewModel(userSession: userSession,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController)
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
private extension HomeScreenRoom {
|
||||
static var dmInvite: HomeScreenRoom {
|
||||
let inviter = RoomMemberProxyMock()
|
||||
inviter.displayName = "Jack"
|
||||
inviter.userID = "@jack:somewhere.com"
|
||||
|
||||
let details = RoomSummaryDetails(id: "@someone:somewhere.com",
|
||||
isInvite: false,
|
||||
inviter: inviter,
|
||||
name: "Some Guy",
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: "#footest:somewhere.org",
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)
|
||||
|
||||
return .init(details: details, invalidated: false, hideUnreadMessagesBadge: false)
|
||||
}
|
||||
|
||||
static func roomInvite(alias: String? = nil, avatarURL: URL? = nil) -> HomeScreenRoom {
|
||||
let inviter = RoomMemberProxyMock()
|
||||
inviter.displayName = "Luca"
|
||||
inviter.userID = "@jack:somewhi.nl"
|
||||
inviter.avatarURL = avatarURL
|
||||
|
||||
let details = RoomSummaryDetails(id: "@someone:somewhere.com",
|
||||
isInvite: false,
|
||||
inviter: inviter,
|
||||
name: "Awesome Room",
|
||||
isDirect: false,
|
||||
avatarURL: avatarURL,
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
unreadMessagesCount: 0,
|
||||
unreadMentionsCount: 0,
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: alias,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)
|
||||
|
||||
return .init(details: details, invalidated: false, hideUnreadMessagesBadge: false)
|
||||
}
|
||||
}
|
||||
@@ -35,10 +35,13 @@ struct HomeScreenRoomList: View {
|
||||
@ViewBuilder
|
||||
private var content: some View {
|
||||
ForEach(context.viewState.visibleRooms) { room in
|
||||
if room.isPlaceholder {
|
||||
switch room.type {
|
||||
case .placeholder:
|
||||
HomeScreenRoomCell(room: room, context: context, isSelected: false)
|
||||
.redacted(reason: .placeholder)
|
||||
} else {
|
||||
case .invite:
|
||||
HomeScreenInviteCell(room: room, context: context)
|
||||
case .room:
|
||||
let isSelected = context.viewState.selectedRoomID == room.id
|
||||
|
||||
HomeScreenRoomCell(room: room, context: context, isSelected: isSelected)
|
||||
|
||||
@@ -181,6 +181,8 @@ private extension InvitesScreenRoomDetails {
|
||||
inviter.userID = "@jack:somewhere.com"
|
||||
|
||||
let dmRoom = RoomSummaryDetails(id: "@someone:somewhere.com",
|
||||
isInvite: false,
|
||||
inviter: inviter,
|
||||
name: "Some Guy",
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
@@ -191,7 +193,6 @@ private extension InvitesScreenRoomDetails {
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: "#footest:somewhere.org",
|
||||
inviter: inviter,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)
|
||||
@@ -205,6 +206,8 @@ private extension InvitesScreenRoomDetails {
|
||||
inviter.avatarURL = avatarURL
|
||||
|
||||
let dmRoom = RoomSummaryDetails(id: "@someone:somewhere.com",
|
||||
isInvite: false,
|
||||
inviter: inviter,
|
||||
name: "Awesome Room",
|
||||
isDirect: false,
|
||||
avatarURL: avatarURL,
|
||||
@@ -215,7 +218,6 @@ private extension InvitesScreenRoomDetails {
|
||||
unreadNotificationsCount: 0,
|
||||
notificationMode: nil,
|
||||
canonicalAlias: alias,
|
||||
inviter: inviter,
|
||||
hasOngoingCall: false,
|
||||
isMarkedUnread: false,
|
||||
isFavourite: false)
|
||||
|
||||
+1
@@ -51,6 +51,7 @@ protocol DeveloperOptionsProtocol: AnyObject {
|
||||
var elementCallBaseURL: URL { get set }
|
||||
var publicSearchEnabled: Bool { get set }
|
||||
var qrCodeLoginEnabled: Bool { get set }
|
||||
var roomListInvitesEnabled: Bool { get set }
|
||||
}
|
||||
|
||||
extension AppSettings: DeveloperOptionsProtocol { }
|
||||
|
||||
+11
-6
@@ -32,16 +32,15 @@ struct DeveloperOptionsScreen: View {
|
||||
}
|
||||
}
|
||||
|
||||
Section("Room") {
|
||||
Toggle(isOn: $context.shouldCollapseRoomStateEvents) {
|
||||
Text("Collapse room state events")
|
||||
}
|
||||
}
|
||||
|
||||
Section("Room List") {
|
||||
Toggle(isOn: $context.hideUnreadMessagesBadge) {
|
||||
Text("Hide grey dots")
|
||||
}
|
||||
|
||||
Toggle(isOn: $context.roomListInvitesEnabled) {
|
||||
Text("Room list invites")
|
||||
Text("Requires app reboot and, after disabling the feature, a cache clear.")
|
||||
}
|
||||
}
|
||||
|
||||
Section("Room Directory Search") {
|
||||
@@ -56,6 +55,12 @@ struct DeveloperOptionsScreen: View {
|
||||
}
|
||||
}
|
||||
|
||||
Section("Room") {
|
||||
Toggle(isOn: $context.shouldCollapseRoomStateEvents) {
|
||||
Text("Collapse room state events")
|
||||
}
|
||||
}
|
||||
|
||||
Section("Element Call") {
|
||||
TextField(context.elementCallBaseURL.absoluteString, text: $elementCallBaseURLString)
|
||||
.submitLabel(.done)
|
||||
|
||||
Reference in New Issue
Block a user