Skip to content

Commit

Permalink
Merge pull request #292 from vikas-goyal-axway/MOD-2374
Browse files Browse the repository at this point in the history
  • Loading branch information
saumya-rai-axway authored May 20, 2020
2 parents 00ff369 + 80778b2 commit 16992e3
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 8 deletions.
19 changes: 15 additions & 4 deletions ios/Classes/TiMapAnnotationProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ - (void)setNeedsRefreshingWithSelection:(BOOL)shouldReselect
}
}

- (void)refreshCoordinateChanges:(void (^)())updateValueCallBack
{
if (delegate != nil && [delegate viewAttached]) {
[(TiMapView *)[delegate view] refreshCoordinateChanges:self afterRemove:updateValueCallBack];
} else {
updateValueCallBack();
}
}

- (void)refreshIfNeeded
{
@synchronized(self) {
Expand Down Expand Up @@ -138,19 +147,21 @@ - (void)setLatitude:(id)latitude
{
double curValue = [TiUtils doubleValue:[self valueForUndefinedKey:@"latitude"]];
double newValue = [TiUtils doubleValue:latitude];
[self replaceValue:latitude forKey:@"latitude" notification:NO];
if (newValue != curValue) {
[self setNeedsRefreshingWithSelection:YES];
[self refreshCoordinateChanges:^{
[self replaceValue:latitude forKey:@"latitude" notification:NO];
}];
}
}

- (void)setLongitude:(id)longitude
{
double curValue = [TiUtils doubleValue:[self valueForUndefinedKey:@"longitude"]];
double newValue = [TiUtils doubleValue:longitude];
[self replaceValue:longitude forKey:@"longitude" notification:NO];
if (newValue != curValue) {
[self setNeedsRefreshingWithSelection:YES];
[self refreshCoordinateChanges:^{
[self replaceValue:longitude forKey:@"longitude" notification:NO];
}];
}
}

Expand Down
1 change: 1 addition & 0 deletions ios/Classes/TiMapView.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,6 @@
#pragma mark Framework
- (void)refreshAnnotation:(TiMapAnnotationProxy *)proxy readd:(BOOL)yn;
- (void)fireClickEvent:(MKAnnotationView *)pinview source:(NSString *)source deselected:(BOOL)deselected;
- (void)refreshCoordinateChanges:(TiMapAnnotationProxy *)proxy afterRemove:(void (^)())callBack;

@end
15 changes: 15 additions & 0 deletions ios/Classes/TiMapView.m
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,21 @@ - (void)refreshAnnotation:(TiMapAnnotationProxy *)proxy readd:(BOOL)yn
ignoreClicks = NO;
}

- (void)refreshCoordinateChanges:(TiMapAnnotationProxy *)proxy afterRemove:(void (^)())callBack
{
NSArray *selected = map.selectedAnnotations;
BOOL wasSelected = [selected containsObject:proxy]; //If selected == nil, this still returns FALSE.
ignoreClicks = YES;
[map removeAnnotation:proxy];
callBack();
[map addAnnotation:proxy];
[map setNeedsLayout];
if (wasSelected) {
[map selectAnnotation:proxy animated:NO];
}
ignoreClicks = NO;
}

#pragma mark Public APIs

- (void)addAnnotation:(id)args
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.3.0
version: 3.3.1
apiversion: 2
architectures: armv7 arm64 i386 x86_64
description: External version of Map module
Expand Down
2 changes: 1 addition & 1 deletion ios/titanium.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// OF YOUR TITANIUM SDK YOU'RE BUILDING FOR
//
//
TITANIUM_SDK_VERSION = 9.0.0.v20200205142057
TITANIUM_SDK_VERSION = 9.0.0.GA

//
// THESE SHOULD BE OK GENERALLY AS-IS
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@titanium-sdk/ti.map",
"version": "5.0.1",
"version": "5.0.2",
"description": "Provides Map UI elements for Titanium applications",
"scripts": {
"commit": "git-cz",
Expand Down

0 comments on commit 16992e3

Please sign in to comment.