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

chore(ios): exposed new constants of blur effect style #11117

Merged
merged 3 commits into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
150 changes: 150 additions & 0 deletions apidoc/Titanium/UI/iOS/iOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,156 @@ properties:
since: "6.0.0"
osver: {ios: {min: "10.0"}}

- name: BLUR_EFFECT_STYLE_SYSTEM_ULTRA_THIN_MATERIAL
summary: |
Use with [BlurView.effect](Titanium.UI.iOS.BlurView.effect) to specify a blur effect.
description: |
Creates a blurring effect in the view. This is an adaptable blur effect that creates the appearance of a material with normal thickness.
type: Number
permission: read-only
since: "8.2.0"
osver: {ios: {min: "13.0"}}

- name: BLUR_EFFECT_STYLE_SYSTEM_THIN_MATERIAL
summary: |
Use with [BlurView.effect](Titanium.UI.iOS.BlurView.effect) to specify a blur effect.
description: |
Creates a blurring effect in the view. This is an adaptable blur effect that creates the appearance of a thin material.
type: Number
permission: read-only
since: "8.2.0"
osver: {ios: {min: "13.0"}}

- name: BLUR_EFFECT_STYLE_SYSTEM_MATERIAL
summary: |
Use with [BlurView.effect](Titanium.UI.iOS.BlurView.effect) to specify a blur effect.
description: |
Creates a blurring effect in the view. This is an adaptable blur effect that creates the appearance of a material with normal thickness.
type: Number
permission: read-only
since: "8.2.0"
osver: {ios: {min: "13.0"}}

- name: BLUR_EFFECT_STYLE_SYSTEM_THICK_MATERIAL
summary: |
Use with [BlurView.effect](Titanium.UI.iOS.BlurView.effect) to specify a blur effect.
description: |
Creates a blurring effect in the view. This is an adaptable blur effect that creates the appearance of a material that is thicker than normal.
type: Number
permission: read-only
since: "8.2.0"
osver: {ios: {min: "13.0"}}

- name: BLUR_EFFECT_STYLE_SYSTEM_CHROME_MATERIAL
summary: |
Use with [BlurView.effect](Titanium.UI.iOS.BlurView.effect) to specify a blur effect.
description: |
Creates a blurring effect in the view. This is an adaptable blur effect that creates the appearance of the system chrome.
type: Number
permission: read-only
since: "8.2.0"
osver: {ios: {min: "13.0"}}

- name: BLUR_EFFECT_STYLE_SYSTEM_ULTRA_THIN_MATERIAL_LIGHT
summary: |
Use with [BlurView.effect](Titanium.UI.iOS.BlurView.effect) to specify a blur effect.
description: |
Creates a blurring effect in the view. This blur effect creates the appearance of an ultra-thin material and is always light.
type: Number
permission: read-only
since: "8.2.0"
osver: {ios: {min: "13.0"}}

- name: BLUR_EFFECT_STYLE_SYSTEM_THIN_MATERIAL_LIGHT
summary: |
Use with [BlurView.effect](Titanium.UI.iOS.BlurView.effect) to specify a blur effect.
description: |
Creates a blurring effect in the view. This blur effect creates the appearance of a thin material and is always light.
type: Number
permission: read-only
since: "8.2.0"
osver: {ios: {min: "13.0"}}

- name: BLUR_EFFECT_STYLE_SYSTEM_MATERIAL_LIGHT
summary: |
Use with [BlurView.effect](Titanium.UI.iOS.BlurView.effect) to specify a blur effect.
description: |
Creates a blurring effect in the view. This blur effect creates the appearance of a material with normal thickness and is always light.
type: Number
permission: read-only
since: "8.2.0"
osver: {ios: {min: "13.0"}}

- name: BLUR_EFFECT_STYLE_SYSTEM_THICK_MATERIAL_LIGHT
summary: |
Use with [BlurView.effect](Titanium.UI.iOS.BlurView.effect) to specify a blur effect.
description: |
Creates a blurring effect in the view. This blur effect creates the appearance of a material that is thicker than normal and is always light.
type: Number
permission: read-only
since: "8.2.0"
osver: {ios: {min: "13.0"}}

- name: BLUR_EFFECT_STYLE_SYSTEM_CHROME_MATERIAL_LIGHT
summary: |
Use with [BlurView.effect](Titanium.UI.iOS.BlurView.effect) to specify a blur effect.
description: |
Creates a blurring effect in the view. This blur effect creates the appearance of the system chrome and is always light.
type: Number
permission: read-only
since: "8.2.0"
osver: {ios: {min: "13.0"}}

