-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for non-HTML attribution #1163
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the UI! Nice job.
What changes do we need to make to add really good tests for this part of the SDK? Let's incorporate refactoring for testability into every change we make unless there's a really good reason not to.
@@ -7,7 +7,10 @@ extension MapView: AttributionDialogManagerDelegate { | |||
} | |||
|
|||
func attributionDialogManager(_ attributionDialogManager: AttributionDialogManager, didTriggerActionFor attribution: Attribution) { | |||
let url: URL = attribution.isFeedbackURL ? mapboxFeedbackURL() : attribution.url | |||
guard let url: URL = attribution.isFeedbackURL ? mapboxFeedbackURL() : attribution.url else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need an explicit URL
type in this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need, indeed. It went away after a refactoring related to #1163 (comment)
Thanks for calling me out on this 😅 With the changes to A bit trickier with |
window.makeKeyAndVisible() | ||
window.rootViewController = viewController |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this ordering results in a warning logged to the console, you may want to try setting rootViewController before calling makeKeyAndVisible
override func setUp() { | ||
super.setUp() | ||
Bundle.mapboxMapsMetadata.version = "AttributionTests" | ||
} | ||
|
||
override func tearDown() { | ||
super.tearDown() | ||
Bundle.mapboxMapsMetadata.version = sdkVersion | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was surprised that mapboxMapsMetadata
was settable. That looks like a bug in my opinion. Could you avoid setting it here and use string interpolation to create the expected value below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple additional suggestions. Approving!
Currently there is no attribution in case the provided source attribution is in form of plain text(
{attribution: "OpenStreetMap contributors, CC-BY-SA"}
. This PR adds support for plain text attributions.Initially I went with the same approach as on Android mapbox/mapbox-maps-android#1087 to disable alert's actions without URLs(see v1 image above), but it does not look good on iOS due to platform differences. Since there can only be a single plain text attribution I decided put it into alert's message instead(v2).
Fixes #1164
Pull request checklist:
## main
heading near the top).