Commit Graph

312 Commits

Author SHA1 Message Date
Minh Nguyễn
3503c0e767 Merge branch 'release-ios-v3.4.0' into 1ec5-release-ios-v3.4.0-beta.4-master 2016-12-03 15:36:42 -08:00
Jesse Crocker
5dd71d3c30 [ios, macos] Make tap gesture recognizer fail if it doesn’t do anything (#7246)
* Make tap gesture recognizer fail if it doesn’t do anything.

* fix typo

* Use the right nullable

* update changelog

* Make single click gesture recognizer fail if it doesn’t select an annotation

* fix changelog typo

* Remove singleTapGestureRecognizer from public header
2016-12-01 11:50:20 -08:00
Jesse Bounds
dbb520662d [ios, android] Move der files to ios platform
.der files are used only by the iOS platform for SSL pinning. This
moves them out of the `platform/default/resources` directory and into
`platform/ios/resources`. The make configuration for Android is
updated so that it stops attempting to copy the files at all.
2016-11-30 16:19:22 -08:00
Jesse Bounds
e9504912dc [ios] Use new pinning cert for staging
This updates the cert for the staging environment. It also adjusts the
telem implementation to send along the horizontal accuracy for each
location event and removes the previous battery level gathering logic.
2016-11-30 16:19:22 -08:00
Jesse Bounds
ba775404d8 [ios, macos] Add notes to APIs that rely on style and source ids (#6886)
Update documentation to make the implications of identifiers clearer.
2016-11-30 09:26:21 -08:00
Minh Nguyễn
4096544188 [ios, macos] Marked C array parameters as const
Fixes #7214.
2016-11-29 22:47:30 -08:00
Jesse Bounds
d830c48e4a [ios, macos] Refcount view activations (#7208)
This adds a ref count to guard against calling activate after it has
already been called. This can happen when a layer is added during
certain map lifecycle methods like MapChangeWillStartRenderingFrame
that also triggers activation. This also protects against issues
related to a deactivation of the context happening in an inner scope
while an outer scope is still expecting to be able to use the context.
2016-11-29 08:56:59 -08:00
Minh Nguyễn
9fac640bf3 [ios, macos] Key-value compliance for MGLStyle
Replaced -[MGLMapView style] with a property. Keep the MGLStyle object around for the lifetime of the style.

Bracket changes to layers in willChange and didChange calls. The built-in point annotation layer is added after the style is finished loading but before the map is finished loading. Cause a second wave of change notifications to go out, about both sources and layers. Issue change notifications for style layers when shape annotations are added or removed.
2016-11-28 15:45:43 -08:00
Jesse Bounds
13e0f9e527 [ios, macos] Refactor runtime styling enumeration properties
Correctly map SDK runtime styling enumerations to mbgl
equivalents. Also, add category methods to NSValue so enums
can be wrapped up with less of the details of how they
are layed out in memory in Objective-C.
2016-11-22 19:53:54 -08:00
Konstantin Käfer
4577c56745 [core] remove unused umbrella header in favor of individual includes 2016-11-22 20:58:51 +01:00
Konstantin Käfer
e76de05402 [build] move logging to util 2016-11-22 20:58:51 +01:00
Konstantin Käfer
3bc79e316e [build] move default ThreadPool implementation to platform/default 2016-11-22 20:58:51 +01:00
Konstantin Käfer
a71868fc8d [build] move Reachability to platform/darwin 2016-11-22 20:58:51 +01:00
Fredrik Karlsson
307f8e4f41 [ios] simplified constraints and fixed regression 6954 (#7084)
* [ios] simplified constraints and fixed regression 6954

* [ios] removed excessive constraints

* [ios] removed compass container view
2016-11-20 13:16:20 +01:00
Fredrik Karlsson
07b311d490 [ios] update layout after device has been rotated 2016-11-15 17:53:50 +01:00
Jason Wray
40a7e6b414 [ios] Constrain compass directly to the top layout guide
In iOS 10, the top layout guide is not always returning the expected
value unless there is a constraint applied directly against it.
2016-11-15 17:53:50 +01:00
Jason Wray
13c6648713 [ios] Make map view UI elements' constraints unambiguous
NSLayoutRelationGreaterThanOrEqual meant that it either greater-than or
equal could satisify the constraint, when really all we need is equal.
2016-11-15 17:53:50 +01:00
Minh Nguyễn
f2ba2b2dee [ios, macos] Fixed crash getting annotation view
Streamlined -[MGLMapView annotationTagForAnnotation:] to use the mapping added in #5987. Reverted an unsafe access into that mapping that was added in #5987; returning nil is preferable when no such annotation can be found. Return the user location annotation view when given the user location annotation.
2016-11-08 22:51:05 -08:00
Jesse Bounds
751aff2ddd [ios, macos] Work around annotation race condition (#6924)
When annotations are removed concurrently with being updated because
of a map redraw, it is possible that mbgl will still consider an
annotation to exist depending on what part of the map lifecycle the
call update annotations happens. However, the annotation context by
tag map in MGLMapView (on the main thread) will always be up to date.
This adds a guard that uses that map to avoid considering annotations
that have actually been removed as visible.

Another issue was that adding the same annotation object twice has
always been allowed and has worked, visually. However, a recent
refactor to make the reuse queue work correctly is not tolerant of the
a single view representing two annotation instances that are the same.
The effect is that a new UIView will be generated for each (clone)
annotation that is added and only the last view will move with the map.
The other views become detached and float around in the view as the
map is panned. This commit adds a guard to make adding an annotation
instance a no-op if it has already been added before.
2016-11-04 13:50:53 -07:00
Jesse Bounds
8afc68bbe4 [ios] Store annotation tags for MGLMultiPoint annotations in the map (#6888)
* [ios] Store annotation tags for MGLMultiPoint annotations in the map

This fixes an issue where, if a multipoint annotation was added,
native annotation view update logic would crash. Adding the annotation
tag for multipoints, too, avoids the out of range exception.

This also adds a check for MGLMultiPoint for offscreen annotations
for consistency with the onscreen case.
2016-11-03 18:19:55 -07:00
Minh Nguyễn
4f40fceb72 Merge branch 'release-ios-v3.4.0' into 1ec5-release-ios-v3.4.0-beta.2-master 2016-11-03 13:16:27 -07:00
Jason Wray
b8a2fd390c Merge branch 'release-ios-v3.3.5' into master 2016-11-02 16:18:17 -04:00
Jesse Bounds
2901bc0f68 Optimize annotation view updates (#5987)
Use queryPointAnnotations to drive annotation view updates

- Get sets of visible and offscreen annotations using the mbgl query 
mechanism and updates and enqueues as required
- Query viewport adjusted if tilted (avoid apparent issue with
queryPointAnnotations when the query box is larger than the actual
viewport)
- Add a small debugging display in iOS app to see annotations going in
and out of the reuse queue

This also works around a performance issue that made getting an annotation
context expensive by implementing a map of annotations to tags. It works 
around another issue with the underlying mbgl query so that even if it (rarely) 
returns an incorrect result, the correct visual effect still occurs and the reuse 
queue is added to and drained as expected.

Finally, this refactors MGLMapView viewForAnnotation: to use the maps to
access the requested annotation context and view. This avoids a more
expensive lookup done previously.

Along for the ride: sync up the ios and macos names (and types) for
MGLAnnotationTagContextMap
2016-11-01 11:48:09 -07:00
Konstantin Käfer
f7801e5d82 [core] correctly set the framebuffer size on retina screens
Also asserts in Debug mode that the internal state and the OpenGL state are identical
2016-11-01 10:46:04 +01:00
Konstantin Käfer
62b56b799a [core] change std::array<uint16_t, 2> to mbgl::Size 2016-10-27 18:30:58 -07:00
Jesse Bounds
d5af9b680b [ios, macos] Introduce visible annotations API (#6061)
Add visibleAnnotations API to make it easier for clients of MGLMapView
to query for all visible annotations in the map or all visible annotations
in a subsection of the map.
2016-10-26 17:13:38 -07:00
Jesse Bounds
0a1d9849fa [ios] Guard against nil data task (#5932) 2016-10-25 22:42:06 -07:00
Jesse Bounds
392450786d [ios] Observer that app did become active instead of will foreground (#6600) 2016-10-25 22:40:21 -07:00
Jesse Bounds
32be7b6cc3 [ios] Optimize event uploading (#6737)
Upload any events collected when the app was in use for apps that only
have "when in use" location permissions. Also, for all apps, avoid
posting event data if there is only a single event.
2016-10-25 22:39:26 -07:00
Jesse Bounds
dbfa8dcc89 Merge branch 'master' into boundsj-release-ios-3.4.0-merge-master 2016-10-25 15:48:29 -07:00
Konstantin Käfer
a4d259c33f [core] move gl::Context to Backend and refactor View 2016-10-25 13:52:36 -07:00
Konstantin Käfer
5cc390d694 [core] separate Backend from View for headless rendering 2016-10-25 13:52:36 -07:00
Jesse Bounds
1216050f9c Add MGLPointCollection for GeoJSON multipoints (#6742)
* [ios, macos] Introduce MGLPointCollection

This makes MGLMultiPoint abstract again so that it is only a place 
for shared functionality of polygons and polylines. The multipoint 
feature replaces the point collection feature and can be
used to initialize a MGLGeoJSONSource. The previously added 
swift_names for polyline and polygon are removed, for now.

This also updates the iOS and macOS annotation adding logic so that
unwanted shapes really are avoided. Previously the combined OR
conditions  meant that an annotation had to logically be NOT a kind
of all three types so the check always let the annotation slip through.
This also expands the guard to deflect the new MGLPointCollection.
2016-10-20 17:14:19 -07:00
Mike Morris
817c26111a [core] [node] pass thread pool impl to Map constructor
Updates mbgl::Map constructor usage everywhere

Adds NodeThreadPool implementation using AsyncQueue to call
Nan::AsyncQueueWorker from main thread
2016-10-20 14:37:36 -04:00
Jesse Bounds
0b37408812 [ios] Optimize event uploading (#6737)
Upload any events collected when the app was in use for apps that only
have "when in use" location permissions. Also, for all apps, avoid
posting event data if there is only a single event.
2016-10-18 14:32:32 -07:00
Jason Wray
a1d803f518 [ios, macos] Change runtime styling category method prefix to mgl_
This makes runtime styling category method naming consistent with the rest of the SDK.
2016-10-17 11:47:22 -07:00
Minh Nguyễn
9652028915 [ios, macos] Expand changes to entire API 2016-10-17 11:47:22 -07:00
Jason Wray
4a0173bbd7 [ios, macos] Deprecate -[MGLMapViewDelegate mapView:alphaForShapeAnnotation:] (#6706) 2016-10-14 19:50:21 -04:00
Roman Blum
a24e559ac8 [ios, macos] possibility to set custom images to style (#6637)
* [ios, macos] possibility to set custom images to style

* [ios, macos] setImage:forName now supports MGLImage (UIImage/NSImage)

* [ios, macos] update documentation for setImage:forName: and removeImageForName:

* [ios, macos] rename method and fix prefix

* [ios, macos] change header visibility to project

* [ios, macos] update header imports

* [ios, macos] delete unnecessary whitespaces

* [ios, macos] remove unnecessary nil checks

* [ios, macos] delete unnecessary whitespaces

* [ios, macos] update documentation

* [ios, macos] make mgl_spriteImage a parameter-less instance method

* [ios, macos] add asserts
2016-10-12 12:30:20 -07:00
Jason Wray
5d85dbd7cd [ios, macos] Add -mapView:didFinishLoadingStyle: delegate method 2016-10-11 13:07:10 -04:00
Minh Nguyễn
0acf1ed596 [ios, macos] Renamed files to match renamed classes 2016-10-06 15:19:38 -07:00
Konstantin Käfer
08809b4d44 [macos,ios] initialize util::RunLoop in SDK rather than by default 2016-10-06 10:16:45 -07:00
Jesse Bounds
dab8ee93c8 [ios] Observer that app did become active instead of will foreground (#6600) 2016-10-05 11:53:47 -07:00
Justin R. Miller
105673efc1 [ios, macos] fixes #6160: allow updating multipoint coordinates (#6565) 2016-10-04 18:42:12 -07:00
Jesse Bounds
26c32f5c11 [ios] Remove double counting of content inset top and bottom (#6566)
This removes the calls to top and bottom for content inset of the
map view when calculating the edge padding for following. A previous
commit added this along with the left and right values. This
eliminates a bug where the map did not scroll to the correct location
for the user dot and also a bug in
`didUpdateLocationWithUserTrackingAnimated:` where the map panning
operations would always occur because the current and correct points
never matched up even if a stream of location values that were the
same were processed.
2016-10-03 17:21:38 -07:00
Konstantin Käfer
2ec2860ce5 [core] move OpenGL extension loading to their own headers 2016-09-29 13:19:27 -07:00
Jesse Bounds
c6abc0ea89 [ios] Always show annotation view even when view reuse is not used
This fixes an issue where the map view would drop annotation views
if the developer did not make full use of the reuse queue. The
fixes are:

- Guard against enqueuing a view for reuse if it does not have
a `viewReuseIdentifier`. Previously, if the app developer created a new
annotation view with no reuse id each time
`[MGLMapViewDelegate mapView:viewForAnnotation:]` was called and then
the view was scrolled offscreen, we  attempted to add the view to the
reuse queue (for no good reason) and  did not update the views center
ever again.  This change avoids the reuse queue and just updates the
center always.

- Add any annotation view that should be displayed but is not in the
annotation container view to the annotation container view. Previously,
if the app developer created a new annotation view with a reuse id
each time `[MGLMapViewDelegate mapView:viewForAnnotation:]` was called,
and then if the annotation was scrolled off and then on screen again,
we did not add the new view to the container view because it was
not happening in the normal `addAnnotation` cycle. This adds add
logic to catch that case and add annotation views created in this
way to the view.
2016-09-27 15:24:19 -07:00
Jesse Bounds
3ddb8dfc86 [ios, macos] Add tile template option to raster and vector sources
A new MGLTileSet class that wraps all available core Tileset options can be created and passed into the sources. The sources pass that tileset object along to core.
2016-09-22 17:30:47 -07:00
Jesse Bounds
922bb3bc37 [ios] Use content inset to calculate edge padding (#6313)
This reverts a previous change that used only the contentInset
when setting the center coordinate of the map view.
Instead of contentInset, edgePaddingForFollowing is used. This fixes
a regression that caused the user dot annotation to be misplaced
when the map was configured to show the annotation in any place other
than in the center of the map.

In addition, edgePaddingForFollowing is updated to account for
contentInset when it calculates its UIEdgeInsets. This fixes a bug
where the user dot would move to the center of the content frame
(when it was adjusted for content insets) but the map would not scroll
along with it yielding the effect of the user dot being misplaced.
2016-09-13 22:24:37 -07:00
Jesse Bounds
08f55af914 [ios, macos] Use NSDictionary for geojson source options.
This removes a previous implementation of geojson options that used
a new type to transfer the data around. Added in its place is
an options API that takes an NSDictionary that works similarly to
NSAttributedString and many other Cocoa APIs that take options.

The options parser now expects the developer to send values of the
type noted in the documentation and it simply converts the NSNumber
to the correct type (integer, double, or bool) for mbgl. However, an
exception is raised if the value is not an NSNumber.
2016-09-02 14:48:37 -07:00