fix: cherry picked NV commit to remove DSBottomSheet (MESSENGER-6854)

This commit is contained in:
Arnfried Griesert
2025-02-10 23:38:32 +01:00
parent 6c0f1b1935
commit 1c0416255f
3 changed files with 67 additions and 108 deletions

View File

@@ -5,7 +5,6 @@
// Please see LICENSE in the repository root for full details.
//
import DSBottomSheet
import SwiftUI
struct LiveLocationSharingViewer: View {
@@ -16,9 +15,7 @@ struct LiveLocationSharingViewer: View {
@Environment(\.theme) private var theme: ThemeSwiftUI
@Environment(\.openURL) var openURL
@State private var isBottomSheetExpanded = false
var bottomSheetCollapsedHeight: CGFloat = 150.0
// MARK: Public
@@ -114,7 +111,19 @@ struct LiveLocationSharingViewer: View {
}
.accentColor(theme.colors.accent)
.background(theme.colors.system.ignoresSafeArea())
.bottomSheet(sheet, if: viewModel.viewState.isBottomSheetVisible)
.sheet(isPresented: .constant(viewModel.viewState.isBottomSheetVisible)) {
if #available(iOS 16.4, *) {
userLocationList
.presentationBackgroundInteraction(.enabled)
.presentationBackground(theme.colors.background)
.presentationDragIndicator(.visible)
.presentationDetents([.height(bottomSheetCollapsedHeight), .large])
.interactiveDismissDisabled()
} else {
userLocationList
.interactiveDismissDisabled()
}
}
.actionSheet(isPresented: $viewModel.showMapCreditsSheet) {
MapCreditsActionSheet(
attribution: LocationSharingAttribution(),
@@ -135,8 +144,6 @@ struct LiveLocationSharingViewer: View {
LiveLocationListItem(viewData: viewData, onStopSharingAction: {
viewModel.send(viewAction: .stopSharing)
}, onBackgroundTap: { userId in
// Push bottom sheet down on item tap
isBottomSheetExpanded = false
viewModel.send(viewAction: .tapListItem(userId))
})
}
@@ -147,34 +154,6 @@ struct LiveLocationSharingViewer: View {
}
}
// MARK: - Bottom sheet
extension LiveLocationSharingViewer {
var sheetStyle: BottomSheetStyle {
var bottomSheetStyle = BottomSheetStyle.standard
bottomSheetStyle.snapRatio = 0.16
let backgroundColor = theme.colors.background
let handleStyle = BottomSheetHandleStyle(backgroundColor: backgroundColor, dividerColor: backgroundColor)
bottomSheetStyle.handleStyle = handleStyle
return bottomSheetStyle
}
var sheet: some BottomSheetView {
BottomSheet(
isExpanded: $isBottomSheetExpanded,
minHeight: .points(bottomSheetCollapsedHeight),
maxHeight: .available,
style: sheetStyle
) {
userLocationList
}
}
}
// MARK: - Previews
struct LiveLocationSharingViewer_Previews: PreviewProvider {