Browse Source

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

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

* Add nullability notations
jnpdx 4 years ago
parent
commit
6cfdd4b88c
2 changed files with 18 additions and 18 deletions
  1. 11
    11
      ios/RNCWebView.h
  2. 7
    7
      ios/RNCWebView.m

+ 11
- 11
ios/RNCWebView.h View File

@@ -13,18 +13,18 @@
13 13
 
14 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 20
 @end
21 21
 
22 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 26
 @property (nonatomic, assign) BOOL messagingEnabled;
27
-@property (nonatomic, copy) NSString *injectedJavaScript;
27
+@property (nonatomic, copy) NSString * _Nullable injectedJavaScript;
28 28
 @property (nonatomic, assign) BOOL scrollEnabled;
29 29
 @property (nonatomic, assign) BOOL sharedCookiesEnabled;
30 30
 @property (nonatomic, assign) BOOL pagingEnabled;
@@ -42,20 +42,20 @@
42 42
 @property (nonatomic, assign) BOOL allowsBackForwardNavigationGestures;
43 43
 @property (nonatomic, assign) BOOL incognito;
44 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 47
 @property (nonatomic, assign) BOOL cacheEnabled;
48 48
 @property (nonatomic, assign) BOOL javaScriptEnabled;
49 49
 @property (nonatomic, assign) BOOL allowsLinkPreview;
50 50
 @property (nonatomic, assign) BOOL showsHorizontalScrollIndicator;
51 51
 @property (nonatomic, assign) BOOL showsVerticalScrollIndicator;
52 52
 @property (nonatomic, assign) BOOL directionalLockEnabled;
53
-@property (nonatomic, copy) NSString *allowingReadAccessToURL;
53
+@property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL;
54 54
 
55 55
 + (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential;
56 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 59
 - (void)goForward;
60 60
 - (void)goBack;
61 61
 - (void)reload;

+ 7
- 7
ios/RNCWebView.m View File

@@ -286,8 +286,8 @@ static NSDictionary* customCertificatesForHost;
286 286
   } else {
287 287
     _isFullScreenVideoOpen = NO;
288 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 293
 #pragma clang diagnostic pop
@@ -741,8 +741,8 @@ static NSDictionary* customCertificatesForHost;
741 741
  * topViewController
742 742
  */
743 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,7 +812,7 @@ static NSDictionary* customCertificatesForHost;
812 812
     if (![self.delegate webView:self
813 813
       shouldStartLoadForRequest:event
814 814
                    withCallback:_onShouldStartLoadWithRequest]) {
815
-      decisionHandler(WKNavigationResponsePolicyCancel);
815
+      decisionHandler(WKNavigationActionPolicyCancel);
816 816
       return;
817 817
     }
818 818
   }
@@ -831,7 +831,7 @@ static NSDictionary* customCertificatesForHost;
831 831
   }
832 832
 
833 833
   // Allow all navigation by default
834
-  decisionHandler(WKNavigationResponsePolicyAllow);
834
+  decisionHandler(WKNavigationActionPolicyAllow);
835 835
 }
836 836
 
837 837
 /**
@@ -918,7 +918,7 @@ static NSDictionary* customCertificatesForHost;
918 918
       callback([NSString stringWithFormat:@"%@", result]);
919 919
     }
920 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
 }