Commit Graph

533 Commits

Author SHA1 Message Date
Minh Nguyễn
7fea85a429 Pulled self-less utility methods out into functions
Also include the name of the requested resource when asserting because one can’t be found.
2015-05-21 15:19:08 -07:00
Minh Nguyễn
a2a63301ec Merge pull request #1615 from mapbox/1ec5-plist-order
Fixed account type setting; reworded IB designable message
2015-05-21 14:12:25 -07:00
Minh Nguyễn
2200c51a33 Removed unavailable method implementation
This class method is marked unavailable in MGLAccountManager.h, so this code can never be reached.
2015-05-21 13:29:46 -07:00
Minh Nguyễn
93f92b7805 Rewrote IB designable message
IB designables inside frameworks have no access whatsoever to the host app’s bundle (especially if the host app lacks any designables of its own). So it has no way of knowing whether the access token is set in Info.plist. We could continue to check whether it was set programmatically, but we’d still have no way of knowing whether the host app has a Settings bundle, the other prerequisite for displaying Mapbox maps. Therefore, this change removes the Mapbox logo from the designable and displays a reworded reminder unconditionally. It now displays the URL of the “First steps with Mapbox GL for iOS” guide. I kept Mapbox blue in the designable, but as a border, so you can easily tell where the view ends (a major usability problem for custom views in IB).
2015-05-21 10:10:35 -07:00
Minh Nguyễn
e74997e2c1 Clarified IB designable message
Access tokens are only required for showing Mapbox-hosted maps.
2015-05-21 08:53:40 -07:00
Minh Nguyễn
a91b1d73e2 Merge pull request #1611 from friedbunny/1519-actionsheet-metrics-squash
[squash] Add action sheet shortcut to Settings.app metrics opt-out
2015-05-21 01:55:17 -07:00
Minh Nguyễn
70381d2705 Fixed up various Info.plist edge cases
Need to look in the main bundle for Info.plist settings, because the developer has no access to the framework’s Info.plist. Need to check MGLMapboxMetricsEnabledSettingShownInApp before MGLMapboxAccessToken; otherwise, `MGLMapboxEvents` inspects the Settings bundle plist before MGLMapboxMetricsEnabledSettingShownInApp is even checked.
2015-05-21 01:49:53 -07:00
Jason Wray
911a8ffc60 Add action sheet shortcut to Settings.app metrics opt-out
Only applicable to iOS 8+. Checks if metrics setting has been declared to be offered in app, if not: adds ℹ️ action to open the app's Settings.app section.

