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

feat(ios) : add support for Xcode 11 / iOS 13 dev environment #10932

Merged
merged 9 commits into from
Jul 18, 2019
6 changes: 0 additions & 6 deletions iphone/Classes/GeolocationModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,9 @@ - (CLLocationManager *)locationManager

locationManager.allowsBackgroundLocationUpdates = allowsBackgroundLocationUpdates;

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

locationManager.activityType = activityType;
locationManager.pausesLocationUpdatesAutomatically = pauseLocationUpdateAutomatically;
Expand Down Expand Up @@ -605,23 +603,19 @@ - (void)setHeadingFilter:(CLLocationDegrees)value

- (BOOL)showBackgroundLocationIndicator
{
#if IS_XCODE_9
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_XCODE_9
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
10 changes: 5 additions & 5 deletions iphone/Classes/TiAppiOSProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ - (void)registerUserNotificationSettings:(id)args
break;
}
}
#if IS_XCODE_10
#if IS_SDK_IOS_12
// Handle additional iOS 12+ enums
if ([TiUtils isIOSVersionOrGreater:@"12.0"]) {
switch ([TiUtils intValue:thisTypeRequested]) {
Expand Down Expand Up @@ -584,7 +584,7 @@ - (NSDictionary *)formatUserNotificationSettings:(id)notificationSettings
UNNotificationSetting carPlaySetting = [(UNNotificationSettings *)notificationSettings carPlaySetting];

if ([TiUtils isIOSVersionOrGreater:@"12.0"]) {
#if IS_XCODE_10
#if IS_SDK_IOS_12
UNNotificationSetting criticalAlertSetting = [(UNNotificationSettings *)notificationSettings criticalAlertSetting];
BOOL providesAppNotificationSettings = [(UNNotificationSettings *)notificationSettings providesAppNotificationSettings];

Expand Down Expand Up @@ -801,7 +801,7 @@ - (TiAppiOSLocalNotificationProxy *)scheduleLocalNotification:(id)args
[content setCategoryIdentifier:[TiUtils stringValue:category]];
}

#if IS_XCODE_10
#if IS_SDK_IOS_12
// Add iOS 12+ API's to enable threading and notification groups
if ([TiUtils isIOSVersionOrGreater:@"12.0"]) {
// Set the string the notification adds to the category’s summary format string.
Expand Down Expand Up @@ -1168,7 +1168,7 @@ - (NSNumber *)USER_NOTIFICATION_TYPE_CAR_PLAY
return NUMINT(0);
}

#if IS_XCODE_10
#if IS_SDK_IOS_12
- (NSNumber *)USER_NOTIFICATION_TYPE_CRITICAL_ALERT
{
if ([TiUtils isIOSVersionOrGreater:@"12.0"]) {
Expand Down Expand Up @@ -1500,7 +1500,7 @@ - (NSString *)applicationOpenSettingsURL
MAKE_SYSTEM_PROP(USER_NOTIFICATION_AUTHORIZATION_STATUS_DENIED, UNAuthorizationStatusDenied);
MAKE_SYSTEM_PROP(USER_NOTIFICATION_AUTHORIZATION_STATUS_AUTHORIZED, UNAuthorizationStatusAuthorized);
MAKE_SYSTEM_PROP(USER_NOTIFICATION_AUTHORIZATION_STATUS_NOT_DETERMINED, UNAuthorizationStatusNotDetermined);
#if IS_XCODE_10
#if IS_SDK_IOS_12
MAKE_SYSTEM_PROP(USER_NOTIFICATION_AUTHORIZATION_STATUS_PROVISIONAL, UNAuthorizationStatusProvisional);
#endif

Expand Down
2 changes: 1 addition & 1 deletion iphone/Classes/TiAppiOSUserActivityProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

- (void)resignCurrent:(id)unused;

#if IS_XCODE_10
#if IS_SDK_IOS_12
- (NSString *)persistentIdentifier;

- (void)setPersistentIdentifier:(NSString *)value;
Expand Down
4 changes: 2 additions & 2 deletions iphone/Classes/TiAppiOSUserActivityProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ - (void)buildInitialActivity:(NSDictionary *)props
[_userActivity setRequiredUserInfoKeys:[NSSet setWithArray:[props objectForKey:@"requiredUserInfoKeys"]]];
}

#if IS_XCODE_10
#if IS_SDK_IOS_12
if ([TiUtils isIOSVersionOrGreater:@"12.0"]) {
if ([props objectForKey:@"eligibleForPrediction"]) {
[_userActivity setEligibleForPrediction:[TiUtils boolValue:@"eligibleForPrediction" properties:props]];
Expand Down Expand Up @@ -404,7 +404,7 @@ - (void)resignCurrent:(id)unused
[_userActivity resignCurrent];
}

#if IS_XCODE_10
#if IS_SDK_IOS_12
- (NSNumber *)eligibleForPrediction
{
if ([TiUtils isIOSVersionLower:@"12.0"]) {
Expand Down
6 changes: 3 additions & 3 deletions iphone/Classes/TiAppiOSUserNotificationCategoryProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ - (void)_initWithProperties:(NSDictionary *)properties
NSArray *intentIdentifiers = [properties valueForKey:@"intentIdentifiers"] ?: @[];
NSString *hiddenPreviewsBodyPlaceholder = [properties valueForKey:@"hiddenPreviewsBodyPlaceholder"];
UNNotificationCategoryOptions options = [self categoryOptionsFromArray:[properties valueForKey:@"options"] ?: @[]];
#if IS_XCODE_10
#if IS_SDK_IOS_12
NSString *categorySummaryFormat = [properties valueForKey:@"categorySummaryFormat"];
#endif

Expand Down Expand Up @@ -63,7 +63,7 @@ - (void)_initWithProperties:(NSDictionary *)properties
if ([TiUtils isIOSVersionOrGreater:@"10.0"]) {
// For iOS 11+, offer new constructors
if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
#if IS_XCODE_10
#if IS_SDK_IOS_12
// For iOS 12+, use the "hiddenPreviewsBodyPlaceholder" and "categorySummaryFormat" constructor
if ([TiUtils isIOSVersionOrGreater:@"12.0"]) {
_notificationCategory = [[UNNotificationCategory categoryWithIdentifier:identifier
Expand All @@ -80,7 +80,7 @@ - (void)_initWithProperties:(NSDictionary *)properties
intentIdentifiers:intentIdentifiers
hiddenPreviewsBodyPlaceholder:hiddenPreviewsBodyPlaceholder
options:options] retain];
#if IS_XCODE_10
#if IS_SDK_IOS_12
}
#endif
} else {
Expand Down
4 changes: 1 addition & 3 deletions iphone/Classes/TiAppiOSUserNotificationCenterProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,10 @@ - (void)requestUserNotificationSettings:(id)callback
@"carPlaySetting" : @([settings carPlaySetting]),
@"alertStyle" : @([settings alertStyle])
} mutableCopy];
#if IS_XCODE_9
if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
propertiesDict[@"showPreviewsSetting"] = @([settings showPreviewsSetting]);
}
#endif
#if IS_XCODE_10
#if IS_SDK_IOS_12
if ([TiUtils isIOSVersionOrGreater:@"12.0"]) {
propertiesDict[@"criticalAlertSetting"] = @([settings criticalAlertSetting]);
propertiesDict[@"providesAppNotificationSettings"] = @([settings providesAppNotificationSettings]);
Expand Down
2 changes: 0 additions & 2 deletions iphone/Classes/TiUIListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -2198,7 +2198,6 @@ - (void)viewResignFocus

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

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

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

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

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

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

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

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

#if IS_XCODE_9
[window processForSafeArea];
#endif

if (window == rootWindow) {
[rootWindow windowWillOpen];
Expand Down Expand Up @@ -385,9 +383,7 @@ - (void)handleWillShowViewController:(UIViewController *)viewController animated
}
}
TiWindowProxy *theWindow = (TiWindowProxy *)[(TiViewController *)viewController proxy];
#if IS_XCODE_9
[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 @@ -742,7 +738,6 @@ - (void)popToRootWindow:(id)args

@synthesize parentOrientationController;

#if IS_XCODE_9
- (BOOL)homeIndicatorAutoHide
{
if (rootWindow == nil) {
Expand All @@ -759,7 +754,6 @@ - (BOOL)homeIndicatorAutoHide
}
return NO;
}
#endif

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

- (void)viewGetFocus
{
#if IS_XCODE_9
if (isSearchBarInNavigation) {
id proxy = [(TiViewProxy *)self.proxy parent];
while ([proxy isKindOfClass:[TiViewProxy class]] && ![proxy isKindOfClass:[TiWindowProxy class]]) {
Expand All @@ -2371,7 +2370,6 @@ - (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: 1 addition & 1 deletion iphone/Classes/TiUITextWidget.m
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ - (void)setPasswordMask_:(id)value
[[self textWidgetView] setSecureTextEntry:[TiUtils boolValue:value]];
}

#if IS_XCODE_10
#if IS_SDK_IOS_12
- (void)setPasswordRules_:(NSString *)passwordRules
{
ENSURE_TYPE_OR_NIL(passwordRules, NSString);
Expand Down
2 changes: 0 additions & 2 deletions iphone/Classes/TiUIWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,11 @@

@end

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

+ (NSString *)specialProtocolScheme;

@end
#endif

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

[config setUserContentController:controller];

#if IS_XCODE_9
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 @@ -1358,8 +1356,6 @@ - (NSHTTPCookie *)cookieForString:(NSString *)cookieStr

@end

#if IS_XCODE_9

@implementation WebAppProtocolHandler

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

@end
#endif

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

#if IS_XCODE_9
@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: 0 additions & 2 deletions iphone/Classes/TiUIiOSProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -800,11 +800,9 @@ - (id)createFeedbackGenerator:(id)args
MAKE_SYSTEM_PROP(FEEDBACK_GENERATOR_IMPACT_STYLE_HEAVY, UIImpactFeedbackStyleHeavy);
#endif

#if IS_XCODE_9
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: 0 additions & 4 deletions iphone/Classes/TiUIiOSSplitWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,8 @@ - (void)setMasterView_:(id)args
RELEASE_TO_NIL(masterProxy);
masterProxy = [args retain];

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

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

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

if (viewsInitialized) {
[self initProxy:detailProxy withWrapper:detailViewWrapper];
Expand Down
5 changes: 2 additions & 3 deletions iphone/Classes/UIModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +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_XCODE_9
MAKE_SYSTEM_STR(AUTOFILL_TYPE_USERNAME, UITextContentTypeUsername);
MAKE_SYSTEM_STR(AUTOFILL_TYPE_PASSWORD, UITextContentTypePassword);
#endif
#if IS_XCODE_10

#if IS_SDK_IOS_12
MAKE_SYSTEM_STR(AUTOFILL_TYPE_NEW_PASSWORD, UITextContentTypeNewPassword);
MAKE_SYSTEM_STR(AUTOFILL_TYPE_ONE_TIME_CODE, UITextContentTypeOneTimeCode);
#endif
Expand Down