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

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

* Add nullability notations
This commit is contained in:
jnpdx 2019-09-23 01:49:06 -07:00 committed by Thibault Malbranche
parent ac500b391b
commit 6cfdd4b88c
2 changed files with 18 additions and 18 deletions

View File

@ -13,18 +13,18 @@
@protocol RNCWebViewDelegate <NSObject> @protocol RNCWebViewDelegate <NSObject>
- (BOOL)webView:(RNCWebView *)webView - (BOOL)webView:(RNCWebView *_Nonnull)webView
shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *_Nonnull)request
withCallback:(RCTDirectEventBlock)callback; withCallback:(RCTDirectEventBlock _Nonnull)callback;
@end @end
@interface RNCWebView : RCTView @interface RNCWebView : RCTView
@property (nonatomic, weak) id<RNCWebViewDelegate> delegate; @property (nonatomic, weak) id<RNCWebViewDelegate> _Nullable delegate;
@property (nonatomic, copy) NSDictionary *source; @property (nonatomic, copy) NSDictionary * _Nullable source;
@property (nonatomic, assign) BOOL messagingEnabled; @property (nonatomic, assign) BOOL messagingEnabled;
@property (nonatomic, copy) NSString *injectedJavaScript; @property (nonatomic, copy) NSString * _Nullable injectedJavaScript;
@property (nonatomic, assign) BOOL scrollEnabled; @property (nonatomic, assign) BOOL scrollEnabled;
@property (nonatomic, assign) BOOL sharedCookiesEnabled; @property (nonatomic, assign) BOOL sharedCookiesEnabled;
@property (nonatomic, assign) BOOL pagingEnabled; @property (nonatomic, assign) BOOL pagingEnabled;
@ -42,20 +42,20 @@
@property (nonatomic, assign) BOOL allowsBackForwardNavigationGestures; @property (nonatomic, assign) BOOL allowsBackForwardNavigationGestures;
@property (nonatomic, assign) BOOL incognito; @property (nonatomic, assign) BOOL incognito;
@property (nonatomic, assign) BOOL useSharedProcessPool; @property (nonatomic, assign) BOOL useSharedProcessPool;
@property (nonatomic, copy) NSString *userAgent; @property (nonatomic, copy) NSString * _Nullable userAgent;
@property (nonatomic, copy) NSString *applicationNameForUserAgent; @property (nonatomic, copy) NSString * _Nullable applicationNameForUserAgent;
@property (nonatomic, assign) BOOL cacheEnabled; @property (nonatomic, assign) BOOL cacheEnabled;
@property (nonatomic, assign) BOOL javaScriptEnabled; @property (nonatomic, assign) BOOL javaScriptEnabled;
@property (nonatomic, assign) BOOL allowsLinkPreview; @property (nonatomic, assign) BOOL allowsLinkPreview;
@property (nonatomic, assign) BOOL showsHorizontalScrollIndicator; @property (nonatomic, assign) BOOL showsHorizontalScrollIndicator;
@property (nonatomic, assign) BOOL showsVerticalScrollIndicator; @property (nonatomic, assign) BOOL showsVerticalScrollIndicator;
@property (nonatomic, assign) BOOL directionalLockEnabled; @property (nonatomic, assign) BOOL directionalLockEnabled;
@property (nonatomic, copy) NSString *allowingReadAccessToURL; @property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL;
+ (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential; + (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential;
+ (void)setCustomCertificatesForHost:(nullable NSDictionary *)certificates; + (void)setCustomCertificatesForHost:(nullable NSDictionary *)certificates;
- (void)postMessage:(NSString *)message; - (void)postMessage:(NSString *_Nullable)message;
- (void)injectJavaScript:(NSString *)script; - (void)injectJavaScript:(NSString *_Nullable)script;
- (void)goForward; - (void)goForward;
- (void)goBack; - (void)goBack;
- (void)reload; - (void)reload;

View File

@ -286,8 +286,8 @@ static NSDictionary* customCertificatesForHost;
} else { } else {
_isFullScreenVideoOpen = NO; _isFullScreenVideoOpen = NO;
RCTUnsafeExecuteOnMainQueueSync(^{ RCTUnsafeExecuteOnMainQueueSync(^{
[RCTSharedApplication() setStatusBarHidden:_savedStatusBarHidden animated:YES]; [RCTSharedApplication() setStatusBarHidden:self->_savedStatusBarHidden animated:YES];
[RCTSharedApplication() setStatusBarStyle:_savedStatusBarStyle animated:YES]; [RCTSharedApplication() setStatusBarStyle:self->_savedStatusBarStyle animated:YES];
}); });
} }
#pragma clang diagnostic pop #pragma clang diagnostic pop
@ -741,8 +741,8 @@ static NSDictionary* customCertificatesForHost;
* topViewController * topViewController
*/ */
-(UIViewController *)topViewController{ -(UIViewController *)topViewController{
   UIViewController *controller = [self topViewControllerWithRootViewController:[self getCurrentWindow].rootViewController]; UIViewController *controller = [self topViewControllerWithRootViewController:[self getCurrentWindow].rootViewController];
   return controller; return controller;
} }
/** /**
@ -812,7 +812,7 @@ static NSDictionary* customCertificatesForHost;
if (![self.delegate webView:self if (![self.delegate webView:self
shouldStartLoadForRequest:event shouldStartLoadForRequest:event
withCallback:_onShouldStartLoadWithRequest]) { withCallback:_onShouldStartLoadWithRequest]) {
decisionHandler(WKNavigationResponsePolicyCancel); decisionHandler(WKNavigationActionPolicyCancel);
return; return;
} }
} }
@ -831,7 +831,7 @@ static NSDictionary* customCertificatesForHost;
} }
// Allow all navigation by default // Allow all navigation by default
decisionHandler(WKNavigationResponsePolicyAllow); decisionHandler(WKNavigationActionPolicyAllow);
} }
/** /**
@ -918,7 +918,7 @@ static NSDictionary* customCertificatesForHost;
callback([NSString stringWithFormat:@"%@", result]); callback([NSString stringWithFormat:@"%@", result]);
} }
if (error != nil) { if (error != nil) {
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]); 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]);
} }
}]; }];
} }