Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-11187] (2_1_X) Adview crash #3065

Merged
merged 2 commits into from
Sep 27, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions iphone/Classes/TiRootViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,20 @@ - (void) viewDidDisappear:(BOOL)animated

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
//IOS6. If we are presenting a modal view controller, get the preferred
//presentation orientation from the modal view controller
id<TiUIViewControllerIOS6Support> topmostController = [self topmostViewController];
if (topmostController != self) {
//If I am a modal window then send out orientationFlags property
if ([topmostController isKindOfClass:[UINavigationController class]]) {
UIViewController* topVC = [(UINavigationController *)topmostController topViewController];
if ( topVC != nil && ([topVC isKindOfClass:[TiViewController class]]) ) {
return [self lastValidOrientation];
}
}
//Send out whatever the View Controller supports
return [topmostController preferredInterfaceOrientationForPresentation];
}
return [self lastValidOrientation];
}

Expand Down
1 change: 1 addition & 0 deletions iphone/Classes/TiUIiOSAdView.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#ifdef USE_TI_UIIOSADVIEW

#import "TiUIiOSAdViewProxy.h"
#import <iAd/iAd.h>

@interface TiUIiOSAdView : TiUIView<ADBannerViewDelegate> {
Expand Down
6 changes: 1 addition & 5 deletions iphone/Classes/TiUIiOSAdView.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@ - (void)bannerViewDidLoadAd:(ADBannerView *)banner
WARN_IF_BACKGROUND_THREAD_OBJ; //NSNotificationCenter is not threadsafe!
[[NSNotificationCenter defaultCenter] postNotificationName:kTiAnalyticsNotification object:nil userInfo:event];
}
if ([self.proxy _hasListeners:@"load"])
{
NSMutableDictionary *event = [NSMutableDictionary dictionary];
[self.proxy fireEvent:@"load" withObject:event];
}
[(TiUIiOSAdViewProxy*) self.proxy fireLoad:nil];
}

- (void)bannerViewActionDidFinish:(ADBannerView *)banner
Expand Down
3 changes: 2 additions & 1 deletion iphone/Classes/TiUIiOSAdViewProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
// must be class-available rather than instance-available
+(NSString*)portraitSize;
+(NSString*)landscapeSize;

#pragma mark internal
-(void)fireLoad:(id)unused;
@end

#endif
20 changes: 20 additions & 0 deletions iphone/Classes/TiUIiOSAdViewProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ +(NSString*)landscapeSize
return @"ADBannerContentSize480x32";
}

-(TiDimension)defaultAutoWidthBehavior:(id)unused
{
return TiDimensionAutoSize;
}
-(TiDimension)defaultAutoHeightBehavior:(id)unused
{
return TiDimensionAutoSize;
}

USE_VIEW_FOR_CONTENT_HEIGHT
USE_VIEW_FOR_CONTENT_WIDTH

Expand Down Expand Up @@ -66,6 +75,17 @@ -(void)setAdSize:(id)arg
[self makeViewPerformSelector:@selector(setAdSize:) withObject:arg createIfNeeded:YES waitUntilDone:NO];
}

-(void)fireLoad:(id)unused
{
if ([self _hasListeners:@"load"])
{
NSMutableDictionary *event = [NSMutableDictionary dictionary];
[self fireEvent:@"load" withObject:event];
}

[self contentsWillChange];
}

@end

#endif