Explorar el Código

fix(iOS): Xcode issues and warnings (no functionality changes) (#860)

* Fix Xcode warnings (enums, whitespace, string literals)

* Add nullability notations
jnpdx hace 4 años
padre
commit
6cfdd4b88c
Se han modificado 2 ficheros con 18 adiciones y 18 borrados
  1. 11
    11
      ios/RNCWebView.h
  2. 7
    7
      ios/RNCWebView.m

+ 11
- 11
ios/RNCWebView.h Ver fichero

13
 
13
 
14
 @protocol RNCWebViewDelegate <NSObject>
14
 @protocol RNCWebViewDelegate <NSObject>
15
 
15
 
16
-- (BOOL)webView:(RNCWebView *)webView
17
-   shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
18
-   withCallback:(RCTDirectEventBlock)callback;
16
+- (BOOL)webView:(RNCWebView *_Nonnull)webView
17
+   shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *_Nonnull)request
18
+   withCallback:(RCTDirectEventBlock _Nonnull)callback;
19
 
19
 
20
 @end
20
 @end
21
 
21
 
22
 @interface RNCWebView : RCTView
22
 @interface RNCWebView : RCTView
23
 
23
 
24
-@property (nonatomic, weak) id<RNCWebViewDelegate> delegate;
25
-@property (nonatomic, copy) NSDictionary *source;
24
+@property (nonatomic, weak) id<RNCWebViewDelegate> _Nullable delegate;
25
+@property (nonatomic, copy) NSDictionary * _Nullable source;
26
 @property (nonatomic, assign) BOOL messagingEnabled;
26
 @property (nonatomic, assign) BOOL messagingEnabled;
27
-@property (nonatomic, copy) NSString *injectedJavaScript;
27
+@property (nonatomic, copy) NSString * _Nullable injectedJavaScript;
28
 @property (nonatomic, assign) BOOL scrollEnabled;
28
 @property (nonatomic, assign) BOOL scrollEnabled;
29
 @property (nonatomic, assign) BOOL sharedCookiesEnabled;
29
 @property (nonatomic, assign) BOOL sharedCookiesEnabled;
30
 @property (nonatomic, assign) BOOL pagingEnabled;
30
 @property (nonatomic, assign) BOOL pagingEnabled;
42
 @property (nonatomic, assign) BOOL allowsBackForwardNavigationGestures;
42
 @property (nonatomic, assign) BOOL allowsBackForwardNavigationGestures;
43
 @property (nonatomic, assign) BOOL incognito;
43
 @property (nonatomic, assign) BOOL incognito;
44
 @property (nonatomic, assign) BOOL useSharedProcessPool;
44
 @property (nonatomic, assign) BOOL useSharedProcessPool;
45
-@property (nonatomic, copy) NSString *userAgent;
46
-@property (nonatomic, copy) NSString *applicationNameForUserAgent;
45
+@property (nonatomic, copy) NSString * _Nullable userAgent;
46
+@property (nonatomic, copy) NSString * _Nullable applicationNameForUserAgent;
47
 @property (nonatomic, assign) BOOL cacheEnabled;
47
 @property (nonatomic, assign) BOOL cacheEnabled;
48
 @property (nonatomic, assign) BOOL javaScriptEnabled;
48
 @property (nonatomic, assign) BOOL javaScriptEnabled;
49
 @property (nonatomic, assign) BOOL allowsLinkPreview;
49
 @property (nonatomic, assign) BOOL allowsLinkPreview;
50
 @property (nonatomic, assign) BOOL showsHorizontalScrollIndicator;
50
 @property (nonatomic, assign) BOOL showsHorizontalScrollIndicator;
51
 @property (nonatomic, assign) BOOL showsVerticalScrollIndicator;
51
 @property (nonatomic, assign) BOOL showsVerticalScrollIndicator;
52
 @property (nonatomic, assign) BOOL directionalLockEnabled;
