LocationSharingView: Handle map credits action sheet.

This commit is contained in:
SBiOSoftWhare
2022-07-11 14:43:40 +02:00
parent 4da078f000
commit 77cf1ef1ce
3 changed files with 15 additions and 1 deletions
@@ -40,6 +40,7 @@ enum LocationSharingViewAction {
case startLiveSharing
case shareLiveLocation(timeout: LiveLocationSharingTimeout)
case userDidPan
case mapCreditsDidTap
}
enum LocationSharingViewModelResult {
@@ -95,6 +96,7 @@ struct LocationSharingViewStateBindings {
var userLocation: CLLocationCoordinate2D?
var pinLocation: CLLocationCoordinate2D?
var showingTimerSelector = false
var showMapCreditsSheet = false
}
enum LocationSharingAlertType {
@@ -86,6 +86,8 @@ class LocationSharingViewModel: LocationSharingViewModelType, LocationSharingVie
case .userDidPan:
state.showsUserLocation = false
state.isPinDropSharing = true
case .mapCreditsDidTap:
state.bindings.showMapCreditsSheet.toggle()
}
}
@@ -25,6 +25,8 @@ struct LocationSharingView: View {
@Environment(\.theme) private var theme: ThemeSwiftUI
@Environment(\.openURL) var openURL
// MARK: Public
@ObservedObject var context: LocationSharingViewModel.Context
@@ -34,7 +36,15 @@ struct LocationSharingView: View {
ZStack(alignment: .bottom) {
mapView
VStack(spacing: 0) {
MapCreditsView()
MapCreditsView(action: {
context.send(viewAction: .mapCreditsDidTap)
})
.padding(.bottom, 10.0)
.actionSheet(isPresented: $context.showMapCreditsSheet) {
return MapCreditsActionSheet(openURL: { url in
openURL(url)
}).sheet
}
buttonsView
.background(theme.colors.background)
.clipShape(RoundedCornerShape(radius: 8, corners: [.topLeft, .topRight]))