diff --git a/Signal/Calls/UserInterface/IndividualCallViewController.swift b/Signal/Calls/UserInterface/IndividualCallViewController.swift index 3d5907d54c..e0d6f8b316 100644 --- a/Signal/Calls/UserInterface/IndividualCallViewController.swift +++ b/Signal/Calls/UserInterface/IndividualCallViewController.swift @@ -313,10 +313,27 @@ class IndividualCallViewController: OWSViewController, IndividualCallObserver { bottomGradientView.autoPinWidthToSuperview() bottomGradientView.autoPinEdge(toSuperviewEdge: .bottom) + // Confirmation toasts should sit on top of the `localVideoView` + // and most other UI elements, so this `addSubview` should remain towards + // the end of the setup. + view.addSubview(callControlsConfirmationToastContainerView) + self.callControlsConfirmationToastContainerViewBottomConstraint = callControlsConfirmationToastContainerView.autoPinEdge( + .bottom, + to: .bottom, + of: self.view, + withOffset: callControlsConfirmationToastContainerViewBottomConstraintConstant + ) + callControlsConfirmationToastContainerView.autoHCenterInSuperview() + createContactViews() createIncomingCallControls() } + private var callControlsConfirmationToastContainerViewBottomConstraint: NSLayoutConstraint? + private var callControlsConfirmationToastContainerViewBottomConstraintConstant: CGFloat { + return -self.bottomSheet.sheetHeight - 16 + } + private func presentBottomSheet(_ animated: Bool) { guard bottomSheet.presentingViewController == nil else { return } bottomSheet.setBottomSheetMinimizedHeight() @@ -856,6 +873,8 @@ class IndividualCallViewController: OWSViewController, IndividualCallObserver { callDurationTimer = nil } + callControlsConfirmationToastContainerViewBottomConstraint?.constant = callControlsConfirmationToastContainerViewBottomConstraintConstant + scheduleBottomSheetTimeoutIfNecessary() } @@ -1354,6 +1373,7 @@ private class PermissionErrorView: UIView { extension IndividualCallViewController: SheetPanDelegate { func sheetPanDidBegin() { bottomSheetState = .transitioning + self.callControlsConfirmationToastManager.forceDismissToast() } func sheetPanDidEnd() {