- name: BLUR_EFFECT_STYLE_SYSTEM_ULTRA_THIN_MATERIAL_DARK
summary: |
Use with [BlurView.effect](Titanium.UI.iOS.BlurView.effect) to specify a blur effect.
description: |
Creates a blurring effect in the view. This blur effect creates the appearance of the system chrome and is always dark.
type: Number
permission: read-only
since: "8.2.0"
osver: {ios: {min: "13.0"}}

- name: BLUR_EFFECT_STYLE_SYSTEM_THIN_MATERIAL_DARK
summary: |
Use with [BlurView.effect](Titanium.UI.iOS.BlurView.effect) to specify a blur effect.
description: |
Creates a blurring effect in the view. This blur effect creates the appearance of a material that is thicker than normal and is always dark.
type: Number
permission: read-only
since: "8.2.0"
osver: {ios: {min: "13.0"}}

- name: BLUR_EFFECT_STYLE_SYSTEM_MATERIAL_DARK
summary: |
Use with [BlurView.effect](Titanium.UI.iOS.BlurView.effect) to specify a blur effect.
description: |
Creates a blurring effect in the view. This blur effect creates the appearance of a thin material and is always dark.
type: Number
permission: read-only
since: "8.2.0"
osver: {ios: {min: "13.0"}}

- name: BLUR_EFFECT_STYLE_SYSTEM_THICK_MATERIAL_DARK
summary: |
Use with [BlurView.effect](Titanium.UI.iOS.BlurView.effect) to specify a blur effect.
description: |
Creates a blurring effect in the view. This blur effect creates the appearance of a material with normal thickness and is always dark.
type: Number
permission: read-only
since: "8.2.0"
osver: {ios: {min: "13.0"}}

- name: BLUR_EFFECT_STYLE_SYSTEM_CHROME_MATERIAL_DARK
summary: |
Use with [BlurView.effect](Titanium.UI.iOS.BlurView.effect) to specify a blur effect.
description: |
Creates a blurring effect in the view. This blur effect creates the appearance of an ultra-thin material and is always dark.
type: Number
permission: read-only
since: "8.2.0"
osver: {ios: {min: "13.0"}}

- name: AD_SIZE_PORTRAIT
summary: |
Use with [AdView.adSize](Titanium.UI.iOS.AdView.adSize) to specify a banner ad size
Expand Down
18 changes: 18 additions & 0 deletions iphone/Classes/TiUIiOSProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,24 @@ - (id)BLUR_EFFECT_STYLE_PROMINENT
}
return [NSNull null];
}

#if IS_SDK_IOS_13
MAKE_SYSTEM_PROP(BLUR_EFFECT_STYLE_SYSTEM_ULTRA_THIN_MATERIAL, UIBlurEffectStyleSystemUltraThinMaterial);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These new properties are missing a check when running on devices with iOS < 13.. See https://jira.appcelerator.org/browse/TIMOB-23778 and the above BLUR_EFFECT_STYLE_* properties.

Maybe this is good chance to extend the MAKE_SYSTEM_PROP macro and add an additional parameter to do the above runtime check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@janvennemann
If we are building with iOS SDK 13, these all constants will be available in in iOS 13+ and iOS < 13. But for iOS < 13 ( [[self blurView] setEffect:[UIBlurEffect effectWithStyle:style]];) setEffect native API internally take care of it and will not add any effect.
If we are building with iOS SDK < 13, in that case these constants will not be available and will give null because constants are wrapped inside macro.

I have tested this.
So we do not have to add any check for that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, thanks for clearing this up. I saw the way the other properties are implemented and was wondering if this affects the new properties as well. If you say the check isn't needed then this looks good!

