Skip to content

Commit

Permalink
Using transcriptionStates to show/hide transcription controls (#84)
Browse files Browse the repository at this point in the history
* Using transcriptionStates to show/hide transcription control and transcription

* Using helper isTranscriptionAvailable on RoomModel
  • Loading branch information
pawan-100ms authored Apr 30, 2024
1 parent 6ebcd7d commit 3028cb2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ struct HMSOptionSheetView: View {
}
}

if !roomModel.transcript.isEmpty {
if roomModel.isTranscriptionAvailable {

HMSSessionMenuButton(text: captionsState.wrappedValue == .visible ? "Hide Captions" : "Show Captions", image: "captions-icon", highlighted: captionsState.wrappedValue == .visible)
.onTapGesture {
captionsState.wrappedValue = captionsState.wrappedValue == .visible ? .hidden : .visible
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,25 @@ struct HMSTranscriptView: View {
let isChatOverlay = conferenceComponentParam.chat?.isOverlay ?? false

if !(isChatOverlay && isChatPresented) {
if captionsState.wrappedValue == .visible {
viewBody
if roomModel.isTranscriptionAvailable {
if captionsState.wrappedValue == .visible {
viewBody
}
}
}
else {
if captionsState.wrappedValue == .visible {
HMSTopControlStrip()
.padding([.bottom,.horizontal], 8)
.transition(.move(edge: .top))
.frame(height: controlsState.wrappedValue == .hidden ? 0 : nil)
.opacity(0)

viewBody

Spacer()
if roomModel.isTranscriptionAvailable {
if captionsState.wrappedValue == .visible {
HMSTopControlStrip()
.padding([.bottom,.horizontal], 8)
.transition(.move(edge: .top))
.frame(height: controlsState.wrappedValue == .hidden ? 0 : nil)
.opacity(0)

viewBody

Spacer()
}
}
}
}
Expand Down

0 comments on commit 3028cb2

Please sign in to comment.