mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 19:11:45 +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 joinCall = "room-join_call"
|
||||||
let scrollToBottom = "room-scroll_to_bottom"
|
let scrollToBottom = "room-scroll_to_bottom"
|
||||||
|
|
||||||
|
let startVoiceCall = "room-start_voice_call"
|
||||||
|
let startVideoCall = "room-start_video_call"
|
||||||
|
|
||||||
let messageComposer = "room-message_composer"
|
let messageComposer = "room-message_composer"
|
||||||
let sendButton = "room-send_button"
|
let sendButton = "room-send_button"
|
||||||
|
|
||||||
|
|||||||
@@ -23,24 +23,45 @@ struct RoomCallControlsToolbar: ToolbarContent {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if viewState.isDirectOneToOneRoom {
|
if viewState.isDirectOneToOneRoom {
|
||||||
ToolbarItem(placement: .primaryAction) {
|
if viewState.roomThreadListEnabled {
|
||||||
Menu {
|
// If the developer mode room thread list option is enabled there
|
||||||
Button {
|
// is not enough place for 2 calls buttons
|
||||||
onCallTap(true)
|
ToolbarItem(placement: .primaryAction) {
|
||||||
} label: {
|
Menu {
|
||||||
Label(L10n.a11yStartVoiceCall, icon: \.voiceCallSolid)
|
Button {
|
||||||
}
|
onCallTap(true)
|
||||||
|
} label: {
|
||||||
|
Label(L10n.a11yStartVoiceCall, icon: \.voiceCallSolid)
|
||||||
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
onCallTap(false)
|
onCallTap(false)
|
||||||
|
} label: {
|
||||||
|
Label(L10n.a11yStartVideoCall, icon: \.videoCallSolid)
|
||||||
|
}
|
||||||
} label: {
|
} label: {
|
||||||
Label(L10n.a11yStartVideoCall, icon: \.videoCallSolid)
|
CompoundIcon(\.voiceCallSolid)
|
||||||
}
|
}
|
||||||
} label: {
|
.accessibilityLabel(L10n.a11yStartCall)
|
||||||
CompoundIcon(\.voiceCallSolid)
|
.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 {
|
} else {
|
||||||
ToolbarItem(placement: .primaryAction) {
|
ToolbarItem(placement: .primaryAction) {
|
||||||
@@ -66,6 +87,10 @@ struct RoomCallControlsToolbar_Previews: PreviewProvider {
|
|||||||
ElementNavigationStack {
|
ElementNavigationStack {
|
||||||
Color.clear.toolbar { RoomCallControlsToolbar(viewState: .mock(hasOngoingCall: false, isDirectOneToOneRoom: true)) { _ in } }
|
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 {
|
ElementNavigationStack {
|
||||||
Color.clear.toolbar { RoomCallControlsToolbar(viewState: .mock(hasOngoingCall: false)) { _ in } }
|
Color.clear.toolbar { RoomCallControlsToolbar(viewState: .mock(hasOngoingCall: false)) { _ in } }
|
||||||
}
|
}
|
||||||
@@ -81,12 +106,13 @@ struct RoomCallControlsToolbar_Previews: PreviewProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private extension RoomScreenViewState {
|
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),
|
RoomScreenViewState(roomAvatar: .room(id: "mock", name: "Mock Room", avatarURL: nil),
|
||||||
canJoinCall: canJoinCall,
|
canJoinCall: canJoinCall,
|
||||||
hasOngoingCall: hasOngoingCall,
|
hasOngoingCall: hasOngoingCall,
|
||||||
activeRoomCallIntent: activeRoomCallIntent,
|
activeRoomCallIntent: activeRoomCallIntent,
|
||||||
isDirectOneToOneRoom: isDirectOneToOneRoom,
|
isDirectOneToOneRoom: isDirectOneToOneRoom,
|
||||||
|
roomThreadListEnabled: roomThreadListEnabled,
|
||||||
hasSuccessor: false)
|
hasSuccessor: false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user