@@ -796,22 +796,25 @@ - (void)setAllowingReadAccessToURL:(NSString *)allowingReadAccessToURL
796796 }
797797}
798798
799- #if !TARGET_OS_OSX
800799- (void )setContentInset : (UIEdgeInsets)contentInset
801800{
801+ #if !TARGET_OS_OSX
802802 _contentInset = contentInset;
803803 [RCTView autoAdjustInsetsForView: self
804804 withScrollView: _webView.scrollView
805805 updateOffset: NO ];
806+ #endif // !TARGET_OS_OSX
806807}
807808
808809- (void )refreshContentInset
809810{
811+ #if !TARGET_OS_OSX
810812 [RCTView autoAdjustInsetsForView: self
811813 withScrollView: _webView.scrollView
812814 updateOffset: YES ];
813- }
814815#endif // !TARGET_OS_OSX
816+ }
817+
815818
816819- (void )visitSource
817820{
@@ -878,6 +881,7 @@ -(void)setSuppressMenuItems:(NSArray<NSString *> *)suppressMenuItems {
878881#if TARGET_OS_IOS
879882-(void )setKeyboardDisplayRequiresUserAction : (BOOL )keyboardDisplayRequiresUserAction
880883{
884+ _keyboardDisplayRequiresUserAction = keyboardDisplayRequiresUserAction;
881885 if (_webView == nil ) {
882886 _savedKeyboardDisplayRequiresUserAction = keyboardDisplayRequiresUserAction;
883887 return ;
@@ -910,7 +914,7 @@ -(void)setKeyboardDisplayRequiresUserAction:(BOOL)keyboardDisplayRequiresUserAct
910914 SEL selector = sel_getUid (" _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:" );
911915 method = class_getInstanceMethod (class, selector);
912916 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) {
914918 ((void (*)(id , SEL , void *, BOOL , BOOL , BOOL , id ))original)(me, selector, arg0, TRUE , arg2, arg3, arg4);
915919 });
916920 }
@@ -919,7 +923,7 @@ -(void)setKeyboardDisplayRequiresUserAction:(BOOL)keyboardDisplayRequiresUserAct
919923 SEL selector = sel_getUid (" _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:" );
920924 method = class_getInstanceMethod (class, selector);
921925 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) {
923927 ((void (*)(id , SEL , void *, BOOL , BOOL , BOOL , id ))original)(me, selector, arg0, TRUE , arg2, arg3, arg4);
924928 });
925929 }
@@ -928,15 +932,15 @@ -(void)setKeyboardDisplayRequiresUserAction:(BOOL)keyboardDisplayRequiresUserAct
928932 SEL selector = sel_getUid (" _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:" );
929933 method = class_getInstanceMethod (class, selector);
930934 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) {
932936 ((void (*)(id , SEL , void *, BOOL , BOOL , BOOL , id ))original)(me, selector, arg0, TRUE , arg2, arg3, arg4);
933937 });
934938 } else {
935939 // iOS 9.0 - 11.3.0
936940 SEL selector = sel_getUid (" _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:" );
937941 method = class_getInstanceMethod (class, selector);
938942 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) {
940944 ((void (*)(id , SEL , void *, BOOL , BOOL , id ))original)(me, selector, arg0, TRUE , arg2, arg3);
941945 });
942946 }
@@ -946,6 +950,7 @@ -(void)setKeyboardDisplayRequiresUserAction:(BOOL)keyboardDisplayRequiresUserAct
946950
947951-(void )setHideKeyboardAccessoryView : (BOOL )hideKeyboardAccessoryView
948952{
953+ _hideKeyboardAccessoryView = hideKeyboardAccessoryView;
949954 _savedHideKeyboardAccessoryView = hideKeyboardAccessoryView;
950955
951956 if (_webView == nil ) {
@@ -1168,7 +1173,7 @@ - (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSStrin
11681173{
11691174#if !TARGET_OS_OSX
11701175 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) {
11721177 completionHandler ();
11731178 }]];
11741179 [[self topViewController ] presentViewController: alert animated: YES completion: NULL ];
@@ -1187,10 +1192,10 @@ - (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSStrin
11871192- (void )webView : (WKWebView *)webView runJavaScriptConfirmPanelWithMessage : (NSString *)message initiatedByFrame : (WKFrameInfo *)frame completionHandler : (void (^)(BOOL ))completionHandler {
11881193#if !TARGET_OS_OSX
11891194 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) {
11911196 completionHandler (YES );
11921197 }]];
1193- [alert addAction: [UIAlertAction actionWithTitle: @" Cancel" style: UIAlertActionStyleCancel handler: ^(UIAlertAction *action) {
1198+ [alert addAction: [UIAlertAction actionWithTitle: @" Cancel" style: UIAlertActionStyleCancel handler: ^(__unused UIAlertAction *action) {
11941199 completionHandler (NO );
11951200 }]];
11961201 [[self topViewController ] presentViewController: alert animated: YES completion: NULL ];
@@ -1215,11 +1220,11 @@ - (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSSt
12151220 [alert addTextFieldWithConfigurationHandler: ^(UITextField *textField) {
12161221 textField.text = defaultText;
12171222 }];
1218- UIAlertAction *okAction = [UIAlertAction actionWithTitle: @" Ok" style: UIAlertActionStyleDefault handler: ^(UIAlertAction *action) {
1223+ UIAlertAction *okAction = [UIAlertAction actionWithTitle: @" Ok" style: UIAlertActionStyleDefault handler: ^(__unused UIAlertAction *action) {
12191224 completionHandler ([[alert.textFields lastObject ] text ]);
12201225 }];
12211226 [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) {
12231228 completionHandler (nil );
12241229 }];
12251230 [alert addAction: cancelAction];
@@ -1328,7 +1333,6 @@ - (void) webView:(WKWebView *)webView
13281333 }
13291334
13301335 if (_onShouldStartLoadWithRequest) {
1331- NSMutableDictionary <NSString *, id > *event = [self baseEvent ];
13321336 int lockIdentifier = [[RNCWebViewDecisionManager getInstance ] setDecisionHandler: ^(BOOL shouldStart){
13331337 dispatch_async (dispatch_get_main_queue (), ^{
13341338 if (!shouldStart) {
@@ -1352,6 +1356,7 @@ - (void) webView:(WKWebView *)webView
13521356 });
13531357
13541358 }];
1359+ NSMutableDictionary <NSString *, id > *event = [self baseEvent ];
13551360 if (request.mainDocumentURL ) {
13561361 [event addEntriesFromDictionary: @{
13571362 @" mainDocumentURL" : (request.mainDocumentURL ).absoluteString ,
@@ -1685,6 +1690,7 @@ - (void)setInjectedJavaScript:(NSString *)source {
16851690
16861691- (void )setInjectedJavaScriptObject : (NSString *)source
16871692{
1693+ _injectedJavaScriptObject = source;
16881694 self.injectedObjectJsonScript = [
16891695 [WKUserScript alloc ]
16901696 initWithSource: [
@@ -1823,8 +1829,8 @@ - (void)resetupScripts:(WKWebViewConfiguration *)wkWebViewConfig {
18231829 " })\n "
18241830 " })(window.history)\n " , HistoryShimName
18251831 ];
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 ];
18281834
18291835 if (_sharedCookiesEnabled) {
18301836 // More info to sending cookies with WKWebView
0 commit comments