Skip to content

Commit

Permalink
Added a button to dismiss sharing popup
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmitrevski committed Jul 31, 2023
1 parent ee050e1 commit e96c0f9
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions Sources/StreamVideoSwiftUI/CallView/CallTopView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public struct CallTopView: View {
@Injected(\.images) var images

@ObservedObject var viewModel: CallViewModel
@State var sharingPopupDismissed = false

public init(viewModel: CallViewModel) {
self.viewModel = viewModel
Expand Down Expand Up @@ -55,27 +56,45 @@ public struct CallTopView: View {
}
.overlay(
viewModel.call?.state.isCurrentUserScreensharing == true ?
SharingIndicator(viewModel: viewModel)
SharingIndicator(
viewModel: viewModel,
sharingPopupDismissed: $sharingPopupDismissed
)
.opacity(sharingPopupDismissed ? 0 : 1)
: nil
)
}

}

struct SharingIndicator: View {

@ObservedObject var viewModel: CallViewModel
@Binding var sharingPopupDismissed: Bool

var body: some View {
HStack {
Text(L10n.Call.Current.sharing)
.font(.headline)
Divider()
Button {
viewModel.stopScreensharing()
} label: {
Text(L10n.Call.Current.stopSharing)
.font(.headline)
}
Button {
sharingPopupDismissed = true
} label: {
Image(systemName: "xmark")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(height: 14)
}
.padding(.leading, 4)

}
.padding()
.padding(.all, 8)
.modifier(ShadowViewModifier())
}

Expand Down

0 comments on commit e96c0f9

Please sign in to comment.