|
@@ -230,6 +230,12 @@ static NSDictionary* customCertificatesForHost;
|
230
|
230
|
[wkWebViewConfig.userContentController addUserScript:script];
|
231
|
231
|
|
232
|
232
|
if (_messagingEnabled) {
|
|
233
|
+ for (NSString *handler in _messageHandlers)
|
|
234
|
+ {
|
|
235
|
+ [wkWebViewConfig.userContentController addScriptMessageHandler:[[RNCWeakScriptMessageDelegate alloc] initWithDelegate:self]
|
|
236
|
+ name:handler];
|
|
237
|
+ }
|
|
238
|
+
|
233
|
239
|
[wkWebViewConfig.userContentController addScriptMessageHandler:[[RNCWeakScriptMessageDelegate alloc] initWithDelegate:self]
|
234
|
240
|
name:MessageHandlerName];
|
235
|
241
|
|
|
@@ -523,6 +529,15 @@ static NSDictionary* customCertificatesForHost;
|
523
|
529
|
[event addEntriesFromDictionary: @{@"data": message.body}];
|
524
|
530
|
_onMessage(event);
|
525
|
531
|
}
|
|
532
|
+ } else {
|
|
533
|
+ if (_onMessage) {
|
|
534
|
+ NSMutableDictionary<NSString *, id> *event = [self baseEvent];
|
|
535
|
+ if (message.body) {
|
|
536
|
+ [event addEntriesFromDictionary: @{@"data": message.body}];
|
|
537
|
+ }
|
|
538
|
+ [event addEntriesFromDictionary: @{@"handler": message.name}];
|
|
539
|
+ _onMessage(event);
|
|
540
|
+ }
|
526
|
541
|
}
|
527
|
542
|
}
|
528
|
543
|
|
|
@@ -1076,7 +1091,7 @@ static NSDictionary* customCertificatesForHost;
|
1076
|
1091
|
_onHttpError(event);
|
1077
|
1092
|
}
|
1078
|
1093
|
}
|
1079
|
|
- }
|
|
1094
|
+ }
|
1080
|
1095
|
|
1081
|
1096
|
decisionHandler(WKNavigationResponsePolicyAllow);
|
1082
|
1097
|
}
|