52
 @property (nonatomic, assign) BOOL directionalLockEnabled;
53
-@property (nonatomic, copy) NSString *allowingReadAccessToURL;
53
+@property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL;
54
 
54
 
55
 + (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential;
55
 + (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential;
56
 + (void)setCustomCertificatesForHost:(nullable NSDictionary *)certificates;
56
 + (void)setCustomCertificatesForHost:(nullable NSDictionary *)certificates;
57
-- (void)postMessage:(NSString *)message;
58
-- (void)injectJavaScript:(NSString *)script;
57
+- (void)postMessage:(NSString *_Nullable)message;
58
+- (void)injectJavaScript:(NSString *_Nullable)script;
59
 - (void)goForward;
59
 - (void)goForward;
60
 - (void)goBack;
60
 - (void)goBack;
61
 - (void)reload;
61
 - (void)reload;

+ 7
- 7
ios/RNCWebView.m Ver fichero

286
   } else {
286
   } else {
287
     _isFullScreenVideoOpen = NO;
287
     _isFullScreenVideoOpen = NO;
288
     RCTUnsafeExecuteOnMainQueueSync(^{
288
     RCTUnsafeExecuteOnMainQueueSync(^{
289
-      [RCTSharedApplication() setStatusBarHidden:_savedStatusBarHidden animated:YES];
290
-      [RCTSharedApplication() setStatusBarStyle:_savedStatusBarStyle animated:YES];
289
+      [RCTSharedApplication() setStatusBarHidden:self->_savedStatusBarHidden animated:YES];
290
+      [RCTSharedApplication() setStatusBarStyle:self->_savedStatusBarStyle animated:YES];
291
     });
291
     });
292
   }
292
   }
293
 #pragma clang diagnostic pop
293
 #pragma clang diagnostic pop
741
  * topViewController
741
  * topViewController
742
  */
742
  */
743
 -(UIViewController *)topViewController{
743
 -(UIViewController *)topViewController{
744
-   UIViewController *controller = [self topViewControllerWithRootViewController:[self getCurrentWindow].rootViewController];
745
-   return controller;
744
+    UIViewController *controller = [self topViewControllerWithRootViewController:[self getCurrentWindow].rootViewController];
745
+    return controller;
746
 }
746
 }
747
 
747
 
748
 /**
748
 /**
812
     if (![self.delegate webView:self
812
     if (![self.delegate webView:self
813
       shouldStartLoadForRequest:event
813
       shouldStartLoadForRequest:event
814
                    withCallback:_onShouldStartLoadWithRequest]) {
814
                    withCallback:_onShouldStartLoadWithRequest]) {
815
-      decisionHandler(WKNavigationResponsePolicyCancel);
815
+      decisionHandler(WKNavigationActionPolicyCancel);
816
       return;
816
       return;
817
     }
817
     }
818
   }
818
   }
831
   }
831
   }
832
 
832
 
833
   // Allow all navigation by default
833
   // Allow all navigation by default
834
-  decisionHandler(WKNavigationResponsePolicyAllow);
834
+  decisionHandler(WKNavigationActionPolicyAllow);
835
 }
835
 }
836
 
836
 
837
 /**
837
 /**
918
       callback([NSString stringWithFormat:@"%@", result]);
918
       callback([NSString stringWithFormat:@"%@", result]);
919
     }
919
     }
920
     if (error != nil) {
920
     if (error != nil) {
921
-      RCTLogWarn([NSString stringWithFormat:@"Error evaluating injectedJavaScript: This is possibly due to an unsupported return type. Try adding true to the end of your injectedJavaScript string. %@", error]);
921
+      RCTLogWarn(@"%@", [NSString stringWithFormat:@"Error evaluating injectedJavaScript: This is possibly due to an unsupported return type. Try adding true to the end of your injectedJavaScript string. %@", error]);
922
     }
922
     }
923
   }];
923
   }];
924
 }
924
 }