MAKE_SYSTEM_PROP(BLUR_EFFECT_STYLE_SYSTEM_THIN_MATERIAL, UIBlurEffectStyleSystemThinMaterial);
MAKE_SYSTEM_PROP(BLUR_EFFECT_STYLE_SYSTEM_MATERIAL, UIBlurEffectStyleSystemMaterial);
MAKE_SYSTEM_PROP(BLUR_EFFECT_STYLE_SYSTEM_THICK_MATERIAL, UIBlurEffectStyleSystemThickMaterial);
MAKE_SYSTEM_PROP(BLUR_EFFECT_STYLE_SYSTEM_CHROME_MATERIAL, UIBlurEffectStyleSystemChromeMaterial);
MAKE_SYSTEM_PROP(BLUR_EFFECT_STYLE_SYSTEM_ULTRA_THIN_MATERIAL_LIGHT, UIBlurEffectStyleSystemUltraThinMaterialLight);
MAKE_SYSTEM_PROP(BLUR_EFFECT_STYLE_SYSTEM_THIN_MATERIAL_LIGHT, UIBlurEffectStyleSystemThinMaterialLight);
MAKE_SYSTEM_PROP(BLUR_EFFECT_STYLE_SYSTEM_MATERIAL_LIGHT, UIBlurEffectStyleSystemMaterialLight);
MAKE_SYSTEM_PROP(BLUR_EFFECT_STYLE_SYSTEM_THICK_MATERIAL_LIGHT, UIBlurEffectStyleSystemThickMaterialLight);
MAKE_SYSTEM_PROP(BLUR_EFFECT_STYLE_SYSTEM_CHROME_MATERIAL_LIGHT, UIBlurEffectStyleSystemChromeMaterialLight);
MAKE_SYSTEM_PROP(BLUR_EFFECT_STYLE_SYSTEM_ULTRA_THIN_MATERIAL_DARK, UIBlurEffectStyleSystemUltraThinMaterialDark);
MAKE_SYSTEM_PROP(BLUR_EFFECT_STYLE_SYSTEM_THIN_MATERIAL_DARK, UIBlurEffectStyleSystemThinMaterialDark);
MAKE_SYSTEM_PROP(BLUR_EFFECT_STYLE_SYSTEM_MATERIAL_DARK, UIBlurEffectStyleSystemMaterialDark);
MAKE_SYSTEM_PROP(BLUR_EFFECT_STYLE_SYSTEM_THICK_MATERIAL_DARK, UIBlurEffectStyleSystemThickMaterialDark);
MAKE_SYSTEM_PROP(BLUR_EFFECT_STYLE_SYSTEM_CHROME_MATERIAL_DARK, UIBlurEffectStyleSystemChromeMaterialDark);
#endif
#endif

#ifdef USE_TI_UIIOSMENUPOPUP
Expand Down
35 changes: 35 additions & 0 deletions tests/Resources/ti.ui.ios.addontest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Appcelerator Titanium Mobile
* Copyright (c) 2011-Present by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
/* eslint-env mocha */
/* eslint no-unused-expressions: "off" */
'use strict';
var should = require('./utilities/assertions');

describe.ios('Titanium.UI.iOS', function () {

it('#constants', function () {
// Used in BlurView.effect. Need to copy under #constatnt test case
var isiOS13 = (parseInt(Ti.Platform.version.split('.')[0]) >= 13);
if (isiOS13) {
should(Ti.UI.iOS.BLUR_EFFECT_STYLE_SYSTEM_ULTRA_THIN_MATERIAL).be.a.Number;
should(Ti.UI.iOS.BLUR_EFFECT_STYLE_SYSTEM_THIN_MATERIAL).be.a.Number;
should(Ti.UI.iOS.BLUR_EFFECT_STYLE_SYSTEM_MATERIAL).be.a.Number;
should(Ti.UI.iOS.BLUR_EFFECT_STYLE_SYSTEM_THICK_MATERIAL).be.a.Number;
should(Ti.UI.iOS.BLUR_EFFECT_STYLE_SYSTEM_CHROME_MATERIAL).be.a.Number;
should(Ti.UI.iOS.BLUR_EFFECT_STYLE_SYSTEM_ULTRA_THIN_MATERIAL_LIGHT).be.a.Number;
should(Ti.UI.iOS.BLUR_EFFECT_STYLE_SYSTEM_THIN_MATERIAL_LIGHT).be.a.Number;
should(Ti.UI.iOS.BLUR_EFFECT_STYLE_SYSTEM_MATERIAL_LIGHT).be.a.Number;
should(Ti.UI.iOS.BLUR_EFFECT_STYLE_SYSTEM_THICK_MATERIAL_LIGHT).be.a.Number;
should(Ti.UI.iOS.BLUR_EFFECT_STYLE_SYSTEM_CHROME_MATERIAL_LIGHT).be.a.Number;
should(Ti.UI.iOS.BLUR_EFFECT_STYLE_SYSTEM_ULTRA_THIN_MATERIAL_DARK).be.a.Number;
should(Ti.UI.iOS.BLUR_EFFECT_STYLE_SYSTEM_THIN_MATERIAL_DARK).be.a.Number;
should(Ti.UI.iOS.BLUR_EFFECT_STYLE_SYSTEM_MATERIAL_DARK).be.a.Number;
should(Ti.UI.iOS.BLUR_EFFECT_STYLE_SYSTEM_THICK_MATERIAL_DARK).be.a.Number;
should(Ti.UI.iOS.BLUR_EFFECT_STYLE_SYSTEM_CHROME_MATERIAL_DARK).be.a.Number;
}
});
});