From 046c9fba58a2c6ff5de5768105524add7a13ad63 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Thu, 17 Feb 2022 13:25:53 +0200 Subject: [PATCH] vector-im/element-ios/issues/5609 - Add attribution to location sharing maps. --- .../Location/RoomTimelineLocationView.swift | 2 + .../Location/RoomTimelineLocationView.xib | 80 ++++++++----- .../View/LocationSharingView.swift | 110 ++++++++++-------- changelog.d/5609.change | 1 + 4 files changed, 114 insertions(+), 79 deletions(-) create mode 100644 changelog.d/5609.change diff --git a/Riot/Modules/Room/Location/RoomTimelineLocationView.swift b/Riot/Modules/Room/Location/RoomTimelineLocationView.swift index 882a277c96..5ffb88e154 100644 --- a/Riot/Modules/Room/Location/RoomTimelineLocationView.swift +++ b/Riot/Modules/Room/Location/RoomTimelineLocationView.swift @@ -35,6 +35,7 @@ class RoomTimelineLocationView: UIView, NibLoadable, Themable, MGLMapViewDelegat @IBOutlet private var descriptionContainerView: UIView! @IBOutlet private var descriptionLabel: UILabel! @IBOutlet private var descriptionIcon: UIImageView! + @IBOutlet private var attributionLabel: UILabel! private var mapView: MGLMapView! private var annotationView: LocationMarkerView? @@ -101,6 +102,7 @@ class RoomTimelineLocationView: UIView, NibLoadable, Themable, MGLMapViewDelegat descriptionLabel.textColor = theme.colors.primaryContent descriptionLabel.font = theme.fonts.footnote descriptionIcon.tintColor = theme.colors.accent + attributionLabel.textColor = theme.colors.accent layer.borderColor = theme.colors.quinaryContent.cgColor } diff --git a/Riot/Modules/Room/Location/RoomTimelineLocationView.xib b/Riot/Modules/Room/Location/RoomTimelineLocationView.xib index acc469b748..fb2e22a294 100644 --- a/Riot/Modules/Room/Location/RoomTimelineLocationView.xib +++ b/Riot/Modules/Room/Location/RoomTimelineLocationView.xib @@ -1,9 +1,9 @@ - + - + @@ -15,48 +15,72 @@ - - + + - - + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + - - - + + + + diff --git a/RiotSwiftUI/Modules/Room/LocationSharing/View/LocationSharingView.swift b/RiotSwiftUI/Modules/Room/LocationSharing/View/LocationSharingView.swift index 0d40d14d99..5c69349ccf 100644 --- a/RiotSwiftUI/Modules/Room/LocationSharing/View/LocationSharingView.swift +++ b/RiotSwiftUI/Modules/Room/LocationSharing/View/LocationSharingView.swift @@ -32,62 +32,70 @@ struct LocationSharingView: View { var body: some View { NavigationView { - LocationSharingMapView(tileServerMapURL: context.viewState.mapStyleURL, - avatarData: context.viewState.avatarData, - location: context.viewState.location, - errorSubject: context.viewState.errorSubject, - userLocation: $context.userLocation) - .toolbar { - ToolbarItem(placement: .navigationBarLeading) { - Button(VectorL10n.cancel, action: { - context.send(viewAction: .cancel) - }) - } - ToolbarItem(placement: .principal) { - Text(VectorL10n.locationSharingTitle) - .font(.headline) - .foregroundColor(theme.colors.primaryContent) - } - ToolbarItem(placement: .navigationBarTrailing) { - if context.viewState.location != nil { - Button { - context.send(viewAction: .share) - } label: { - Image(uiImage: Asset.Images.locationShareIcon.image) - .accessibilityIdentifier("LocationSharingView.shareButton") - } - .disabled(!context.viewState.shareButtonEnabled) - } else { - Button(VectorL10n.locationSharingShareAction, action: { - context.send(viewAction: .share) - }) - .disabled(!context.viewState.shareButtonEnabled) - } - } + ZStack(alignment: .bottom) { + LocationSharingMapView(tileServerMapURL: context.viewState.mapStyleURL, + avatarData: context.viewState.avatarData, + location: context.viewState.location, + errorSubject: context.viewState.errorSubject, + userLocation: $context.userLocation) + .ignoresSafeArea() + + HStack { + Link("© MapTiler", destination: URL(string: "https://www.maptiler.com/copyright/")!) + Link("© OpenStreetMap contributors", destination: URL(string: "https://www.openstreetmap.org/copyright")!) + } + .font(theme.fonts.caption1) + } + .toolbar { + ToolbarItem(placement: .navigationBarLeading) { + Button(VectorL10n.cancel, action: { + context.send(viewAction: .cancel) + }) } - .navigationBarTitleDisplayMode(.inline) - .introspectNavigationController { navigationController in - ThemeService.shared().theme.applyStyle(onNavigationBar: navigationController.navigationBar) + ToolbarItem(placement: .principal) { + Text(VectorL10n.locationSharingTitle) + .font(.headline) + .foregroundColor(theme.colors.primaryContent) } - .ignoresSafeArea() - .alert(item: $context.alertInfo) { info in - if let secondaryButton = info.secondaryButton { - return Alert(title: Text(info.title), - message: subtitleTextForAlertInfo(info), - primaryButton: .default(Text(info.primaryButton.title)) { - info.primaryButton.action?() - }, - secondaryButton: .default(Text(secondaryButton.title)) { - secondaryButton.action?() - }) + ToolbarItem(placement: .navigationBarTrailing) { + if context.viewState.location != nil { + Button { + context.send(viewAction: .share) + } label: { + Image(uiImage: Asset.Images.locationShareIcon.image) + .accessibilityIdentifier("LocationSharingView.shareButton") + } + .disabled(!context.viewState.shareButtonEnabled) } else { - return Alert(title: Text(info.title), - message: subtitleTextForAlertInfo(info), - dismissButton: .default(Text(info.primaryButton.title)) { - info.primaryButton.action?() - }) + Button(VectorL10n.locationSharingShareAction, action: { + context.send(viewAction: .share) + }) + .disabled(!context.viewState.shareButtonEnabled) } } + } + .navigationBarTitleDisplayMode(.inline) + .introspectNavigationController { navigationController in + ThemeService.shared().theme.applyStyle(onNavigationBar: navigationController.navigationBar) + } + .alert(item: $context.alertInfo) { info in + if let secondaryButton = info.secondaryButton { + return Alert(title: Text(info.title), + message: subtitleTextForAlertInfo(info), + primaryButton: .default(Text(info.primaryButton.title)) { + info.primaryButton.action?() + }, + secondaryButton: .default(Text(secondaryButton.title)) { + secondaryButton.action?() + }) + } else { + return Alert(title: Text(info.title), + message: subtitleTextForAlertInfo(info), + dismissButton: .default(Text(info.primaryButton.title)) { + info.primaryButton.action?() + }) + } + } } .accentColor(theme.colors.accent) .activityIndicator(show: context.viewState.showLoadingIndicator) diff --git a/changelog.d/5609.change b/changelog.d/5609.change new file mode 100644 index 0000000000..b33dea26b3 --- /dev/null +++ b/changelog.d/5609.change @@ -0,0 +1 @@ +Add attribution to location sharing maps. \ No newline at end of file