Commit Graph

99 Commits

Author SHA1 Message Date
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
87551c6d0e #1516 - Renaming setShowsOptOutInApp to setMapboxMetricsEnabledSettingShownInApp for app consistency. Implementing wordsmith edits to NSAssert text. Removing technical debt. 2015-05-12 10:50:46 -05:00
Minh Nguyễn
54a703bcb2 Consolidated logic for pausing/resuming MGLMapboxEvents
`MGLMapboxEvents` automatically recreates its location manager when the host app is reauthorized for Location Services. Added some redundancy to ensure that there is no location manager when either Location Services or Mapbox Metrics is off.
2015-05-12 01:38:04 -07:00
Minh Nguyễn
58d695f6d3 Respond to opt-out setting change immediately
As soon as the user returns to the host app after changing the opt-out preference in Settings, `MGLMapboxEvents` responds by pausing or resuming. Also moved the IB designables agent check to occur only once, at launch, since the process name is not expected to change mid-session.
2015-05-12 01:38:04 -07:00
Minh Nguyễn
ff0ec15e1d More cleanup and sanitization
Moved constant values from ivars into constants. Invalidate the flush timer and clear the event queue on pause. Rewrote some flush logic to be easier to follow.
2015-05-12 01:38:04 -07:00
Minh Nguyễn
2f02a6538e Folded MGLMetricsLocationManager into MGLMapboxEvents
`MGLMetricsLocationManager` was nothing but overhead for `CLLocationManager`. Also removed an unused method.
2015-05-12 01:36:56 -07:00
Minh Nguyễn
c1fe6e1890 Resume iff Metrics is enabled 2015-05-12 01:36:56 -07:00
Minh Nguyễn
f860169f35 Refactored MGLMapboxEvents for better data management
The shared `MGLMapboxEvents` now owns the only instance of `MGLMetricsLocationManager`. It also owns a `MGLMapboxEventsData` object, to which all user-specific data has been relegated. This object can be built up and torn down on the fly, whenever the opt-out preference is toggled. `MGLMapboxEvents` has also given up knowledge of the access token and now queries `MGLAccountManager` for that information, which `MGLMapView` keeps up-to-date.
2015-05-12 01:36:56 -07:00
Minh Nguyễn
60ed9e6d2e Objective-C method naming convention
Removed “get” from names of methods that perform no network or file access.
2015-05-12 01:36:29 -07:00
Minh Nguyễn
1503f33140 Predicate MGLMapboxEvents initialization on user opt-out 2015-05-12 01:36:29 -07:00
Minh Nguyễn
4837359471 Register default user defaults on class initialization
`-[MGLMapboxEvents init]` only gets called if `-[MGLMapboxEvents sharedManager]` sees that user defaults call for an `MGLMapboxEvents` to be created. But those user defaults were only being registered inside `-[MGLMapboxEvents init]`. This change moves the registration to `+initialize`, which is called as soon as the class is loaded.
2015-05-12 01:36:29 -07:00
Brad Leege
48e21ae6e9 #1516 - Adding explicit checks for developer implementation of user Opt Out functionality 2015-05-11 23:31:22 -05:00
Brad Leege
08f1d4b511 #1481 - Changing events array to be created with +arrayWithArray 2015-05-08 15:24:19 -05:00
Brad Leege
2eef6b4412 #1481 - Refactoring to use iOS -copy and -removeAllObjects to get away from having to do potentially less stable index calculations 2015-05-08 15:02:32 -05:00
Brad Leege
9d0b67450d #1481 - Replacing flushAt with eventQueue count of upper range limit 2015-05-08 14:53:39 -05:00
Minh Nguyễn
bb788f56f2 Renamed settings keys
The new keys fit the standard naming convention for Info.plist keys and more clearly communicate how they’re to be used.
2015-05-08 11:51:48 -07:00
Brad Leege
9f0e9fe847 #1474 - Setting flushAfter back to 60 seconds. Removing debug log statements 2015-05-08 10:23:14 -05:00
Brad Leege
11886a9004 #1474 - Adding timer cleanup logic to -flush so that it doesn't loop indefinitely 2015-05-08 10:21:00 -05:00
Brad Leege
ea3979b19e #1474 - Refactoring timer to be started when first event is added to queue. Debug logic and content also included 2015-05-08 10:13:05 -05:00
Minh Nguyễn
ec3757309f Fixed leaks of copied CF objects 2015-05-05 12:10:44 -04:00
Minh Nguyễn
900d140f23 Fixed dead store analyzer warnings
These values weren’t being used for anything.
2015-05-05 11:41:02 -04:00
Minh Nguyễn
98dc0b6f81 Avoid creating MGLMapboxEvents when Metrics is disabled
Mapbox Metrics already has a bottleneck; might as well use it to avoid fetching data in the first place.
2015-05-01 19:24:14 -04:00
Minh Nguyễn
6342712591 Pause collection when tearing down MGLMapboxEvents for whatever reason 2015-04-30 12:28:35 -04:00
Minh Nguyễn
97fb9f6fcf Tied NSURLSession lifetime to metrics collection
Call `-resumeMetricsCollection` on `init` to consolidate the various steps to initialize `MGLMetricsLocationManager`.
2015-04-30 12:22:51 -04:00
Minh Nguyễn
6790a09a08 Turned class methods into instance methods
Avoids unnecessary steps to access singletons. Now `MGLMapboxEvents` and `MGLMetricsLocationManager` instances can message themselves directly.
2015-04-30 11:48:56 -04:00
Minh Nguyễn
87c61657a1 Objective-C niceties
Added macro for main thread assertions based on `NSAssert()`. Reworded Boolean property per Objective-C conventions.
2015-04-30 11:35:52 -04:00
Justin R. Miller
42b59eb655 fixes #1363: centrally & better address GL demo/third-party resource bundle issues 2015-04-28 15:03:35 -04:00
Brad Leege
0662c7416a Merge pull request #1356 from mapbox/1352-visits
Visit API
2015-04-27 21:32:15 -04:00
Brad Leege
3040b6462e #1345 - Changing -buildNumber to /buildNumber 2015-04-27 21:19:45 -04:00
Brad Leege
16bcdb10b8 #1352 - Adding visit event with data attributes 2015-04-27 18:00:31 -04:00
Brad Leege
5092d72599 #1352 - Adding start / stop visit monitoring infrastructure and integrating it with pause / resume metrics api 2015-04-27 17:37:39 -04:00
Brad Leege
c9e5435035 #1307 - Optimizing fallback to digicert check strategy 2015-04-27 16:14:14 -04:00
Brad Leege
353e5661de Merge pull request #1348 from mapbox/1307-digicert
Importing Digicert Cert
2015-04-27 15:42:07 -04:00
Brad Leege
cde989093b #1307 - Adding digicert to sdks and ssl handshaking check 2015-04-27 12:22:05 -04:00
Brad Leege
50fecb916d #1345 - Adding app build number to user agent. Updating gl test app build number to be different from build version. 2015-04-27 11:43:23 -04:00
Brad Leege
86e90da6d5 #1346 - Removing allFrameworks iteration search for the bundle as it's not needed now 2015-04-27 10:55:12 -04:00
Justin R. Miller
ad1cc3f1ad fix SSL pinning for apps including the framework
Made it clearer when we are referring to the app bundle and
when we need to get the framework bundle for resources such as
pinned certificates.
2015-04-25 10:25:47 -07:00
Minh Nguyễn
61d4fcc2ba Merge branch 'master' into 1ec5-strong-self 2015-04-22 13:11:26 -07:00
Brad Leege
d4264edea3 #1166 - Cleaning up logs and old NSURLConnection code 2015-04-21 17:19:37 -05:00
Brad Leege
1a43b773af #1166 - Initial conversion from NSURLConnection to NSURLSession 2015-04-21 17:13:23 -05:00
Brad Leege
d4add0bfdb #1306 - Removing kSecTrustResultConfirm as it's deprecated 2015-04-21 11:15:31 -05:00
Brad Leege
a951229591 #1306 - Moving local geoTrustCert to one time setup and cache in immutable NSData object 2015-04-21 11:09:22 -05:00
Brad Leege
736bdca81e #1306 - Renaming certificate to include geotrust name for easier tracking 2015-04-20 19:59:28 -05:00
Brad Leege
6f9bcd86af #1306 - Moving api_mapbox_com.der to iOS Resources directory so that it can be accessed via GL Framework 2015-04-20 19:47:24 -05:00
Brad Leege
96a6371fa0 #1306 - Explicitly scheduling NSURLConnections in mainRunLoop so that delegates and connections stay connected. 2015-04-20 18:56:42 -05:00