Skip to content

Commit

Permalink
fix(ios): add back ios 11 constants to code
Browse files Browse the repository at this point in the history
Rename from IS_XCODE_9 to IS_IOS_SDK_11 per the discussion in #10932
  • Loading branch information
ewanharris committed Aug 1, 2019
1 parent 5d8044e commit a08aa2e
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 3 deletions.
7 changes: 6 additions & 1 deletion iphone/Classes/GeolocationModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,11 @@ - (CLLocationManager *)locationManager

locationManager.allowsBackgroundLocationUpdates = allowsBackgroundLocationUpdates;

#if IS_SDK_IOS_11
if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
locationManager.showsBackgroundLocationIndicator = showBackgroundLocationIndicator;
}

#endif
locationManager.activityType = activityType;
locationManager.pausesLocationUpdatesAutomatically = pauseLocationUpdateAutomatically;

Expand Down Expand Up @@ -603,19 +604,23 @@ - (void)setHeadingFilter:(CLLocationDegrees)value

- (BOOL)showBackgroundLocationIndicator
{
#if IS_SDK_IOS_11
if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
return showBackgroundLocationIndicator;
}
#endif
DebugLog(@"[ERROR] The showBackgroundLocationIndicator property is only available on iOS 11.0+. Returning \"false\" ...");
return NO;
}

- (void)setShowBackgroundLocationIndicator:(BOOL)value
{
#if IS_SDK_IOS_11
if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
showBackgroundLocationIndicator = value;
return;
}
#endif
DebugLog(@"[ERROR] The showBackgroundLocationIndicator property is only available on iOS 11.0+. Ignoring call ...");
}

Expand Down
2 changes: 2 additions & 0 deletions iphone/Classes/TiAppiOSUserNotificationCenterProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,11 @@ - (void)requestUserNotificationSettings:(id)callback
@"carPlaySetting" : @([settings carPlaySetting]),
@"alertStyle" : @([settings alertStyle])
} mutableCopy];
#if IS_SDK_IOS_11
if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
propertiesDict[@"showPreviewsSetting"] = @([settings showPreviewsSetting]);
}
#endif
#if IS_SDK_IOS_12
if ([TiUtils isIOSVersionOrGreater:@"12.0"]) {
propertiesDict[@"criticalAlertSetting"] = @([settings criticalAlertSetting]);
Expand Down
2 changes: 2 additions & 0 deletions iphone/Classes/TiUIListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -2198,6 +2198,7 @@ - (void)viewResignFocus

- (void)viewGetFocus
{
#if IS_SDK_IOS_11
if (isSearchBarInNavigation) {
id proxy = [(TiViewProxy *)self.proxy parent];
while ([proxy isKindOfClass:[TiViewProxy class]] && ![proxy isKindOfClass:[TiWindowProxy class]]) {
Expand All @@ -2213,6 +2214,7 @@ - (void)viewGetFocus
controller.navigationItem.searchController = searchController;
}
}
#endif

if (isSearched && self.searchedString && ![searchController isActive]) {
isSearched = NO;
Expand Down
4 changes: 4 additions & 0 deletions iphone/Classes/TiUINavigationWindowProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ - (void)navigationController:(UINavigationController *)navigationController will
}
}
TiWindowProxy *theWindow = (TiWindowProxy *)[(TiViewController *)viewController proxy];
#if IS_SDK_IOS_11
[theWindow processForSafeArea];
#endif
if ((theWindow != rootWindow) && [theWindow opening]) {
[theWindow windowWillOpen];
[theWindow windowDidOpen];
Expand Down Expand Up @@ -384,6 +386,7 @@ - (void)viewDidDisappear:(BOOL)animated
[super viewDidDisappear:animated];
}

#if IS_SDK_IOS_11
- (BOOL)homeIndicatorAutoHide
{
UIViewController *topVC = [navController topViewController];
Expand All @@ -395,6 +398,7 @@ - (BOOL)homeIndicatorAutoHide
}
return [super homeIndicatorAutoHide];
}
#endif

