[iOS] Change operators to macros from config.h

This commit is contained in:
Kirill Zhdanovich 2013-09-02 11:50:55 +03:00 committed by Alex Zolotarev
parent 64c0e5db84
commit ccaa2ad56f
9 changed files with 33 additions and 33 deletions

View file

@ -219,7 +219,7 @@
if (buttonIndex != alertView.cancelButtonIndex)
{
// Launch appstore
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:MAPSWITHME_PREMIUM_APPSTORE_URL]];
[APP openURL:[NSURL URLWithString:MAPSWITHME_PREMIUM_APPSTORE_URL]];
[[Statistics instance] logProposalReason:@"Bookmark Screen" withAnswer:@"YES"];
}
else

View file

@ -144,7 +144,7 @@ typedef enum {Editing, Saved} Mode;
if ([_pinTitle isEqualToString:NSLocalizedString(@"dropped_pin", nil)])
[[[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]].contentView viewWithTag:TEXTFIELD_TAG] becomeFirstResponder];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
if (isIPad)
{
CGSize size = CGSizeMake(320, 480);
self.contentSizeForViewInPopover = size;
@ -319,7 +319,7 @@ typedef enum {Editing, Saved} Mode;
-(void)pushToNavigationControllerAndSetControllerToPopoverSize:(UIViewController *)vc
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
if (isIPad)
[vc setContentSizeForViewInPopover:[self contentSizeForViewInPopover]];
[self.navigationController pushViewController:vc animated:YES];
}
@ -331,7 +331,7 @@ typedef enum {Editing, Saved} Mode;
-(void)getSuperView:(double &)height width:(double &)width rect:(CGRect &)rect
{
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad)
if (isIPhone)
{
rect = [UIScreen mainScreen].bounds;
height = self.view.window.frame.size.height;
@ -614,7 +614,7 @@ typedef enum {Editing, Saved} Mode;
-(void)goToTheMap
{
GetFramework().GetBalloonManager().Hide();
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
if (isIPad)
[[MapsAppDelegate theApp].m_mapViewController dismissPopover];
else
[self.navigationController popToRootViewControllerAnimated:YES];
@ -700,11 +700,11 @@ typedef enum {Editing, Saved} Mode;
[self.pickerView setBackgroundColor:[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.5]];
UITapGestureRecognizer * tap = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissPicker)] autorelease];
[self.pickerView addGestureRecognizer:tap];
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad)
if (isIPhone)
{
UIWindow * window = [UIApplication sharedApplication].keyWindow;
UIWindow * window = APP.keyWindow;
if (!window)
window = [[UIApplication sharedApplication].windows objectAtIndex:0];
window = [APP.windows objectAtIndex:0];
[[[window subviews] objectAtIndex:0] addSubview:self.pickerView];
}
else

View file

