Merge pull request #2715 from NativeScript/pass-tests-ios10

All tests pass iOS10, fixing delegates with love...
This commit is contained in:
Panayot Cankov
2016-09-14 12:28:19 +03:00
committed by GitHub
2 changed files with 10 additions and 3 deletions

View File

@ -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;
}
}
}

View File

@ -41,10 +41,13 @@ interface IOSView extends viewModule.View {
_isPresentationLayerUpdateSuspeneded();
}
class AnimationDelegateImpl extends NSObject {
class AnimationDelegateImpl extends NSObject implements CAAnimationDelegate {
public nextAnimation: Function;
// The CAAnimationDelegate protocol has been introduced in the iOS 10 SDK
static ObjCProtocols = global.CAAnimationDelegate ? [global.CAAnimationDelegate] : [];
private _finishedCallback: Function;
private _propertyAnimation: PropertyAnimationInfo;
private _valueSource: number;
@ -360,7 +363,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);