mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Knocked Preview implementation (#3426)
* JoinRoomScreen ui for knocking * code improvement * updated previews * added knocked state with tests * send knock request * Apply suggestions from code review Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> * pr comments * update tests * new API * knock implementation and cancel knock * update strings * added a knocked cell in the home screen * design update * updated SDK * simplified the invite case code * pr comments * updated previews * added message as reason * updated strings * fixing tests --------- Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// Copyright 2022-2024 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
// Please see LICENSE in the repository root for full details.
|
||||
//
|
||||
|
||||
import Combine
|
||||
import Compound
|
||||
import SwiftUI
|
||||
|
||||
struct RoomHeaderView: View {
|
||||
let roomName: String
|
||||
let roomAvatar: RoomAvatar
|
||||
|
||||
let mediaProvider: MediaProviderProtocol?
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 12) {
|
||||
avatarImage
|
||||
.accessibilityHidden(true)
|
||||
Text(roomName)
|
||||
.lineLimit(1)
|
||||
.font(.compound.bodyLGSemibold)
|
||||
.accessibilityIdentifier(A11yIdentifiers.roomScreen.name)
|
||||
}
|
||||
// Take up as much space as possible, with a leading alignment for use in the principal toolbar position.
|
||||
.frame(idealWidth: .greatestFiniteMagnitude, maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
private var avatarImage: some View {
|
||||
RoomAvatarImage(avatar: roomAvatar,
|
||||
avatarSize: .room(on: .timeline),
|
||||
mediaProvider: mediaProvider)
|
||||
.accessibilityIdentifier(A11yIdentifiers.roomScreen.avatar)
|
||||
}
|
||||
}
|
||||
|
||||
struct RoomHeaderView_Previews: PreviewProvider, TestablePreview {
|
||||
static var previews: some View {
|
||||
RoomHeaderView(roomName: "Some Room name",
|
||||
roomAvatar: .room(id: "1",
|
||||
name: "Some Room Name",
|
||||
avatarURL: URL.picturesDirectory),
|
||||
mediaProvider: MediaProviderMock(configuration: .init()))
|
||||
.previewLayout(.sizeThatFits)
|
||||
.padding()
|
||||
|
||||
RoomHeaderView(roomName: "Some Room name",
|
||||
roomAvatar: .room(id: "1",
|
||||
name: "Some Room Name",
|
||||
avatarURL: nil),
|
||||
mediaProvider: MediaProviderMock(configuration: .init()))
|
||||
.previewLayout(.sizeThatFits)
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user