Skip to content

Commit

Permalink
Merge branch 'master' into TIMOB-27253
Browse files Browse the repository at this point in the history
  • Loading branch information
keerthi1032 committed Aug 19, 2019
2 parents 51b8749 + a73ebca commit 4384c05
Show file tree
Hide file tree
Showing 31 changed files with 222 additions and 25 deletions.
39 changes: 39 additions & 0 deletions apidoc/Titanium/App/iOS/iOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,30 @@ properties:
osver: {ios: {min: "11.0"}}
since: "7.3.0"

- name: USER_INTERFACE_STYLE_UNSPECIFIED
summary: An unspecified interface style.
description: Used in the `userInterfaceStyle` property.
type: Number
permission: read-only
osver: {ios: {min: "13.0"}}
since: "8.2.0"

- name: USER_INTERFACE_STYLE_LIGHT
summary: A light interface style.
description: Used in the `userInterfaceStyle` property.
type: Number
permission: read-only
osver: {ios: {min: "13.0"}}
since: "8.2.0"

- name: USER_INTERFACE_STYLE_DARK
summary: A dark interface style.
description: Used in the `userInterfaceStyle` property.
type: Number
permission: read-only
osver: {ios: {min: "13.0"}}
since: "8.2.0"

- name: UTTYPE_TEXT
summary: |
Uniform type identifier for all text types.
Expand Down Expand Up @@ -800,6 +824,16 @@ properties:
osver: {ios: {min: "8.0"}}
since: "3.4.0"

- name: userInterfaceStyle
summary: The style associated with the user interface.
description: |
Use this property to determine whether your interface should be configured with a dark or light appearance.
The default value of this trait is set to the corresponding appearance setting on the user's device.
type: Array<String>
permission: read-only
osver: {ios: {min: "13.0"}}
since: "8.2.0"

events:
- name: notification
summary: Fired when a local notification is received by the application.
Expand Down Expand Up @@ -1360,6 +1394,11 @@ events:
osver: {ios: {min: "8.0"}}
since: "6.0.0"

- name: traitcollectionchange
summary: Fired when the trait collection of the device changes, e.g. the user interface style.
platforms: [iphone, ipad]
since: "8.2.0"

---
name: NotificationParams
summary: |
Expand Down
6 changes: 3 additions & 3 deletions apidoc/Titanium/UI/Android/Android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ properties:
summary: |
Use with [WebView.pluginState](Titanium.UI.WebView.pluginState) to disable plugins in a web view.
description: |
Content that requires a plugin, such as Flash Player, is not loaded, and any
Content that requires a plugin, is not loaded, and any
alternative content is displayed instead.
type: Number
permission: read-only
Expand All @@ -653,15 +653,15 @@ properties:
summary: |
Use with [WebView.pluginState](Titanium.UI.WebView.pluginState) to enable plugins in a web view.
description: |
Content that requires a plugin, such as Flash Player, is always loaded, whether or not a plugin is
Content that requires a plugin,, is always loaded, whether or not a plugin is
available for the content.
type: Number
permission: read-only

- name: WEBVIEW_PLUGINS_ON_DEMAND
summary: Display a placeholder and only load plugins when user selects it.
description: |
Content that requires a plugin, such as Flash Player, is replaced by a placeholder. When
Content that requires a plugin, is replaced by a placeholder. When
the user clicks on the placeholder, the plugin is loaded and the content is displayed.
Use with [WebView.pluginState](Titanium.UI.WebView.pluginState) to load plugins on demand.
Expand Down
6 changes: 2 additions & 4 deletions build/lib/packager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ const rollup = require('rollup').rollup;
const babel = require('rollup-plugin-babel');
const resolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
const appc = require('node-appc');
const version = appc.version;
const packageJSON = require('../../package.json');
const utils = require('./utils');
const copyFile = utils.copyFile;
Expand Down Expand Up @@ -85,12 +83,12 @@ function determineBabelOptions() {
const chromeVersion = parseInt(found[1] + found[2]); // concat the first two numbers as string, then turn to int
// Now pull out min IOS target
// eslint-disable-next-line security/detect-non-literal-require
const minSupportedIosSdk = version.parseMin(require(path.join(ROOT_DIR, 'iphone/package.json')).vendorDependencies['ios sdk']);
const { minIosVersion } = require(path.join(ROOT_DIR, 'iphone/package.json'));
// TODO: filter to only targets relevant for platforms we're building?
const options = {
targets: {
chrome: chromeVersion,
ios: minSupportedIosSdk
ios: minIosVersion
},
useBuiltIns: 'entry',
// DO NOT include web polyfills!
Expand Down
6 changes: 2 additions & 4 deletions build/scons-xcode-project-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ const rollup = require('rollup').rollup;
const babel = require('rollup-plugin-babel');
const resolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
const appc = require('node-appc');
const version = appc.version;

program.parse(process.argv);

Expand Down Expand Up @@ -53,10 +51,10 @@ async function generateIndexJSON(dirToTraverse) {

function determineBabelOptions() {
// eslint-disable-next-line security/detect-non-literal-require
const minSupportedIosSdk = version.parseMin(require(path.join(ROOT_DIR, 'iphone/package.json')).vendorDependencies['ios sdk']);
const { minIosVersion } = require(path.join(ROOT_DIR, 'iphone/package.json'));
const options = {
targets: {
ios: minSupportedIosSdk
ios: minIosVersion
},
useBuiltIns: 'entry',
// DO NOT include web polyfills!
Expand Down
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
51 changes: 51 additions & 0 deletions iphone/Classes/TiAppiOSProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ - (void)_listenerAdded:(NSString *)type count:(int)count
name:kTiApplicationLaunchedFromURL
object:nil];
}

if ((count == 1) && [type isEqual:@"traitcollectionchange"]) {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didChangeTraitCollection:)
name:kTiTraitCollectionChanged
object:nil];
}
}

