From 82ff7aeadc9339650c467c0ae93d0f5d7c5f74ee Mon Sep 17 00:00:00 2001 From: Panayot Cankov Date: Wed, 14 Sep 2016 09:08:53 +0300 Subject: [PATCH 1/2] Fix delegates --- tests/app/ui/activity-indicator/activity-indicator-tests.ts | 6 +++++- tns-core-modules/ui/animation/animation.ios.ts | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/app/ui/activity-indicator/activity-indicator-tests.ts b/tests/app/ui/activity-indicator/activity-indicator-tests.ts index 0cdbfd4a3..c61166b88 100644 --- a/tests/app/ui/activity-indicator/activity-indicator-tests.ts +++ b/tests/app/ui/activity-indicator/activity-indicator-tests.ts @@ -81,6 +81,10 @@ function getNativeBusy(indicator: activityIndicatorModule.ActivityIndicator): bo return indicator.android.getVisibility() === android.view.View.VISIBLE; } else if (indicator.ios) { - return indicator.ios.isAnimating(); + if ((indicator.ios as any).isAnimating) { + return (indicator.ios as any).isAnimating(); + } else { + return (indicator.ios as UIActivityIndicatorView).animating; + } } } diff --git a/tns-core-modules/ui/animation/animation.ios.ts b/tns-core-modules/ui/animation/animation.ios.ts index 85034ab89..301227cd7 100644 --- a/tns-core-modules/ui/animation/animation.ios.ts +++ b/tns-core-modules/ui/animation/animation.ios.ts @@ -41,10 +41,12 @@ interface IOSView extends viewModule.View { _isPresentationLayerUpdateSuspeneded(); } -class AnimationDelegateImpl extends NSObject { +class AnimationDelegateImpl extends NSObject implements CAAnimationDelegate { public nextAnimation: Function; + static ObjCProtocols = [CAAnimationDelegate]; + private _finishedCallback: Function; private _propertyAnimation: PropertyAnimationInfo; private _valueSource: number; @@ -360,7 +362,7 @@ export class Animation extends common.Animation implements definition.Animation } let animationDelegate = AnimationDelegateImpl.initWithFinishedCallback(finishedCallback, animation, valueSource); - nativeAnimation.setValueForKey(animationDelegate, "delegate"); + nativeAnimation.delegate = animationDelegate; nativeView.layer.addAnimationForKey(nativeAnimation, args.propertyNameToAnimate); From 81165fee3f3f436999ecfa34adccf343d8696a2d Mon Sep 17 00:00:00 2001 From: Jason Zhekov Date: Wed, 14 Sep 2016 11:38:44 +0300 Subject: [PATCH 2/2] Fix Xcode 7 build - CAAnimationDelegate is not available there --- tns-core-modules/ui/animation/animation.ios.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tns-core-modules/ui/animation/animation.ios.ts b/tns-core-modules/ui/animation/animation.ios.ts index 301227cd7..7af8165fd 100644 --- a/tns-core-modules/ui/animation/animation.ios.ts +++ b/tns-core-modules/ui/animation/animation.ios.ts @@ -45,7 +45,8 @@ class AnimationDelegateImpl extends NSObject implements CAAnimationDelegate { public nextAnimation: Function; - static ObjCProtocols = [CAAnimationDelegate]; + // The CAAnimationDelegate protocol has been introduced in the iOS 10 SDK + static ObjCProtocols = global.CAAnimationDelegate ? [global.CAAnimationDelegate] : []; private _finishedCallback: Function; private _propertyAnimation: PropertyAnimationInfo;