Skip to content

Commit

Permalink
Merge pull request #8233 from hansemannn/TIMOB-23778
Browse files Browse the repository at this point in the history
[TIMOB-23778] iOS: Provide better error for unsupported blurview-effects
  • Loading branch information
AngelkPetkov committed Aug 15, 2016
2 parents f21daf6 + f7a1c6d commit 028d8cc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
9 changes: 7 additions & 2 deletions iphone/Classes/TiUIiOSBlurView.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@ -(void)dealloc

-(void)setEffect_:(id)value
{
ENSURE_TYPE(value, NSNumber);
[[self blurView] setEffect:[UIBlurEffect effectWithStyle:[TiUtils intValue:value def:UIBlurEffectStyleLight]]];
ENSURE_TYPE_OR_NIL(value, NSNumber);

if (value == nil) {
DebugLog(@"[ERROR] The provided value for the Ti.UI.BlurView.effect property is not available in this iOS version.");
return;
}

[[self blurView] setEffect:[UIBlurEffect effectWithStyle:[TiUtils intValue:value def:UIBlurEffectStyleLight]]];
[[self proxy] replaceValue:value forKey:@"effect" notification:NO];
}

Expand Down
26 changes: 14 additions & 12 deletions iphone/Classes/TiUIiOSProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -464,47 +464,49 @@ -(void)setAppSupportsShakeToEdit:(NSNumber *)shake
END_UI_THREAD_PROTECTED_VALUE(appSupportsShakeToEdit)

#ifdef USE_TI_UIIOSBLURVIEW
- (NSNumber*) BLUR_EFFECT_STYLE_EXTRA_LIGHT
- (id)BLUR_EFFECT_STYLE_EXTRA_LIGHT
{
if ([TiUtils isIOS8OrGreater]) {
return NUMINTEGER(UIBlurEffectStyleExtraLight);
}
return nil;
return [NSNull null];
}

- (NSNumber* )BLUR_EFFECT_STYLE_LIGHT
- (id)BLUR_EFFECT_STYLE_LIGHT
{
if ([TiUtils isIOS8OrGreater]) {
return NUMINTEGER(UIBlurEffectStyleLight);
}
return nil;
return [NSNull null];
}

- (NSNumber*) BLUR_EFFECT_STYLE_DARK
- (id)BLUR_EFFECT_STYLE_DARK
{
if ([TiUtils isIOS8OrGreater]) {
return NUMINTEGER(UIBlurEffectStyleDark);
}
return nil;
return [NSNull null];
}

#if IS_XCODE_8
- (NSNumber*) BLUR_EFFECT_STYLE_REGULAR
- (id)BLUR_EFFECT_STYLE_REGULAR
{
#if IS_XCODE_8
if ([TiUtils isIOS10OrGreater]) {
return NUMINTEGER(UIBlurEffectStyleRegular);
}
return nil;
#endif
return [NSNull null];
}

- (NSNumber*) BLUR_EFFECT_STYLE_PROMINENT
- (id)BLUR_EFFECT_STYLE_PROMINENT
{
#if IS_XCODE_8
if ([TiUtils isIOS10OrGreater]) {
return NUMINTEGER(UIBlurEffectStyleProminent);
}
return nil;
}
#endif
return [NSNull null];
}
#endif

#ifdef USE_TI_UIIOSMENUPOPUP
Expand Down

0 comments on commit 028d8cc

Please sign in to comment.