- (void)_listenerRemoved:(NSString *)type count:(int)count
Expand Down Expand Up @@ -179,10 +186,25 @@ - (void)_listenerRemoved:(NSString *)type count:(int)count
if ((count == 1) && [type isEqual:@"shortcutitemclick"]) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:kTiApplicationShortcut object:nil];
}
if ((count == 1) && [type isEqual:@"traitcollectionchange"]) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:kTiTraitCollectionChanged object:nil];
}
}

#pragma mark Public

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
- (NSNumber *)userInterfaceStyle
{
return @(TiApp.controller.traitCollection.userInterfaceStyle);
}
#endif

- (void)didChangeTraitCollection:(NSNotification *)info
{
[self fireEvent:@"traitcollectionchange"];
}

- (void)didReceiveApplicationShortcutNotification:(NSNotification *)info
{
NSMutableDictionary *event = [[NSMutableDictionary alloc] initWithDictionary:@{
Expand Down Expand Up @@ -1267,6 +1289,35 @@ - (NSNumber *)USER_NOTIFICATION_CATEGORY_OPTION_HIDDEN_PREVIEWS_SHOW_SUBTITLE
return NUMINT(0);
}

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
- (NSNumber *)USER_INTERFACE_STYLE_UNSPECIFIED
{
if ([TiUtils isIOSVersionOrGreater:@"13.0"]) {
return NUMINT(UIUserInterfaceStyleUnspecified);
}

return NUMINT(0);
}

- (NSNumber *)USER_INTERFACE_STYLE_LIGHT
{
if ([TiUtils isIOSVersionOrGreater:@"13.0"]) {
return NUMINT(UIUserInterfaceStyleLight);
}

return NUMINT(0);
}

- (NSNumber *)USER_INTERFACE_STYLE_DARK
{
if ([TiUtils isIOSVersionOrGreater:@"13.0"]) {
return NUMINT(UIUserInterfaceStyleDark);
}

return NUMINT(0);
}
#endif

#pragma mark UTI Text Type Constants

- (CFStringRef)UTTYPE_TEXT
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
6 changes: 5 additions & 1 deletion iphone/Classes/TiUIActivityIndicator.m
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@ - (void)setColor_:(id)value
textColor = [newColor retain];
if (messageLabel != nil) {
if (textColor == nil) {
[messageLabel setTextColor:[UIColor blackColor]];
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
[messageLabel setTextColor:[TiUtils isIOSVersionOrGreater:@"13.0"] ? UIColor.labelColor : UIColor.blackColor];
#else
[messageLabel setTextColor:UIColor.blackColor];
#endif
} else {
[messageLabel setTextColor:textColor];
}
Expand Down
4 changes: 4 additions & 0 deletions iphone/Classes/TiUIListItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ - (void)setPosition:(int)position isGrouped:(BOOL)grouped

- (void)applyBackgroundWithSelectedColor:(id)selectedBackgroundColor selectedImage:(id)selectedBackgroundImage
{
if (!selectedBackgroundColor && !selectedBackgroundImage) {
return; // Ignore custom selection styles for native selections
}

UIColor *sbgColor = (selectedBackgroundColor != nil) ? ([[TiUtils colorValue:selectedBackgroundColor] _color]) : nil;
UIImage *sbgImage = [[ImageLoader sharedLoader] loadImmediateStretchableImage:[TiUtils toURL:selectedBackgroundImage proxy:_proxy] withLeftCap:TiDimensionAuto topCap:TiDimensionAuto];
if (sbgImage != nil) {
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
6 changes: 5 additions & 1 deletion iphone/Classes/TiUIPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ - (UIControl *)picker
[(UIDatePicker *)picker setDatePickerMode:type];
[picker addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged];
}
[picker setBackgroundColor:[UIColor whiteColor]];
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
[picker setBackgroundColor:[TiUtils isIOSVersionOrGreater:@"13.0"] ? UIColor.systemBackgroundColor : UIColor.whiteColor];
#else
[picker setBackgroundColor:UIColor.whiteColor];
#endif
[self addSubview:picker];
}
return picker;
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

0 comments on commit 4384c05

Please sign in to comment.