Skip to content

Commit

Permalink
Merge pull request #462 from jquick-axway/TIMOB-28509
Browse files Browse the repository at this point in the history
fix(ios): include missing i386 and armv7 architectures
  • Loading branch information
garymathews authored Jul 22, 2021
2 parents 9cf4bb1 + f5fa7cd commit 446b9a6
Show file tree
Hide file tree
Showing 16 changed files with 114 additions and 28 deletions.
1 change: 1 addition & 0 deletions ios/Classes/TiMapAnnotationProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- (NSString *)title;
- (NSString *)subtitle;
- (id)pincolor;
- (id)nativePinColor;
- (BOOL)animatesDrop;
- (void)setHidden:(id)value;
- (UIView *)leftViewAccessory;
Expand Down
45 changes: 45 additions & 0 deletions ios/Classes/TiMapAnnotationProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,49 @@ - (void)setPincolor:(id)color
}
}

// Mapping both string-colors, color constant and native colors to a pin color
// This is overcomplicated to maintain iOS < 9 compatibility. Remove this when
// we have a minimum iOS verion of 9.0+
- (id)nativePinColor
{
id current = [self valueForUndefinedKey:@"pincolor"];

if ([current isKindOfClass:[NSString class]]) {
return [[TiUtils colorValue:current] color];
}

switch ([TiUtils intValue:current def:TiMapAnnotationPinColorRed]) {
case TiMapAnnotationPinColorGreen: {
return [MKPinAnnotationView greenPinColor];
}
case TiMapAnnotationPinColorPurple: {
return [MKPinAnnotationView purplePinColor];
}
case TiMapAnnotationPinColorBlue:
return [UIColor blueColor];
case TiMapAnnotationPinColorCyan:
return [UIColor cyanColor];
case TiMapAnnotationPinColorMagenta:
return [UIColor magentaColor];
case TiMapAnnotationPinColorOrange:
return [UIColor orangeColor];
case TiMapAnnotationPinColorYellow:
return [UIColor yellowColor];

// UIColor extensions
case TiMapAnnotationPinColorAzure:
return [UIColor azureColor];
case TiMapAnnotationPinColorRose:
return [UIColor roseColor];
case TiMapAnnotationPinColorViolet:
return [UIColor violetColor];
case TiMapAnnotationPinColorRed:
default: {
return [MKPinAnnotationView redPinColor];
}
}
}

- (BOOL)animatesDrop
{
return [TiUtils boolValue:[self valueForUndefinedKey:@"animate"]];
Expand Down Expand Up @@ -442,6 +485,7 @@ - (void)setAnnotationDisplayPriority:(id)displayPriority
}
}

#if IS_IOS_11
- (void)setClusterIdentifier:(id)clusterIdentifier
{
id current = [self valueForUndefinedKey:@"clusterIdentifier"];
Expand All @@ -450,6 +494,7 @@ - (void)setClusterIdentifier:(id)clusterIdentifier
[self setNeedsRefreshingWithSelection:YES];
}
}
#endif

- (void)setCustomView:(id)customView
{
Expand Down
2 changes: 2 additions & 0 deletions ios/Classes/TiMapMarkerAnnotationView.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
#if IS_IOS_11
#import "TiBase.h"
#import "TiMapView.h"
#import <MapKit/MapKit.h>
Expand All @@ -17,3 +18,4 @@
- (NSString *)lastHitName;

@end
#endif
2 changes: 2 additions & 0 deletions ios/Classes/TiMapMarkerAnnotationView.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
#if IS_IOS_11
#import "TiMapMarkerAnnotationView.h"
#import "TiMapAnnotationProxy.h"
#import "TiMapView.h"
Expand Down Expand Up @@ -63,3 +64,4 @@ - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
return result;
}
@end
#endif
4 changes: 2 additions & 2 deletions ios/Classes/TiMapModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
UIColor *colorRed;
}

+ (void)logAddedIniOS7Warning:(NSString *)name;

@property (nonatomic, readonly) NSNumber *STANDARD_TYPE;
@property (nonatomic, readonly) NSNumber *NORMAL_TYPE; // For parity with Android
@property (nonatomic, readonly) NSNumber *SATELLITE_TYPE;
@property (nonatomic, readonly) NSNumber *HYBRID_TYPE;
@property (nonatomic, readonly) NSNumber *HYBRID_FLYOVER_TYPE;
@property (nonatomic, readonly) NSNumber *SATELLITE_FLYOVER_TYPE;
#if IS_IOS_11
@property (nonatomic, readonly) NSNumber *MUTED_STANDARD_TYPE;
#endif

@property (nonatomic, readonly) NSNumber *ANNOTATION_RED;
@property (nonatomic, readonly) NSNumber *ANNOTATION_GREEN;
Expand Down
11 changes: 4 additions & 7 deletions ios/Classes/TiMapModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ - (NSString *)apiName
return @"Ti.Map";
}

