mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 20:39:24 +00:00
call: Only group voice/video call if threads developer option is on
This commit is contained in:
@@ -159,6 +159,9 @@ enum A11yIdentifiers {
|
||||
let joinCall = "room-join_call"
|
||||
let scrollToBottom = "room-scroll_to_bottom"
|
||||
|
||||
let startVoiceCall = "room-start_voice_call"
|
||||
let startVideoCall = "room-start_video_call"
|
||||
|
||||
let messageComposer = "room-message_composer"
|
||||
let sendButton = "room-send_button"
|
||||
|
||||
|
||||
@@ -23,24 +23,45 @@ struct RoomCallControlsToolbar: ToolbarContent {
|
||||
}
|
||||
} else {
|
||||
if viewState.isDirectOneToOneRoom {
|
||||
ToolbarItem(placement: .primaryAction) {
|
||||
Menu {
|
||||
Button {
|
||||
onCallTap(true)
|
||||
if viewState.roomThreadListEnabled {
|
||||
// If the developer mode room thread list option is enabled there
|
||||
// is not enough place for 2 calls buttons
|
||||
ToolbarItem(placement: .primaryAction) {
|
||||
Menu {
|
||||
Button {
|
||||
onCallTap(true)
|
||||
} label: {
|
||||
Label(L10n.a11yStartVoiceCall, icon: \.voiceCallSolid)
|
||||
}
|
||||
|
||||
Button {
|
||||
onCallTap(false)
|
||||
} label: {
|
||||
Label(L10n.a11yStartVideoCall, icon: \.videoCallSolid)
|
||||
}
|
||||
} label: {
|
||||
Label(L10n.a11yStartVoiceCall, icon: \.voiceCallSolid)
|
||||
CompoundIcon(\.voiceCallSolid)
|
||||
}
|
||||
|
||||
Button {
|
||||
onCallTap(false)
|
||||
} label: {
|
||||
Label(L10n.a11yStartVideoCall, icon: \.videoCallSolid)
|
||||
}
|
||||
} label: {
|
||||
CompoundIcon(\.voiceCallSolid)
|
||||
.accessibilityLabel(L10n.a11yStartCall)
|
||||
.disabled(!viewState.canJoinCall)
|
||||
}
|
||||
} else {
|
||||
ToolbarItem(placement: .primaryAction) {
|
||||
Button { onCallTap(true) } label: {
|
||||
CompoundIcon(\.voiceCallSolid)
|
||||
}
|
||||
.accessibilityLabel(L10n.a11yStartVoiceCall)
|
||||
.accessibilityIdentifier(A11yIdentifiers.roomScreen.startVoiceCall)
|
||||
.disabled(!viewState.canJoinCall)
|
||||
}
|
||||
ToolbarItem(placement: .primaryAction) {
|
||||
Button { onCallTap(false) } label: {
|
||||
CompoundIcon(\.videoCallSolid)
|
||||
}
|
||||
.accessibilityLabel(L10n.a11yStartVideoCall)
|
||||
.accessibilityIdentifier(A11yIdentifiers.roomScreen.startVideoCall)
|
||||
.disabled(!viewState.canJoinCall)
|
||||
}
|
||||
.accessibilityLabel(L10n.a11yStartCall)
|
||||
.disabled(!viewState.canJoinCall)
|
||||
}
|
||||
} else {
|
||||
ToolbarItem(placement: .primaryAction) {
|
||||
@@ -66,6 +87,10 @@ struct RoomCallControlsToolbar_Previews: PreviewProvider {
|
||||
ElementNavigationStack {
|
||||
Color.clear.toolbar { RoomCallControlsToolbar(viewState: .mock(hasOngoingCall: false, isDirectOneToOneRoom: true)) { _ in } }
|
||||
}
|
||||
|
||||
ElementNavigationStack {
|
||||
Color.clear.toolbar { RoomCallControlsToolbar(viewState: .mock(hasOngoingCall: false, isDirectOneToOneRoom: true, roomThreadListEnabled: true)) { _ in } }
|
||||
}
|
||||
ElementNavigationStack {
|
||||
Color.clear.toolbar { RoomCallControlsToolbar(viewState: .mock(hasOngoingCall: false)) { _ in } }
|
||||
}
|
||||
@@ -81,12 +106,13 @@ struct RoomCallControlsToolbar_Previews: PreviewProvider {
|
||||
}
|
||||
|
||||
private extension RoomScreenViewState {
|
||||
static func mock(hasOngoingCall: Bool, isDirectOneToOneRoom: Bool = false, canJoinCall: Bool = true, activeRoomCallIntent: CallIntent? = nil) -> RoomScreenViewState {
|
||||
static func mock(hasOngoingCall: Bool, isDirectOneToOneRoom: Bool = false, canJoinCall: Bool = true, activeRoomCallIntent: CallIntent? = nil, roomThreadListEnabled: Bool = false) -> RoomScreenViewState {
|
||||
RoomScreenViewState(roomAvatar: .room(id: "mock", name: "Mock Room", avatarURL: nil),
|
||||
canJoinCall: canJoinCall,
|
||||
hasOngoingCall: hasOngoingCall,
|
||||
activeRoomCallIntent: activeRoomCallIntent,
|
||||
isDirectOneToOneRoom: isDirectOneToOneRoom,
|
||||
roomThreadListEnabled: roomThreadListEnabled,
|
||||
hasSuccessor: false)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user