Skip to content

Commit

Permalink
Merge pull request #4237 from vishalduggal/timob-13560
Browse files Browse the repository at this point in the history
[TIMOB-13560] iOS: bubbleParent property does not work properly
  • Loading branch information
srahim committed May 9, 2013
2 parents 0a20a96 + 3641438 commit 9d91a12
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion iphone/Classes/KrollObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ -(void)setValue:(id)value forKey:(NSString *)key
return;
}
selector = NSSelectorFromString([NSString stringWithFormat:@"set%@:",name]);
if ([target respondsToSelector:selector] && ![name isEqualToString:@"ZIndex"] && ![name isEqualToString:@"BubbleParent"])//TODO: Quick hack is quick.
if ([target respondsToSelector:selector] && ![name isEqualToString:@"ZIndex"])//TODO: Quick hack is quick.
{
[target performSelector:selector withObject:value];
}
Expand Down
2 changes: 1 addition & 1 deletion iphone/Classes/TiBindingEvent.m
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void TiBindingEventSetBubbles(TiBindingEvent event, bool bubbles)
{
while (![currentTarget _hasListeners:event->eventString] || parentOnly)
{
if (![currentTarget bubbleParent] || !event->bubbles || event->cancelBubble)
if (!currentTarget->_bubbleParent || !event->bubbles || event->cancelBubble)
{ //If currentTarget is nil, this triggers as well.
return nil;
}
Expand Down
5 changes: 3 additions & 2 deletions iphone/Classes/TiProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void DoProxyDelegateReadValuesWithKeysFromProxy(UIView<TiProxyDelegate> * target
*/
@interface TiProxy : NSObject<KrollTargetable> {
@public
BOOL bubbleParent;
BOOL _bubbleParent;

@private
NSMutableDictionary *listeners;
Expand Down Expand Up @@ -225,7 +225,8 @@ void DoProxyDelegateReadValuesWithKeysFromProxy(UIView<TiProxyDelegate> * target
is the type that has a parent to bubble to (This is primairly views, but may
have some exceptions).
*/
@property(nonatomic,readwrite,assign) BOOL bubbleParent;
-(NSNumber*)bubbleParent;
-(void)setBubbleParent:(id)arg;

#pragma mark Utility
-(KrollObject *)krollObjectForContext:(KrollContext *)context;
Expand Down
14 changes: 11 additions & 3 deletions iphone/Classes/TiProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ -(id)init
{
if (self = [super init])
{
bubbleParent = YES;
_bubbleParent = YES;
#if PROXY_MEMORY_TRACK == 1
NSLog(@"[DEBUG] INIT: %@ (%d)",self,[self hash]);
#endif
Expand Down Expand Up @@ -563,8 +563,6 @@ -(id)_proxy:(TiProxyBridgeType)type

#pragma mark Public

@synthesize bubbleParent;

-(id<NSFastEnumeration>)allKeys
{
pthread_rwlock_rdlock(&dynpropsLock);
Expand All @@ -574,6 +572,16 @@ -(id)_proxy:(TiProxyBridgeType)type
return keys;
}

-(NSNumber*)bubbleParent
{
return NUMBOOL(_bubbleParent);
}

-(void)setBubbleParent:(id)arg
{
_bubbleParent = [TiUtils boolValue:arg def:YES];
}

/*
* In views where the order in which keys are applied matter (I'm looking at you, TableView), this should be
* an array of which keys go first, and in what order. Otherwise, this is nil.
Expand Down
2 changes: 1 addition & 1 deletion iphone/Classes/TiViewProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,7 @@ -(id)init
{
destroyLock = [[NSRecursiveLock alloc] init];
pthread_rwlock_init(&childrenLock, NULL);
bubbleParent = YES;
_bubbleParent = YES;
}
return self;
}
Expand Down

0 comments on commit 9d91a12

Please sign in to comment.