mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 11:58:32 +00:00
fb49f5b83b
Add the element-call-ios dependency and a developer option for native calls The package carries the call UI and the matrix-rust-rtc media stack, pinned by exact version the way the SDK is, with the local path kept commented out for working against a checkout. Its media xcframework has no Intel simulator slice and a package cannot say so for the projects that consume it, hence the excluded architecture at the project level. The developer option is off by default and nothing reads it yet. It is placed next to the Element Call URL override, which only applies to the web view that native calls replace.
99 lines
2.6 KiB
Swift
99 lines
2.6 KiB
Swift
//
|
|
// Copyright 2026 Element Creations Ltd.
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
|
// Please see LICENSE files in the repository root for full details.
|
|
//
|
|
|
|
import Foundation
|
|
import MatrixRustSDK
|
|
|
|
enum SpaceAddRoomsScreenViewModelAction {
|
|
case dismiss
|
|
}
|
|
|
|
struct SpaceAddRoomsScreenViewState: BindableState {
|
|
var roomsSection: Section
|
|
var selectedRooms: [SpaceAddRoomsScreenRoom] = []
|
|
|
|
var bindings = SpaceAddRoomsScreenViewStateBindings()
|
|
|
|
struct Section {
|
|
nonisolated enum SectionType: Equatable { case searchResults, suggestions }
|
|
let type: SectionType
|
|
|
|
let rooms: [SpaceAddRoomsScreenRoom]
|
|
|
|
var title: String? {
|
|
switch type {
|
|
case .searchResults:
|
|
return nil
|
|
case .suggestions:
|
|
return rooms.isEmpty ? nil : L10n.commonSuggestions
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
struct SpaceAddRoomsScreenViewStateBindings {
|
|
var searchQuery = ""
|
|
var selectedRoomsPosition: String?
|
|
}
|
|
|
|
enum SpaceAddRoomsScreenViewAction {
|
|
case cancel
|
|
case reachedTop
|
|
case reachedBottom
|
|
case searchQueryChanged
|
|
case toggleRoom(SpaceAddRoomsScreenRoom)
|
|
case save
|
|
}
|
|
|
|
struct SpaceAddRoomsScreenRoom: Identifiable, Equatable {
|
|
let id: String
|
|
let title: String
|
|
let description: String
|
|
let avatar: RoomAvatar
|
|
}
|
|
|
|
extension SpaceAddRoomsScreenRoom {
|
|
init(summary: RoomSummary) {
|
|
self.init(id: summary.id,
|
|
title: summary.name,
|
|
description: summary.roomListDescription,
|
|
avatar: summary.avatar)
|
|
}
|
|
|
|
init(roomProxy: JoinedRoomProxyProtocol) {
|
|
self.init(id: roomProxy.id,
|
|
title: roomProxy.infoPublisher.value.displayNameOrID,
|
|
description: roomProxy.infoPublisher.value.roomListDescription,
|
|
avatar: roomProxy.infoPublisher.value.avatar)
|
|
}
|
|
}
|
|
|
|
private extension RoomInfoProxyProtocol {
|
|
var roomListDescription: String {
|
|
if isDirect {
|
|
return canonicalAlias ?? ""
|
|
}
|
|
|
|
if let alias = canonicalAlias {
|
|
return alias
|
|
}
|
|
|
|
guard !heroes.isEmpty else {
|
|
return ""
|
|
}
|
|
|
|
var heroComponents = heroes.compactMap(\.displayName)
|
|
|
|
let othersCount = Int(activeMembersCount) - heroes.count
|
|
if othersCount > 0 {
|
|
heroComponents.append(L10n.commonManyMembers(othersCount))
|
|
}
|
|
|
|
return heroComponents.formatted(.list(type: .and))
|
|
}
|
|
}
|