Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Source attribution should be object-oriented #7361

Closed
1ec5 opened this issue Dec 9, 2016 · 3 comments
Closed

Source attribution should be object-oriented #7361

1ec5 opened this issue Dec 9, 2016 · 3 comments
Assignees
Labels
iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS refactor runtime styling
Milestone

Comments

@1ec5
Copy link
Contributor

1ec5 commented Dec 9, 2016

MGLTileSet’s attribution property – which may soon live on MGLTileSource; see #7360 – should be an array of objects containing structured attribution information. We can use the MGLAttributionInfo class being added in #5999 to represent a single attribution item.

The current MGLTileSet.attribution property is a single string containing HTML code. This encourages developers to manually craft HTML strings, which can be error-prone. It also means any developer who wants to make sense of a preexisting attribution string would have to parse it as HTML. Done incorrectly, both operations can be avenues for HTML injection. Since #5999 already parses the HTML source code into structured attribution, I don’t think there’s really a use case for working with the raw source code as opposed to, say, an attributed string (which can always be converted back to HTML if needed).

/cc @boundsj @friedbunny

@1ec5 1ec5 added iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS refactor runtime styling labels Dec 9, 2016
@1ec5 1ec5 added this to the ios-v3.4.0 milestone Dec 9, 2016
@1ec5 1ec5 self-assigned this Dec 9, 2016
@1ec5
Copy link
Contributor Author

1ec5 commented Dec 9, 2016

Someday, once mapbox/tilejson-spec#20 is implemented, the SDKs will be able to take advantage of structured attribution in TileJSON with minimal changes and likely no changes to public-facing API.

@1ec5
Copy link
Contributor Author

1ec5 commented Dec 12, 2016

We’re pulling this refactoring into the v3.4.0 milestone because most of the pieces are already in place and because we don’t want to have to make a backwards-incompatible change or deprecate a symbol just to expose MGLAttributionInfo publicly. This change will probably occur as part of #7377.

@1ec5
Copy link
Contributor Author

1ec5 commented Dec 14, 2016

Fixed in #7377 on the iOS SDK v3.4.0 release branch.

@1ec5 1ec5 closed this as completed Dec 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS refactor runtime styling
Projects
None yet
Development

No branches or pull requests

1 participant