#pragma mark Utils

+ (void)logAddedIniOS7Warning:(NSString *)name
{
NSLog(@"[WARN] `%@` is only supported on iOS 7 and greater.", name);
}

#pragma mark Public APIs

- (TiMapViewProxy *)createView:(id)args
Expand All @@ -57,7 +50,9 @@ - (TiMapCameraProxy *)createCamera:(id)args
MAKE_SYSTEM_PROP(HYBRID_TYPE, MKMapTypeHybrid);
MAKE_SYSTEM_PROP(HYBRID_FLYOVER_TYPE, MKMapTypeHybridFlyover);
MAKE_SYSTEM_PROP(SATELLITE_FLYOVER_TYPE, MKMapTypeSatelliteFlyover);
#if IS_IOS_11
MAKE_SYSTEM_PROP(MUTED_STANDARD_TYPE, MKMapTypeMutedStandard);
#endif
MAKE_SYSTEM_PROP(ANNOTATION_RED, TiMapAnnotationPinColorRed);
MAKE_SYSTEM_PROP(ANNOTATION_GREEN, TiMapAnnotationPinColorGreen);
MAKE_SYSTEM_PROP(ANNOTATION_PURPLE, TiMapAnnotationPinColorPurple);
Expand All @@ -82,6 +77,7 @@ - (TiMapCameraProxy *)createCamera:(id)args
MAKE_SYSTEM_PROP(POLYLINE_PATTERN_DASHED, TiMapOverlyPatternTypeDashed);
MAKE_SYSTEM_PROP(POLYLINE_PATTERN_DOTTED, TiMapOverlyPatternTypeDotted);

#if IS_IOS_11
MAKE_SYSTEM_PROP(FEATURE_VISIBILITY_ADAPTIVE, MKFeatureVisibilityAdaptive);
MAKE_SYSTEM_PROP(FEATURE_VISIBILITY_HIDDEN, MKFeatureVisibilityHidden);
MAKE_SYSTEM_PROP(FEATURE_VISIBILITY_VISIBLE, MKFeatureVisibilityVisible);
Expand All @@ -92,5 +88,6 @@ - (TiMapCameraProxy *)createCamera:(id)args
MAKE_SYSTEM_PROP_DBL(FEATURE_DISPLAY_PRIORITY_REQUIRED, MKFeatureDisplayPriorityRequired);
MAKE_SYSTEM_PROP_DBL(FEATURE_DISPLAY_PRIORITY_DEFAULT_HIGH, MKFeatureDisplayPriorityDefaultHigh);
MAKE_SYSTEM_PROP_DBL(FEATURE_DISPLAY_PRIORITY_DEFAULT_LOW, MKFeatureDisplayPriorityDefaultLow);
#endif

@end
2 changes: 1 addition & 1 deletion ios/Classes/TiMapPinAnnotationView.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "TiMapView.h"
#import <MapKit/MapKit.h>

@interface TiMapPinAnnotationView : MKMarkerAnnotationView <TiMapAnnotation> {
@interface TiMapPinAnnotationView : MKPinAnnotationView <TiMapAnnotation> {
@private

NSString *lastHitName;
Expand Down
6 changes: 5 additions & 1 deletion ios/Classes/TiMapView.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
NSMutableArray *circleProxies;
NSMutableArray *polylineProxies;
NSMutableArray *imageOverlayProxies;
NSMutableDictionary *clusterAnnotations;

#if IS_IOS_11
NSMutableDictionary *clusterAnnotations;
#endif
//selected annotation
MKAnnotationView<TiMapAnnotation> *selectedAnnotation;

Expand Down Expand Up @@ -93,7 +95,9 @@
- (void)removeAllImageOverlays;

- (void)firePinChangeDragState:(MKAnnotationView *)pinview newState:(MKAnnotationViewDragState)newState fromOldState:(MKAnnotationViewDragState)oldState;
#if IS_IOS_11
- (void)setClusterAnnotation:(TiMapAnnotationProxy *)annotation forMembers:(NSArray<TiMapAnnotationProxy *> *)members;
#endif
- (void)animateAnnotation:(TiMapAnnotationProxy *)newAnnotation withLocation:(CLLocationCoordinate2D)newLocation;

#pragma mark Utils
Expand Down
43 changes: 34 additions & 9 deletions ios/Classes/TiMapView.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ - (void)dealloc
RELEASE_TO_NIL(polylineProxies);
RELEASE_TO_NIL(circleProxies);
RELEASE_TO_NIL(imageOverlayProxies);
#if IS_IOS_11
RELEASE_TO_NIL(clusterAnnotations);
#endif
[super dealloc];
}

Expand Down Expand Up @@ -917,6 +919,7 @@ - (void)showAnnotations:(id)args
NO);
}