Fixes #1519. Squash of #1529.
2015-05-21 00:12:49 -07:00
Minh Nguyễn
256b748458 Merge branch '1ec5-plist-1535' 2015-05-20 14:38:36 -07:00
Brad Leege
8f8631963b Merge pull request #1603 from mapbox/1595-internal-billing
Counting App Users For Billing
2015-05-20 15:56:18 -05:00
Brad Leege
a47438d42a #1595 - Changing to strongSelf 2015-05-20 15:12:48 -05:00
Brad Leege
cbcc3a3e49 #1595 - Separating pushTurnstileEvent from primary pushEvent infrastructure. Adding event, created, and appBundleId to posted Turnstile Event data model. 2015-05-20 15:05:56 -05:00
Brad Leege
a29587726c #1595 - Moving MGLEventTypeAppUserTurnstile event to end of MGLMapboxEvents init method to ensure it only gets called once 2015-05-20 14:32:16 -05:00
Brad Leege
44caf2c7a9 #1595 - Improving stability by moving MGLEventTypeAppUserTurnstile after the strongSelf check 2015-05-20 14:18:39 -05:00
Minh Nguyễn
90a50c0c41 Observe access token changes
The singleton `MGLAccountManager` wants to be the sole arbiter of the access token, but each instance of `mbgl::Map` (`mbgl::DefaultFileSource` in #1607) has its own copy of the access token. Now `MGLMapView` observes for changes to the `MGLAccountManager`’s access token and synchronizes `mbgl::Map` with it.
2015-05-20 11:49:59 -07:00
Minh Nguyễn
a081f1af5b Removed redundant declaration 2015-05-20 10:47:42 -07:00
Minh Nguyễn
9a57464f82 Removed accessToken from MGLMapView public API
With helpful instructions for migrating to Info.plist or the `MGLAccountManager` API.
2015-05-20 10:45:26 -07:00
Brad Leege
a5bd2fa3c6 #1595 - Adding exception so that Turnstile event will always be sent in 2015-05-20 12:31:20 -05:00
Brad Leege
58b967605a Implementing suggestions to tighten up MGLAccountManager and rename MGLEventTypeUserCount to MGLEventTypeAppUserTurnstile 2015-05-20 11:32:57 -05:00
Brad Leege
f3d7212137 #1595 - Adding App User count event to be triggered and immediately sent when Access Token is set. 2015-05-19 17:02:54 -05:00
Minh Nguyễn
d474f35371 Check account type before comparing hostname 2015-05-19 14:33:19 -07:00
Minh Nguyễn
52670f0560 Cache account type user default 2015-05-19 14:31:30 -07:00
Minh Nguyễn
90b70180c5 Compare hostname for adding events=true
ref #1596, #1599
2015-05-19 13:44:29 -07:00
Brad Leege
ec4cd494cb #1596 - Adding mapbox.com checking to http requests 2015-05-19 14:23:21 -05:00
Brad Leege
5572504d38 Merge pull request #1589 from mapbox/1396-info-plist-only
Manage Metrics TEST URL Via Info.plist
2015-05-18 21:40:26 -05:00
Minh Nguyễn
1102f85a83 Less bland default title for user dot annotation
What’s a map without a You Are Here sticker?
2015-05-18 17:21:49 -07:00
Minh Nguyễn
b7b4515d48 Marked unused parameters with __unused
Replaced haphazard usage of pragmas and `(void)` expressions with the `__unused` keyword.
2015-05-18 17:11:12 -07:00
Brad Leege
fa34b53964 #1396 - Refactoring Metrics Test Server URL configuration to be drive via Info.plist 2015-05-18 18:15:15 -05:00
Minh Nguyễn
2c7d0567fa Privatized MGLMapboxEvents
`-pauseMetricsCollection` and `-resumeMetricsCollection` were originally introduced to mitigate concerns around battery usage, but `MGLMapboxEvents` has since evolved to tread much lighter on the battery. There’s no longer any need for the client to call these methods directly. The iOS test project now includes MGLMapboxEvents.h explicitly to avoid having to package a header that will go unused.
2015-05-18 11:55:54 -07:00
Minh Nguyễn
563fed5ca9 Properly fail to load the map
A typo in a selector literal meant that `-[MGLMapViewDelegate mapViewDidFailLoadingMap:withError:]` would never be sent to delegates even if `MGLMapView` had called it. Along for the ride, create a proper `NSError` to pass into that callback, and an error domain for that error.
2015-05-16 20:26:28 -07:00
John Firebaugh
5aa5976a71 Speculative fix for PNG alpha/gamma handling
The libpng documentation is hopelessly impenetrable and I have no idea
what I'm doing, but this seems to fix the headless rendering failures.
2015-05-14 18:02:15 -07:00
Jason Wray
03a129176c Rotate compass on device orientation changes 2015-05-14 13:13:24 -07:00
Minh Nguyễn
a04703e2d5 Updated Metrics in-app opt-out assertion
The message referred to `+[MGLAccountManager setMapboxMetricsEnabledSettingShownInApp:]`, which is no longer available.
2015-05-14 00:38:52 -07:00
John Firebaugh
7d4f12434e Ensure call-once semantics inside InitializeExtensions 2015-05-13 19:01:58 -07:00
John Firebaugh
a2344c36c3 Extensible GL extension support 2015-05-13 19:01:58 -07:00
John Firebaugh
0f7c6b0b52 Remove unused GL feature flags
These were used only for prerendered textures, which were removed.
2015-05-13 19:01:57 -07:00
Minh Nguyễn
164ff72297 Fall back on MGLAccountManager access token
Makes IB designables aware of access tokens set via Info.plist.
2015-05-13 16:33:40 -07:00
Minh Nguyễn
cbb7112e8c Set up MGLAccountManager without any prodding
`MGLAccountManager` is now guaranteed to initialize without the code ever making any mention of it. It also is guaranteed to be set up before `MGLMapboxMetrics` but will definitely cause `MGLMapboxMetrics` to be set up on the main thread if the access token is set in Info.plist.
2015-05-13 16:08:40 -07:00
Minh Nguyễn
2529baa62b Grab access token and other app-wide data from Info.plist
That way there’s no ambiguity about when you should call things like `+[MGLAccountManager setMapboxMetricsEnabledSettingShownInApp:]`. In fact, that method is now deprecated because it’s so easy to call in the wrong place.

Fixes #1535.
2015-05-13 15:33:28 -07:00
Minh Nguyễn
9a404a3088 Return nil for IB designables agent
In Objective-C, the return value for a non-void method is the receiver by default. Hello NeXTSTEP.
2015-05-13 07:53:32 -07:00
Justin R. Miller
a47f749fe4 Merge pull request #1491 from mapbox/1ec5-metrics-opt-way-out
refactor metrics system to immediately jettison data & tracking when users opt out
2015-05-12 18:36:59 -07:00
Justin R. Miller
190e911209 fix dispatch-thread pattern
1. Always bail early if in IB.
 2. Always run on main thread if not already.
 3. THEN dispatch_once to create the static instance.
2015-05-12 18:23:59 -07:00
John Firebaugh
606e2c7383 Remove currently unsupported styles from defaultStyles 2015-05-12 16:42:26 -07:00
Minh Nguyễn
7ed31065ed Cleaned up in-app opt-out property
Renamed the property to be consistent with the public class methods. Also removed a spurious #import of a .m file.
2015-05-12 16:16:48 -07:00
Minh Nguyễn
9850488253 Merge branch '1ec5-metrics-determinism' into 1ec5-metrics-opt-way-out 2015-05-12 16:12:25 -07:00
Minh Nguyễn
b1992a4516 Merge branch 'master' into 1ec5-metrics-opt-way-out 2015-05-12 16:09:10 -07:00
Minh Nguyễn
afbb9c2717 Enable Metrics by default default default
Enable Mapbox Metrics by default when Settings.bundle is absent, but allow Settings.bundle to override the default. Don’t register defaults for non-Mapbox preferences. The two-phase registration ensures that the defaults don’t default to unexpected values, yet gives the developer a chance to call `+[MGLAccountManager mapboxMetricsEnabledSettingShownInApp]` before the hard assertion.

Fixes #1518.
2015-05-12 15:26:07 -07:00
Minh Nguyễn
b88b917cd4 Acknowledge the existence of other Mapbox GL classes 2015-05-12 12:28:43 -07:00
Minh Nguyễn
576caf0855 Corrected Settings.bundle assertion message
It’s `-[MGLAccountManager setMapboxMetricsEnabledSettingShownInApp:]`. Also clarified when the setter has to be called.
2015-05-12 11:49:40 -07:00
Brad Leege
3391d8f6d8 Merge pull request #1520 from mapbox/1516-opt-out-checking
Explicit Opt Out Checking
2015-05-12 11:04:14 -05:00