@ -66,7 +66,7 @@
if (indexPath.section == 0)
{
AddSetVC * asVC = [[AddSetVC alloc] initWithIndex:m_index];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
if (isIPad)
[asVC setContentSizeForViewInPopover:[self contentSizeForViewInPopover]];
[self.navigationController pushViewController:asVC animated:YES];
[asVC release];

View file

@ -15,18 +15,18 @@
{
NSString * z = [NSString stringWithUTF8String:apiPoint.m_id.c_str()];
NSURL * url = [NSURL URLWithString:z];
if ([[UIApplication sharedApplication] canOpenURL:url])
[[UIApplication sharedApplication] openURL:url];
if ([APP canOpenURL:url])
[APP openURL:url];
else
[[UIApplication sharedApplication] openURL:[MWMApi getBackUrl:apiPoint]];
[APP openURL:[MWMApi getBackUrl:apiPoint]];
}
+(BOOL)canOpenApiUrl:(url_scheme::ApiPoint const &)apiPoint
{
NSString * z = [NSString stringWithUTF8String:apiPoint.m_id.c_str()];
if ([[UIApplication sharedApplication]canOpenURL:[NSURL URLWithString:z]])
if ([APP canOpenURL:[NSURL URLWithString:z]])
return YES;
if ([[UIApplication sharedApplication]canOpenURL:[MWMApi getBackUrl:apiPoint]])
if ([APP canOpenURL:[MWMApi getBackUrl:apiPoint]])
return YES;
return NO;
}

View file

@ -621,7 +621,7 @@ NSInteger compareAddress(id l, id r, void * context)
case FACEBOOK_ALERT_VIEW:
{
NSString * url = [NSString stringWithFormat: FACEBOOK_SCHEME];
if (![[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString: url]])
if (![APP canOpenURL: [NSURL URLWithString: url]])
url = [NSString stringWithFormat: FACEBOOK_URL];
[self manageAlert:buttonIndex andUrl:[NSURL URLWithString: url] andDlgSetting:dlg_settings::FacebookDlg];
return;
@ -643,7 +643,7 @@ NSInteger compareAddress(id l, id r, void * context)
case 1:
{
dlg_settings::SaveResult(set, dlg_settings::OK);
[[UIApplication sharedApplication] openURL: url];
[APP openURL: url];
break;
}
case 2:
@ -705,13 +705,13 @@ NSInteger compareAddress(id l, id r, void * context)
-(void) returnToApiApp
{
[[UIApplication sharedApplication] openURL:[MapViewController getBackUrl]];
[APP openURL:[MapViewController getBackUrl]];
[self clearApiMode];
}
-(BOOL) shouldShowNavBar
{
return (_isApiMode && [[UIApplication sharedApplication] canOpenURL:[MapViewController getBackUrl]]);
return (_isApiMode && [APP canOpenURL:[MapViewController getBackUrl]]);
}
- (void)dismissPopover
@ -762,7 +762,7 @@ NSInteger compareAddress(id l, id r, void * context)
-(void)pushViewController:(UIViewController *)vc
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
if (isIPad)
{
UINavigationController * navC = [[UINavigationController alloc] init];
m_popover = [[UIPopoverController alloc] initWithContentViewController:navC];

View file

@ -46,7 +46,7 @@ void InitLocalizedStrings()
+ (MapsAppDelegate *) theApp
{
return (MapsAppDelegate *)[[UIApplication sharedApplication] delegate];
return (MapsAppDelegate *)[APP delegate];
}
- (void) applicationWillTerminate: (UIApplication *) application
@ -115,7 +115,7 @@ void InitLocalizedStrings()
- (void) disableStandby
{
++m_standbyCounter;
[UIApplication sharedApplication].idleTimerDisabled = YES;
APP.idleTimerDisabled = YES;
}
- (void) enableStandby
@ -123,7 +123,7 @@ void InitLocalizedStrings()
--m_standbyCounter;
if (m_standbyCounter <= 0)
{
[UIApplication sharedApplication].idleTimerDisabled = NO;
APP.idleTimerDisabled = NO;
m_standbyCounter = 0;
}
}
@ -133,11 +133,11 @@ void InitLocalizedStrings()
--m_activeDownloadsCounter;
if (m_activeDownloadsCounter <= 0)
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
APP.networkActivityIndicatorVisible = NO;
m_activeDownloadsCounter = 0;
if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground)
if ([APP applicationState] == UIApplicationStateBackground)
{
[[UIApplication sharedApplication] endBackgroundTask:m_backgroundTask];
[APP endBackgroundTask:m_backgroundTask];
m_backgroundTask = UIBackgroundTaskInvalid;
}
}
@ -146,7 +146,7 @@ void InitLocalizedStrings()
- (void) enableDownloadIndicator
{
++m_activeDownloadsCounter;
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
APP.networkActivityIndicatorVisible = YES;
}
// We process memory warnings in MapsViewController
@ -294,7 +294,7 @@ void InitLocalizedStrings()
{
[[Statistics instance] logEvent:@"Download Guides Proposal" withParameters:@{@"Answer" : @"YES"}];
NSURL * url = [NSURL URLWithString:self.lastGuidesUrl];
[[UIApplication sharedApplication] openURL:url];
[APP openURL:url];
}
else
[[Statistics instance] logEvent:@"Download Guides Proposal" withParameters:@{@"Answer" : @"NO"}];
@ -350,7 +350,7 @@ void InitLocalizedStrings()
string const appID = guide.GetAppID();
if (guidesManager.WasAdvertised(appID) ||
[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:[NSString stringWithUTF8String:appID.c_str()]]])
[APP canOpenURL:[NSURL URLWithString:[NSString stringWithUTF8String:appID.c_str()]]])
return NO;
UILocalNotification * notification = [[UILocalNotification alloc] init];
@ -369,7 +369,7 @@ void InitLocalizedStrings()
@"GuideMessage" : message
};
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
[APP scheduleLocalNotification:notification];
[notification release];
guidesManager.SetWasAdvertised(appID);

View file

@ -77,7 +77,7 @@ typedef enum {APIPOINT, POI, MYPOSITION} Type;
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
if (isIPad)
self.contentSizeForViewInPopover = CGSizeMake(320, 480);;
}
@ -255,7 +255,7 @@ typedef enum {APIPOINT, POI, MYPOSITION} Type;
if (buttonIndex != alertView.cancelButtonIndex)
{
// Launch appstore
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:MAPSWITHME_PREMIUM_APPSTORE_URL]];
[APP openURL:[NSURL URLWithString:MAPSWITHME_PREMIUM_APPSTORE_URL]];
[[Statistics instance] logProposalReason:@"Balloon Touch" withAnswer:@"YES"];
}
else

View file

@ -266,7 +266,7 @@ static void OnSearchResultCallback(search::Results const & res)
if (buttonIndex != alertView.cancelButtonIndex)
{
// Launch appstore
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:MAPSWITHME_PREMIUM_APPSTORE_URL]];
[APP openURL:[NSURL URLWithString:MAPSWITHME_PREMIUM_APPSTORE_URL]];
[[Statistics instance] logProposalReason:@"Search Screen" withAnswer:@"YES"];
}
else

View file

@ -504,7 +504,7 @@ static bool IsOurIndex(TIndex const & theirs, TIndex const & ours)
if (!GetFramework().GetGuideInfo(index, info))
return;
NSURL * guideUrl = [NSURL URLWithString:[NSString stringWithUTF8String:info.GetAppID().c_str()]];
UIApplication * app = [UIApplication sharedApplication];
UIApplication * app = APP;
if ([app canOpenURL:guideUrl])
[app openURL:guideUrl];
else