#if IS_IOS_11
- (void)setClusterAnnotation:(TiMapAnnotationProxy *)annotation forMembers:(NSArray<TiMapAnnotationProxy *> *)members
{
if (!clusterAnnotations) {
Expand All @@ -935,6 +938,7 @@ - (TiMapAnnotationProxy *)clusterAnnotationProxyForMembers:(NSArray *)members
{
return [clusterAnnotations objectForKey:members];
}
#endif

#pragma mark Utils

Expand Down Expand Up @@ -1128,7 +1132,7 @@ - (void)mapView:(MKMapView *)mapView didDeselectAnnotationView:(MKAnnotationView
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)aview calloutAccessoryControlTapped:(UIControl *)control
{
if ([aview conformsToProtocol:@protocol(TiMapAnnotation)]) {
MKMarkerAnnotationView *pinview = (MKMarkerAnnotationView *)aview;
MKPinAnnotationView *pinview = (MKPinAnnotationView *)aview;
NSString *clickSource = @"unknown";
if (aview.leftCalloutAccessoryView == control) {
clickSource = @"leftButton";
Expand All @@ -1153,27 +1157,34 @@ - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotationProxy:(TiMap
if (customView == nil && !marker) {
id imagePath = [ann valueForUndefinedKey:@"image"];
image = [TiUtils image:imagePath proxy:ann];
identifier = (image != nil) ? @"timap-image" : @"timap-marker";
identifier = (image != nil) ? @"timap-image" : @"timap-pin";
} else if (customView) {
identifier = @"timap-customView";
} else {
identifier = @"timap-marker";
}
MKAnnotationView *annView = nil;
annView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:identifier];

if (annView == nil) {
if ([identifier isEqualToString:@"timap-customView"]) {
annView = [[[TiMapCustomAnnotationView alloc] initWithAnnotation:ann reuseIdentifier:identifier map:self] autorelease];
#if IS_IOS_11
} else if ([TiMapView isiOS11OrGreater] && [identifier isEqualToString:@"timap-marker"]) {
annView = [[[TiMapMarkerAnnotationView alloc] initWithAnnotation:ann reuseIdentifier:identifier map:self] autorelease];
#endif
} else if ([identifier isEqualToString:@"timap-image"]) {
annView = [[[TiMapImageAnnotationView alloc] initWithAnnotation:ann reuseIdentifier:identifier map:self image:image] autorelease];
} else {
annView = [[[TiMapMarkerAnnotationView alloc] initWithAnnotation:ann reuseIdentifier:identifier map:self] autorelease];
annView = [[[TiMapPinAnnotationView alloc] initWithAnnotation:ann reuseIdentifier:identifier map:self] autorelease];
}
}
if ([identifier isEqualToString:@"timap-customView"]) {
[((TiMapCustomAnnotationView *)annView) setProxy:customView];
} else if ([identifier isEqualToString:@"timap-image"]) {
annView.image = image;
} else {
#if IS_IOS_11
} else if ([TiMapView isiOS11OrGreater] && [identifier isEqualToString:@"timap-marker"]) {
MKMarkerAnnotationView *markerView = (MKMarkerAnnotationView *)annView;
markerView.markerTintColor = [[TiUtils colorValue:[ann valueForUndefinedKey:@"markerColor"]] color];
markerView.glyphText = [ann valueForUndefinedKey:@"markerGlyphText"];
Expand All @@ -1183,14 +1194,24 @@ - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotationProxy:(TiMap
markerView.selectedGlyphImage = [TiUtils image:[ann valueForUndefinedKey:@"markerSelectedGlyphImage"] proxy:ann];
markerView.titleVisibility = [TiUtils intValue:[ann valueForUndefinedKey:@"markerTitleVisibility"]];
markerView.subtitleVisibility = [TiUtils intValue:[ann valueForUndefinedKey:@"markerSubtitleVisibility"]];
}
#endif
} else {
MKPinAnnotationView *pinview = (MKPinAnnotationView *)annView;

pinview.pinTintColor = [ann nativePinColor];
pinview.animatesDrop = [ann animatesDrop] && ![ann placed];
annView.calloutOffset = CGPointMake(-8, 0);
}
annView.canShowCallout = [TiUtils boolValue:[ann valueForUndefinedKey:@"canShowCallout"] def:YES];
annView.enabled = YES;
annView.centerOffset = ann.offset;
annView.clusteringIdentifier = [ann valueForUndefinedKey:@"clusterIdentifier"];
annView.collisionMode = [TiUtils intValue:[ann valueForUndefinedKey:@"collisionMode"]];
annView.displayPriority = [TiUtils floatValue:[ann valueForUndefinedKey:@"annotationDisplayPriority"] def:1000];
#if IS_IOS_11
if ([TiMapView isiOS11OrGreater]) {
annView.clusteringIdentifier = [ann valueForUndefinedKey:@"clusterIdentifier"];
annView.collisionMode = [TiUtils intValue:[ann valueForUndefinedKey:@"collisionMode"]];
annView.displayPriority = [TiUtils floatValue:[ann valueForUndefinedKey:@"annotationDisplayPriority"] def:1000];
}
#endif

UIView *left = [ann leftViewAccessory];
UIView *right = [ann rightViewAccessory];
Expand Down Expand Up @@ -1248,7 +1269,8 @@ - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnot
if ([annotation isKindOfClass:[TiMapAnnotationProxy class]]) {
TiMapAnnotationProxy *annotationProxy = (TiMapAnnotationProxy *)annotation;
return [self mapView:mapView viewForAnnotationProxy:annotationProxy];
} else if ([annotation isKindOfClass:[MKClusterAnnotation class]]) {
#if IS_IOS_11
} else if ([TiMapView isiOS11OrGreater] && [annotation isKindOfClass:[MKClusterAnnotation class]]) {
TiMapAnnotationProxy *annotationProxy = [self clusterAnnotationProxyForMembers:((MKClusterAnnotation *)annotation).memberAnnotations];
if (!annotationProxy) {
return nil;
Expand All @@ -1257,10 +1279,12 @@ - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnot
clusterAnnotation.title = [annotationProxy valueForUndefinedKey:@"title"];
clusterAnnotation.subtitle = [annotationProxy valueForUndefinedKey:@"subtitle"];
return [self mapView:mapView viewForAnnotationProxy:annotationProxy];
#endif
}
return nil;
}

#if IS_IOS_11
- (MKClusterAnnotation *)mapView:(MKMapView *)mapView clusterAnnotationForMemberAnnotations:(NSArray<id<MKAnnotation>> *)memberAnnotations
{
MKClusterAnnotation *annotation = [[MKClusterAnnotation alloc] initWithMemberAnnotations:memberAnnotations];
Expand All @@ -1273,6 +1297,7 @@ - (MKClusterAnnotation *)mapView:(MKMapView *)mapView clusterAnnotationForMember
}
return annotation;
}
#endif

// mapView:didAddAnnotationViews: is called after the annotation views have been added and positioned in the map.
// The delegate can implement this method to animate the adding of the annotations views.
Expand Down
2 changes: 2 additions & 0 deletions ios/Classes/TiMapViewProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,7 @@
- (void)removeImageOverlay:(id)arg;
- (void)removeAllImageOverlays:(id)args;

#if IS_IOS_11
- (void)setClusterAnnotation:(id)args;
#endif
@end
2 changes: 2 additions & 0 deletions ios/Classes/TiMapViewProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,7 @@ - (void)setImageOverlays:(id)args
}
}

#if IS_IOS_11
- (void)setClusterAnnotation:(id)args
{
ENSURE_DICT(args);
Expand All @@ -876,6 +877,7 @@ - (void)setClusterAnnotation:(id)args
[(TiMapView *)[self view] setClusterAnnotation:annotationProxy forMembers:memberAnnotations];
}
}
#endif

#pragma mark Public APIs iOS 7

Expand Down
6 changes: 6 additions & 0 deletions ios/TiMap_Prefix.pch
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#endif

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
#define IS_IOS_11 true
#else
#define IS_IOS_11 false
#endif
4 changes: 2 additions & 2 deletions ios/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# during compilation, packaging, distribution, etc.
#

version: 5.1.0
version: 5.1.1
apiversion: 2
architectures: arm64 x86_64
architectures: armv7 arm64 i386 x86_64
description: External version of Map module
author: Jeff Haynie, Jon Alter, Pedro Enrique, Hans Knöchel, Vijay Singh
license: Apache Public License v2
Expand Down
6 changes: 3 additions & 3 deletions ios/map.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@
GCC_WARN_UNUSED_VALUE = NO;
GCC_WARN_UNUSED_VARIABLE = NO;
INSTALL_PATH = /usr/local/lib;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
LIBRARY_SEARCH_PATHS = "";
OTHER_CFLAGS = "-DTI_POST_1_2";
OTHER_LDFLAGS = "-ObjC";
Expand Down Expand Up @@ -555,7 +555,7 @@
GCC_WARN_UNUSED_VALUE = NO;
GCC_WARN_UNUSED_VARIABLE = NO;
INSTALL_PATH = /usr/local/lib;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
"-DDEBUG",
Expand Down Expand Up @@ -595,7 +595,7 @@
GCC_WARN_UNUSED_VALUE = NO;
GCC_WARN_UNUSED_VARIABLE = NO;
INSTALL_PATH = /usr/local/lib;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
OTHER_CFLAGS = "-DTI_POST_1_2";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = TiMap;
Expand Down
Loading

0 comments on commit 446b9a6

Please sign in to comment.