/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import "RCTImageResponseObserverProxy.h" #import #import #import #import namespace facebook { namespace react { RCTImageResponseObserverProxy::RCTImageResponseObserverProxy(id delegate) : delegate_(delegate) { } void RCTImageResponseObserverProxy::didReceiveImage(ImageResponse const &imageResponse) const { UIImage *image = (UIImage *)unwrapManagedObject(imageResponse.getImage()); id delegate = delegate_; auto this_ = this; RCTExecuteOnMainQueue(^{ [delegate didReceiveImage:image fromObserver:this_]; }); } void RCTImageResponseObserverProxy::didReceiveProgress(float progress) const { auto this_ = this; id delegate = delegate_; RCTExecuteOnMainQueue(^{ [delegate didReceiveProgress:progress fromObserver:this_]; }); } void RCTImageResponseObserverProxy::didReceiveFailure() const { auto this_ = this; id delegate = delegate_; RCTExecuteOnMainQueue(^{ [delegate didReceiveFailureFromObserver:this_]; }); } } // namespace react } // namespace facebook