Authored by gaoqiang xu

优化消息机能

@@ -72,6 +72,8 @@ @@ -72,6 +72,8 @@
72 native = [[abilityClass alloc] init]; 72 native = [[abilityClass alloc] init];
73 weakSelf.abilities[NSStringFromClass(abilityClass)] = native; 73 weakSelf.abilities[NSStringFromClass(abilityClass)] = native;
74 } 74 }
  75 +
  76 + native.originalParams = info;
75 77
76 BOOL canProcess = YES; 78 BOOL canProcess = YES;
77 if (weakIf && [weakIf respondsToSelector:@selector(nativeActionShouldBegin:)]) { 79 if (weakIf && [weakIf respondsToSelector:@selector(nativeActionShouldBegin:)]) {
@@ -38,11 +38,11 @@ NSString * const YHNative_Messenger = @"YHNativeMessage"; @@ -38,11 +38,11 @@ NSString * const YHNative_Messenger = @"YHNativeMessage";
38 38
39 - (void)forwardInvocation:(NSInvocation *)anInvocation 39 - (void)forwardInvocation:(NSInvocation *)anInvocation
40 { 40 {
41 - NSString *selector = NSStringFromSelector(anInvocation.selector);  
42 -  
43 - NSDictionary *message = @{ @"event": selector };  
44 -  
45 - [self handleMessage:message]; 41 + if ([YHNative instancesRespondToSelector:anInvocation.selector]) {
  42 + [super forwardInvocation:anInvocation];
  43 + } else {
  44 + [self handleMessage:self.originalParams];
  45 + }
46 } 46 }
47 47
48 48
@@ -40,6 +40,7 @@ typedef void(^onFailure)(NSString *message); @@ -40,6 +40,7 @@ typedef void(^onFailure)(NSString *message);
40 */ 40 */
41 @interface YHNative : NSObject 41 @interface YHNative : NSObject
42 42
  43 +@property (copy, nonatomic) NSDictionary *originalParams;
43 @property (strong, nonatomic) NSDictionary *options; 44 @property (strong, nonatomic) NSDictionary *options;
44 @property (copy, nonatomic) onSuccess successCallBack; 45 @property (copy, nonatomic) onSuccess successCallBack;
45 @property (copy, nonatomic) onFailure failureCallBack; 46 @property (copy, nonatomic) onFailure failureCallBack;
@@ -27,5 +27,21 @@ @@ -27,5 +27,21 @@
27 </Actions> 27 </Actions>
28 </BreakpointContent> 28 </BreakpointContent>
29 </BreakpointProxy> 29 </BreakpointProxy>
  30 + <BreakpointProxy
  31 + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
  32 + <BreakpointContent
  33 + shouldBeEnabled = "Yes"
  34 + ignoreCount = "0"
  35 + continueAfterRunningActions = "No"
  36 + filePath = "../YHExplorer/CordovaPlugins/CDVYHInterface.m"
  37 + timestampString = "471763039.615788"
  38 + startingColumnNumber = "9223372036854775807"
  39 + endingColumnNumber = "9223372036854775807"
  40 + startingLineNumber = "65"
  41 + endingLineNumber = "65"
  42 + landmarkName = "-eventTriggered:"
  43 + landmarkType = "5">
  44 + </BreakpointContent>
  45 + </BreakpointProxy>
30 </Breakpoints> 46 </Breakpoints>
31 </Bucket> 47 </Bucket>
@@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
73 } else if ([title isEqualToString:@"链接跳转"]) { 73 } else if ([title isEqualToString:@"链接跳转"]) {
74 wv.url = @"http://sealedace.com/content/images/test/h5_test.html"; 74 wv.url = @"http://sealedace.com/content/images/test/h5_test.html";
75 } else { 75 } else {
76 - wv.url = @"http://yohomars.test.yoho.cn/message/index?uid=8654049&session_code=00840ce1bccbf76c3b9b6ab34e0c5f50"; 76 + wv.url = @"http://yohomars.test.yoho.cn/message/index?uid=8654049&session_code=00840ce10f61844257920a986ed1b647";
77 } 77 }
78 78
79 [self.navigationController pushViewController:wv animated:YES]; 79 [self.navigationController pushViewController:wv animated:YES];