- (BOOL)hidesStatusBar
{
Expand Down
2 changes: 2 additions & 0 deletions iphone/Classes/TiUIScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ - (TiUIScrollViewImpl *)scrollView

- (void)adjustScrollViewInsets
{
#if IS_SDK_IOS_11
id viewProxy = self.proxy;
while (viewProxy && ![viewProxy isKindOfClass:[TiWindowProxy class]]) {
viewProxy = [viewProxy parent];
Expand All @@ -159,6 +160,7 @@ - (void)adjustScrollViewInsets
[scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
}
}
#endif
}

- (id)accessibilityElement
Expand Down
2 changes: 2 additions & 0 deletions iphone/Classes/TiUITabGroupProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ - (UIStatusBarStyle)preferredStatusBarStyle;
return [super preferredStatusBarStyle];
}

#if IS_SDK_IOS_11
- (BOOL)homeIndicatorAutoHide
{
UITabBarController *tabController = [(TiUITabGroup *)[self view] tabController];
Expand All @@ -276,6 +277,7 @@ - (BOOL)homeIndicatorAutoHide
}
return [super homeIndicatorAutoHide];
}
#endif

- (BOOL)hidesStatusBar
{
Expand Down
8 changes: 6 additions & 2 deletions iphone/Classes/TiUITabProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,9 @@ - (void)openWindow:(NSArray *)args
TiWindowProxy *window = [args objectAtIndex:0];
ENSURE_TYPE(window, TiWindowProxy);

#if IS_SDK_IOS_11
[window processForSafeArea];

#endif
if (window == rootWindow) {
[rootWindow windowWillOpen];
[rootWindow windowDidOpen];
Expand Down Expand Up @@ -383,7 +384,9 @@ - (void)handleWillShowViewController:(UIViewController *)viewController animated
}
}
TiWindowProxy *theWindow = (TiWindowProxy *)[(TiViewController *)viewController proxy];
#if IS_SDK_IOS_11
[theWindow processForSafeArea];
#endif
if (theWindow == rootWindow) {
//This is probably too late for the root view controller.
//Figure out how to call open before this callback
Expand Down Expand Up @@ -738,6 +741,7 @@ - (void)popToRootWindow:(id)args

@synthesize parentOrientationController;

#if IS_SDK_IOS_11
- (BOOL)homeIndicatorAutoHide
{
if (rootWindow == nil) {
Expand All @@ -754,7 +758,7 @@ - (BOOL)homeIndicatorAutoHide
}
return NO;
}

#endif
- (BOOL)hidesStatusBar
{
if (rootWindow == nil) {
Expand Down
2 changes: 2 additions & 0 deletions iphone/Classes/TiUITableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -2355,6 +2355,7 @@ - (void)viewResignFocus

- (void)viewGetFocus
{
#if IS_SDK_IOS_11
if (isSearchBarInNavigation) {
id proxy = [(TiViewProxy *)self.proxy parent];
while ([proxy isKindOfClass:[TiViewProxy class]] && ![proxy isKindOfClass:[TiWindowProxy class]]) {
Expand All @@ -2370,6 +2371,7 @@ - (void)viewGetFocus
controller.navigationItem.searchController = searchController;
}
}
#endif
if (!hideOnSearch && isSearched && self.searchedString && ![searchController isActive]) {
isSearched = NO;
searchController.searchBar.text = self.searchedString;
Expand Down
2 changes: 2 additions & 0 deletions iphone/Classes/TiUIWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@

@end

#if IS_SDK_IOS_11
@interface WebAppProtocolHandler : NSObject <WKURLSchemeHandler> {
}

+ (NSString *)specialProtocolScheme;

@end
#endif

#endif
4 changes: 4 additions & 0 deletions iphone/Classes/TiUIWebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ - (WKWebView *)webView

[config setUserContentController:controller];

#if IS_SDK_IOS_11
if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
if (![WKWebView handlesURLScheme:[WebAppProtocolHandler specialProtocolScheme]]) {
[config setURLSchemeHandler:[[WebAppProtocolHandler alloc] init] forURLScheme:[WebAppProtocolHandler specialProtocolScheme]];
}
}
#endif

_willHandleTouches = [TiUtils boolValue:[[self proxy] valueForKey:@"willHandleTouches"] def:YES];

Expand Down Expand Up @@ -1356,6 +1358,7 @@ - (NSHTTPCookie *)cookieForString:(NSString *)cookieStr

@end

#if IS_SDK_IOS_11
@implementation WebAppProtocolHandler

+ (NSString *)specialProtocolScheme
Expand Down Expand Up @@ -1406,5 +1409,6 @@ - (void)webView:(nonnull WKWebView *)webView stopURLSchemeTask:(nonnull id<WKURL
}

@end
#endif

#endif
2 changes: 2 additions & 0 deletions iphone/Classes/TiUIiOSProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,11 @@
@property (nonatomic, readonly) NSNumber *BLUR_EFFECT_STYLE_DARK;
#endif

#if IS_SDK_IOS_11
@property (nonatomic, readonly) NSNumber *LARGE_TITLE_DISPLAY_MODE_AUTOMATIC;
@property (nonatomic, readonly) NSNumber *LARGE_TITLE_DISPLAY_MODE_ALWAYS;
@property (nonatomic, readonly) NSNumber *LARGE_TITLE_DISPLAY_MODE_NEVER;
#endif

/**
Checks the force touch capibility of the current device.
Expand Down
2 changes: 2 additions & 0 deletions iphone/Classes/TiUIiOSProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,11 @@ - (id)createFeedbackGenerator:(id)args
MAKE_SYSTEM_PROP(FEEDBACK_GENERATOR_IMPACT_STYLE_HEAVY, UIImpactFeedbackStyleHeavy);
#endif

#if IS_SDK_IOS_11
MAKE_SYSTEM_PROP(LARGE_TITLE_DISPLAY_MODE_AUTOMATIC, UINavigationItemLargeTitleDisplayModeAutomatic);
MAKE_SYSTEM_PROP(LARGE_TITLE_DISPLAY_MODE_ALWAYS, UINavigationItemLargeTitleDisplayModeAlways);
MAKE_SYSTEM_PROP(LARGE_TITLE_DISPLAY_MODE_NEVER, UINavigationItemLargeTitleDisplayModeNever);
#endif

#ifdef USE_TI_UIWEBVIEW

Expand Down
4 changes: 4 additions & 0 deletions iphone/Classes/TiUIiOSSplitWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,10 @@ - (void)setMasterView_:(id)args
RELEASE_TO_NIL(masterProxy);
masterProxy = [args retain];

#if IS_SDK_IOS_11
TiWindowProxy *masterWindowProxy = (TiWindowProxy *)masterProxy;
masterWindowProxy.isMasterWindow = YES;
#endif

if (viewsInitialized) {
[self initProxy:masterProxy withWrapper:masterViewWrapper];
Expand All @@ -280,8 +282,10 @@ - (void)setDetailView_:(id)args
RELEASE_TO_NIL(detailProxy);
detailProxy = [args retain];

#if IS_SDK_IOS_11
TiWindowProxy *detailWindowProxy = (TiWindowProxy *)detailProxy;
detailWindowProxy.isDetailWindow = YES;
#endif

if (viewsInitialized) {
[self initProxy:detailProxy withWrapper:detailViewWrapper];
Expand Down
2 changes: 2 additions & 0 deletions iphone/Classes/UIModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,10 @@ - (NSNumber *)ATTRIBUTE_LINE_BREAK_BY_TRUNCATING_MIDDLE
MAKE_SYSTEM_STR(AUTOFILL_TYPE_URL, UITextContentTypeURL);
MAKE_SYSTEM_STR(AUTOFILL_TYPE_CARD_NUMBER, UITextContentTypeCreditCardNumber);

#if IS_SDK_IOS_11
MAKE_SYSTEM_STR(AUTOFILL_TYPE_USERNAME, UITextContentTypeUsername);
MAKE_SYSTEM_STR(AUTOFILL_TYPE_PASSWORD, UITextContentTypePassword);
#endif

#if IS_SDK_IOS_12
MAKE_SYSTEM_STR(AUTOFILL_TYPE_NEW_PASSWORD, UITextContentTypeNewPassword);
Expand Down
6 changes: 6 additions & 0 deletions iphone/iphone/Titanium_Prefix.pch
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@
#else
#define IS_SDK_IOS_12 false
#endif

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
#define IS_SDK_IOS_11 true
#else
#define IS_SDK_IOS_11 false
#endif

0 comments on commit a08aa2e

Please sign in to comment.