YHNative_Message.m 1 KB
//
//  YHNative_Message.m
//  YohoExplorerDemo
//
//  Created by gaoqiang xu on 4/12/2015.
//  Copyright © 2015 gaoqiang xu. All rights reserved.
//

#import "YHNative_Message.h"

NSString * const YHNative_Messenger = @"YHNativeMessage";

@implementation YHNative_Message

- (NSString *)actionName
{
    return YHNative_Messenger;
}

- (void)handleMessage:(NSDictionary *)message {
    self.successCallBack(nil, NO, message);
}

- (BOOL)respondsToSelector:(SEL)aSelector
{
    return YES;
}

- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
    NSMethodSignature *signature = [super methodSignatureForSelector:aSelector];
    if (!signature) {
        return [self methodSignatureForSelector:@selector(handleMessage:)];
    }
    
    return signature;
}

- (void)forwardInvocation:(NSInvocation *)anInvocation
{
    if ([YHNative instancesRespondToSelector:anInvocation.selector]) {
        [super forwardInvocation:anInvocation];
    } else {
        [self handleMessage:self.originalParams];
    }
}


@end