You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
MGLMapboxMetrics registers defaults for non-Mapbox settings #1518
At initialization, MGLMapboxEventsautomatically registers defaults for every setting it finds in the host app’s Settings bundle. That’s too aggressive: Mapbox Metrics is not the only thing that a developer might want to provide settings for. The developer should be responsible for registering any non-Mapbox settings they come up with. Instead of a for loop, we should register a default for MGLMapboxMetricsEnabled and nothing more.
I don’t think it’s a big deal practically speaking, more of a principle-of-least-surprise thing. We don’t know that this code can handle complex settings bundles (with subpages and so forth) because we’ve never tested them with Mapbox GL. And if a developer happens to perform defaults registration themselves (which is best practice) but uses different defaults in code than in the bundle (not sure why, but who knows), we could clobber their registered defaults in a non-deterministic manner.
I think we can address this technical debt easily in beta 2. It’s wholly unimportant for beta 1.
Activity
incanus commentedon May 12, 2015
What's like the worst-case ramification here?
1ec5 commentedon May 12, 2015
I don’t think it’s a big deal practically speaking, more of a principle-of-least-surprise thing. We don’t know that this code can handle complex settings bundles (with subpages and so forth) because we’ve never tested them with Mapbox GL. And if a developer happens to perform defaults registration themselves (which is best practice) but uses different defaults in code than in the bundle (not sure why, but who knows), we could clobber their registered defaults in a non-deterministic manner.
I think we can address this technical debt easily in beta 2. It’s wholly unimportant for beta 1.
bleege commentedon May 12, 2015
Removing this would cause Metrics Opt Out to break. This is the loading of Settings.bundle into memory so that the checks have something to test.
If we can find another way to do this in Beta 2 I'm all for it though.
1ec5 commentedon May 12, 2015
I’m only talking about modifying this code, not removing it. See what @friedbunny did in #1529, for example.
bleege commentedon May 12, 2015
@1ec5 Ah, I see now. The thought is to just look explicitly for the Mapbox known keys and only load those. That makes sense to me. 👍
Enable Metrics by default default default
Enable Metrics by default default default