Skip to content

Commit

Permalink
Expose new 2.5.0 features
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn committed Oct 26, 2017
1 parent 6aaab13 commit beef508
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 4 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,25 @@ var mapView = maps.createView({
});
```

#### Safe Area / iPhone X
The GoogleMaps SDK supports configuring the map-view for the iPhone X. Use the `paddingAdjustmentBehavior` to get
or set the padding-adjustment-behavior and use one of the following constants:
```
/** 1. Always include the safe area insets in the padding. */
PADDING_ADJUSTMENT_BEHAVIOR_ALWAYS
/**
* 2. When the padding value is smaller than the safe area inset for a particular edge, use the safe
* area value for layout, else use padding.
*/
PADDING_ADJUSTMENT_BEHAVIOR_AUTOMATIC
/**
* 3. Never include the safe area insets in the padding. This was the behavior prior to version 2.5.
*/
PADDING_ADJUSTMENT_BEHAVIOR_NEVER
```

#### Map Events
The module supports all native delegates - exposed as events. These are:

Expand Down
4 changes: 4 additions & 0 deletions ios/Classes/TiGooglemapsModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,8 @@ - (NSArray *)arrayFromAddresses:(NSArray<GMSAddress *> *)addresses
MAKE_SYSTEM_PROP(APPEAR_ANIMATION_NONE, kGMSMarkerAnimationNone);
MAKE_SYSTEM_PROP(APPEAR_ANIMATION_POP, kGMSMarkerAnimationPop);

MAKE_SYSTEM_PROP(PADDING_ADJUSTMENT_BEHAVIOR_ALWAYS, kGMSMapViewPaddingAdjustmentBehaviorAlways);
MAKE_SYSTEM_PROP(PADDING_ADJUSTMENT_BEHAVIOR_AUTOMATIC, kGMSMapViewPaddingAdjustmentBehaviorAutomatic);
MAKE_SYSTEM_PROP(PADDING_ADJUSTMENT_BEHAVIOR_NEVER, kGMSMapViewPaddingAdjustmentBehaviorNever);

@end
17 changes: 16 additions & 1 deletion ios/Classes/TiGooglemapsViewProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
* @return The selected annotation.
* @since 2.2.0
*/
- (id)getSelectedAnnotation:(id)unused;
- (id)selectedAnnotation:(id)unused;

/**
* Selects a annotation.
Expand Down Expand Up @@ -223,6 +223,21 @@
*/
- (void)setRegion:(id)args;

/**
* Sets the padding adjustment behavior.
*
* @param value The padding adjustment behavior.
* @since 3.11.0
*/
- (void)setPaddingAdjustmentBehavior:(id)paddingAdjustmentBehavior;

/**
* Returns the padding adjustment behavior.
*
* @since 3.11.0
*/
- (void)paddingAdjustmentBehavior;

/**
* Sets the JSOn-based map style.
*
Expand Down
18 changes: 16 additions & 2 deletions ios/Classes/TiGooglemapsViewProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,20 @@ - (void)setRegion:(id)args
[self replaceValue:args forKey:@"region" notification:NO];
}


- (void)setPaddingAdjustmentBehavior:(id)paddingAdjustmentBehavior
{
ENSURE_UI_THREAD(setPaddingAdjustmentBehavior, paddingAdjustmentBehavior);
ENSURE_TYPE(paddingAdjustmentBehavior, NSNumber);

[[[self mapView] mapView] setPaddingAdjustmentBehavior:[TiUtils intValue:paddingAdjustmentBehavior]];
}

- (void)paddingAdjustmentBehavior
{
return @([[[self mapView] mapView] paddingAdjustmentBehavior]);
}

- (void)setMapStyle:(id)value
{
ENSURE_UI_THREAD(setMapStyle, value);
Expand Down Expand Up @@ -523,9 +537,9 @@ - (void)removeHeatmapLayer:(id)args
[[heatmapLayerProxy heatmapLayer] setMap:nil];
}

- (id)getSelectedAnnotation:(id)unused
- (id)selectedAnnotation:(id)unused
{
ENSURE_UI_THREAD(getSelectedAnnotation, unused);
ENSURE_UI_THREAD(selectedAnnotation, unused);
GMSMarker *selectedMarker = [[[self mapView] mapView] selectedMarker];

if (selectedMarker == nil) {
Expand Down
2 changes: 1 addition & 1 deletion ios/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 3.10.0
version: 3.11.0
apiversion: 2
architectures: armv7 arm64 i386 x86_64
description: ti.googlemaps
Expand Down

0 comments on commit beef508

Please sign in to comment.