@@ -796,22 +796,25 @@ - (void)setAllowingReadAccessToURL:(NSString *)allowingReadAccessToURL
796
796
}
797
797
}
798
798
799
- #if !TARGET_OS_OSX
800
799
- (void )setContentInset : (UIEdgeInsets)contentInset
801
800
{
801
+ #if !TARGET_OS_OSX
802
802
_contentInset = contentInset;
803
803
[RCTView autoAdjustInsetsForView: self
804
804
withScrollView: _webView.scrollView
805
805
updateOffset: NO ];
806
+ #endif // !TARGET_OS_OSX
806
807
}
807
808
808
809
- (void )refreshContentInset
809
810
{
811
+ #if !TARGET_OS_OSX
810
812
[RCTView autoAdjustInsetsForView: self
811
813
withScrollView: _webView.scrollView
812
814
updateOffset: YES ];
813
- }
814
815
#endif // !TARGET_OS_OSX
816
+ }
817
+
815
818
816
819
- (void )visitSource
817
820
{
@@ -878,6 +881,7 @@ -(void)setSuppressMenuItems:(NSArray<NSString *> *)suppressMenuItems {
878
881
#if TARGET_OS_IOS
879
882
-(void )setKeyboardDisplayRequiresUserAction : (BOOL )keyboardDisplayRequiresUserAction
880
883
{
884
+ _keyboardDisplayRequiresUserAction = keyboardDisplayRequiresUserAction;
881
885
if (_webView == nil ) {
882
886
_savedKeyboardDisplayRequiresUserAction = keyboardDisplayRequiresUserAction;
883
887
return ;
@@ -910,7 +914,7 @@ -(void)setKeyboardDisplayRequiresUserAction:(BOOL)keyboardDisplayRequiresUserAct
910
914
SEL selector = sel_getUid (" _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:" );
911
915
method = class_getInstanceMethod (class, selector);
912
916
IMP original = method_getImplementation (method);
913
- override = imp_implementationWithBlock (^void (id me, void * arg0, BOOL arg1, BOOL arg2, BOOL arg3, id arg4) {
917
+ override = imp_implementationWithBlock (^void (id me, void * arg0, __unused BOOL arg1, BOOL arg2, BOOL arg3, id arg4) {
914
918
((void (*)(id , SEL , void *, BOOL , BOOL , BOOL , id ))original)(me, selector, arg0, TRUE , arg2, arg3, arg4);
915
919
});
916
920
}
@@ -919,7 +923,7 @@ -(void)setKeyboardDisplayRequiresUserAction:(BOOL)keyboardDisplayRequiresUserAct
919
923
SEL selector = sel_getUid (" _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:" );
920
924
method = class_getInstanceMethod (class, selector);
921
925
IMP original = method_getImplementation (method);
922
- override = imp_implementationWithBlock (^void (id me, void * arg0, BOOL arg1, BOOL arg2, BOOL arg3, id arg4) {
926
+ override = imp_implementationWithBlock (^void (id me, void * arg0, __unused BOOL arg1, BOOL arg2, BOOL arg3, id arg4) {
923
927
((void (*)(id , SEL , void *, BOOL , BOOL , BOOL , id ))original)(me, selector, arg0, TRUE , arg2, arg3, arg4);
924
928
});
925
929
}
@@ -928,15 +932,15 @@ -(void)setKeyboardDisplayRequiresUserAction:(BOOL)keyboardDisplayRequiresUserAct
928
932
SEL selector = sel_getUid (" _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:" );
929
933
method = class_getInstanceMethod (class, selector);
930
934
IMP original = method_getImplementation (method);
931
- override = imp_implementationWithBlock (^void (id me, void * arg0, BOOL arg1, BOOL arg2, BOOL arg3, id arg4) {
935
+ override = imp_implementationWithBlock (^void (id me, void * arg0, __unused BOOL arg1, BOOL arg2, BOOL arg3, id arg4) {
932
936
((void (*)(id , SEL , void *, BOOL , BOOL , BOOL , id ))original)(me, selector, arg0, TRUE , arg2, arg3, arg4);
933
937
});
934
938
} else {
935
939
// iOS 9.0 - 11.3.0
936
940
SEL selector = sel_getUid (" _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:" );
937
941
method = class_getInstanceMethod (class, selector);
938
942
IMP original = method_getImplementation (method);
939
- override = imp_implementationWithBlock (^void (id me, void * arg0, BOOL arg1, BOOL arg2, id arg3) {
943
+ override = imp_implementationWithBlock (^void (id me, void * arg0, __unused BOOL arg1, BOOL arg2, id arg3) {
940
944
((void (*)(id , SEL , void *, BOOL , BOOL , id ))original)(me, selector, arg0, TRUE , arg2, arg3);
941
945
});
942
946
}
@@ -946,6 +950,7 @@ -(void)setKeyboardDisplayRequiresUserAction:(BOOL)keyboardDisplayRequiresUserAct
946
950
947
951
-(void )setHideKeyboardAccessoryView : (BOOL )hideKeyboardAccessoryView
948
952
{
953
+ _hideKeyboardAccessoryView = hideKeyboardAccessoryView;
949
954
_savedHideKeyboardAccessoryView = hideKeyboardAccessoryView;
950
955
951
956
if (_webView == nil ) {
@@ -1168,7 +1173,7 @@ - (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSStrin
1168
1173
{
1169
1174
#if !TARGET_OS_OSX
1170
1175
UIAlertController *alert = [UIAlertController alertControllerWithTitle: @" " message: message preferredStyle: UIAlertControllerStyleAlert];
1171
- [alert addAction: [UIAlertAction actionWithTitle: @" Ok" style: UIAlertActionStyleDefault handler: ^(UIAlertAction *action) {
1176
+ [alert addAction: [UIAlertAction actionWithTitle: @" Ok" style: UIAlertActionStyleDefault handler: ^(__unused UIAlertAction *action) {
1172
1177
completionHandler ();
1173
1178
}]];
1174
1179
[[self topViewController ] presentViewController: alert animated: YES completion: NULL ];
@@ -1187,10 +1192,10 @@ - (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSStrin
1187
1192
- (void )webView : (WKWebView *)webView runJavaScriptConfirmPanelWithMessage : (NSString *)message initiatedByFrame : (WKFrameInfo *)frame completionHandler : (void (^)(BOOL ))completionHandler {
1188
1193
#if !TARGET_OS_OSX
1189
1194
UIAlertController *alert = [UIAlertController alertControllerWithTitle: @" " message: message preferredStyle: UIAlertControllerStyleAlert];
1190
- [alert addAction: [UIAlertAction actionWithTitle: @" Ok" style: UIAlertActionStyleDefault handler: ^(UIAlertAction *action) {
1195
+ [alert addAction: [UIAlertAction actionWithTitle: @" Ok" style: UIAlertActionStyleDefault handler: ^(__unused UIAlertAction *action) {
1191
1196
completionHandler (YES );
1192
1197
}]];
1193
- [alert addAction: [UIAlertAction actionWithTitle: @" Cancel" style: UIAlertActionStyleCancel handler: ^(UIAlertAction *action) {
1198
+ [alert addAction: [UIAlertAction actionWithTitle: @" Cancel" style: UIAlertActionStyleCancel handler: ^(__unused UIAlertAction *action) {
1194
1199
completionHandler (NO );
1195
1200
}]];
1196
1201
[[self topViewController ] presentViewController: alert animated: YES completion: NULL ];
@@ -1215,11 +1220,11 @@ - (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSSt
1215
1220
[alert addTextFieldWithConfigurationHandler: ^(UITextField *textField) {
1216
1221
textField.text = defaultText;
1217
1222
}];
1218
- UIAlertAction *okAction = [UIAlertAction actionWithTitle: @" Ok" style: UIAlertActionStyleDefault handler: ^(UIAlertAction *action) {
1223
+ UIAlertAction *okAction = [UIAlertAction actionWithTitle: @" Ok" style: UIAlertActionStyleDefault handler: ^(__unused UIAlertAction *action) {
1219
1224
completionHandler ([[alert.textFields lastObject ] text ]);
1220
1225
}];
1221
1226
[alert addAction: okAction];
1222
- UIAlertAction *cancelAction = [UIAlertAction actionWithTitle: @" Cancel" style: UIAlertActionStyleCancel handler: ^(UIAlertAction *action) {
1227
+ UIAlertAction *cancelAction = [UIAlertAction actionWithTitle: @" Cancel" style: UIAlertActionStyleCancel handler: ^(__unused UIAlertAction *action) {
1223
1228
completionHandler (nil );
1224
1229
}];
1225
1230
[alert addAction: cancelAction];
@@ -1328,7 +1333,6 @@ - (void) webView:(WKWebView *)webView
1328
1333
}
1329
1334
1330
1335
if (_onShouldStartLoadWithRequest) {
1331
- NSMutableDictionary <NSString *, id > *event = [self baseEvent ];
1332
1336
int lockIdentifier = [[RNCWebViewDecisionManager getInstance ] setDecisionHandler: ^(BOOL shouldStart){
1333
1337
dispatch_async (dispatch_get_main_queue (), ^{
1334
1338
if (!shouldStart) {
@@ -1352,6 +1356,7 @@ - (void) webView:(WKWebView *)webView
1352
1356
});
1353
1357
1354
1358
}];
1359
+ NSMutableDictionary <NSString *, id > *event = [self baseEvent ];
1355
1360
if (request.mainDocumentURL ) {
1356
1361
[event addEntriesFromDictionary: @{
1357
1362
@" mainDocumentURL" : (request.mainDocumentURL ).absoluteString ,
@@ -1685,6 +1690,7 @@ - (void)setInjectedJavaScript:(NSString *)source {
1685
1690
1686
1691
- (void )setInjectedJavaScriptObject : (NSString *)source
1687
1692
{
1693
+ _injectedJavaScriptObject = source;
1688
1694
self.injectedObjectJsonScript = [
1689
1695
[WKUserScript alloc ]
1690
1696
initWithSource: [
@@ -1823,8 +1829,8 @@ - (void)resetupScripts:(WKWebViewConfiguration *)wkWebViewConfig {
1823
1829
" })\n "
1824
1830
" })(window.history)\n " , HistoryShimName
1825
1831
];
1826
- WKUserScript *script = [[WKUserScript alloc ] initWithSource: html5HistoryAPIShimSource injectionTime: WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly: YES ];
1827
- [wkWebViewConfig.userContentController addUserScript: script ];
1832
+ WKUserScript *userScript = [[WKUserScript alloc ] initWithSource: html5HistoryAPIShimSource injectionTime: WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly: YES ];
1833
+ [wkWebViewConfig.userContentController addUserScript: userScript ];
1828
1834
1829
1835
if (_sharedCookiesEnabled) {
1830
1836
// More info to sending cookies with WKWebView
0 commit comments