Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 2struct MapFeatureView: View {
- @Perception.Bindable var store: StoreOf<MapFeature_>
- @State var switchMapTypeEvent: MKMapType? = nil
- @State var addedAnnotations: [PointOfInterestAnnotation] = []
- var fogOverlay: FogOverlay = FogOverlay(mapRect: MapView.createWorldBoundingBox())
- @Environment(\.openURL) var openURL
- @Namespace var animation
- fdsfsdfsdf
- var body: some View {
- WithPerceptionTracking {
- MapView(
- pointsOfInterest: store.pointsOfInterest,
- region: $store.region,
- selectedPointOfInterest: $store.selectedPointOfInterest,
- zoom: $store.zoom,
- isUserChangingRegion: $store.isUserChangingRegion,
- switchMapTypeEvent: $switchMapTypeEvent,
- centerEventRegion: $store.eventCenter,
- addedAnnotations: $addedAnnotations,
- fogOverlay: fogOverlay
- )
- .onAppear(perform: {
- store.send(.requestLocationAuthStatus)
- })
- .overlay(alignment: .bottom, content: {
- LinearGradient(gradient: Gradient(colors: [.white.opacity(0.65), .clear]), startPoint: .bottom, endPoint: .top)
- .frame(height: 180)
- })
- .overlay(alignment: .bottom) {
- Group {
- // if store.isListOfFriendsShown == false {
- // Button {
- // store.send(.updateListOfFriendsShownStatus(true), animation: .bouncy)
- // } label: {
- // ZStack {
- // ForEach(Array(store.friends.prefix(3).enumerated()), id: \.offset) { index, user in
- // UserpicView(user: user, size: CGSize(width: 25, height: 25))
- // .offset(x: CGFloat(index) * 15)
- // }
- //
- // }
- // .offset(x: -15)
- // .matchedGeometryEffect(id: "isListOfFriendsShown", in: animation)
- // }
- // } else {
- ScrollView(.horizontal, showsIndicators: false) {
- HStack {
- ForEach(store.pointsOfInterest) { poi in
- VStack(spacing: 0) {
- UserpicView(user: poi.owner, isWithStroke: true, strokeColor: .white, strokeLineWidth: 2)
- Text("\(poi.owner.shownName)")
- .padding(2)
- .font(.gilroy(size: 14, weight: .medium))
- .fixedSize(horizontal: false, vertical: true)
- .lineLimit(2)
- .multilineTextAlignment(.center)
- .background(.white)
- .foregroundColor(.black)
- .padding(.top, 2)
- .frame(width: 65)
- }
- .onTapGesture {
- store.send(.focusOnUser(poi.owner))
- }
- }
- }
- .offset(x: 5)
- }
- .frame(width: UIScreen.main.bounds.width, height: 54)
- .matchedGeometryEffect(id: "isListOfFriendsShown", in: animation)
- // }
- }
- .padding(.bottom, 110)
- .opacity(store.currentLocationAuthStatus != .authorizedAlways ? 0.0 : 1.0)
- }
- .overlay {
- if store.currentLocationAuthStatus != .authorizedAlways {
- ZStack {
- Color.white.opacity(0.80)
- VStack {
- Text("We need your location permission first")
- .foregroundColor(.black)
- .font(.gilroy(size: 20, weight: .medium))
- .multilineTextAlignment(.center)
- .padding()
- ROTextButton(title: "Share!") {
- if store.currentLocationAuthStatus != .authorizedAlways {
- if let url = URL(string: UIApplication.openSettingsURLString),
- UIApplication.shared.canOpenURL(url) {
- openURL(url)
- }
- } else {
- store.send(.requestPermission)
- }
- }
- .frame(width: 100, height: 50)
- }
- }
- .frame(width: UIScreen.main.bounds.width * 0.95, height: UIScreen.main.bounds.width * 1.5)
- .cornerRadius(14)
- }
- }
- .overlay(alignment: .topLeading) {
- if let weatherData = store.weatherData {
- VStack(alignment: .leading) {
- Text(weatherData.name)
- .foregroundColor(.white)
- .font(.gilroy(size: 50, weight: .bold))
- .shadow(color: Color.gray, radius: 2, x: 0, y: 2)
- Text(weatherData.formattedTemp)
- .font(.gilroy(size: 15, weight: .medium))
- .padding(.top, 2)
- .foregroundColor(.black)
- .background(.white)
- }
- .padding(.leading, 20)
- .padding(.top, 55)
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement