GitToTheHub commented on code in PR #1701:
URL: https://github.com/apache/cordova-ios/pull/1701#discussion_r3864762663


##########
CordovaLib/Classes/Public/CDVViewController.m:
##########
@@ -45,6 +45,7 @@ @interface CDVViewController () 
<CDVWebViewEngineConfigurationDelegate, UIScroll
     UIColor *_statusBarBackgroundColor;
     UIColor *_statusBarWebViewColor;
     UIColor *_statusBarDefaultColor;
+    BOOL _statusBarHidden;

Review Comment:
   What about renaming the variable to `_systemStatusBarHidden`? Than it's 
clear it's not about our own custom status bar background



##########
CordovaLib/Classes/Public/CDVViewController.m:
##########
@@ -598,7 +599,11 @@ - 
(void)scrollViewDidChangeAdjustedContentInset:(UIScrollView *)scrollView
     // On Mac Catalyst, Cordova may manually constrain the web view below the 
title bar.
     // In that case automatic scroll-view inset adjustment is disabled, so the 
synthetic
     // status bar view should be hidden.
-    self.statusBarBackground.hidden = 
(scrollView.contentInsetAdjustmentBehavior == 
UIScrollViewContentInsetAdjustmentNever);
+    if (_statusBarHidden) {
+        self.statusBarBackground.hidden = true;

Review Comment:
   Rather than updating `self.statusBarBackground.hidden` to `true` when 
`_statusBarHidden` when changes, I would sync it directly in `showStatusBar:`. 
The could is more clean if it is just:
   
   ```objc
   if (!_statusBarHidden) {
       self.statusBarBackground.hidden = 
(scrollView.contentInsetAdjustmentBehavior == 
UIScrollViewContentInsetAdjustmentNever);
   }
   ```
   
   with the comment above. The comment above also is only relevant for this 
piece of code.



##########
CordovaLib/Classes/Public/CDVViewController.m:
##########
@@ -905,7 +910,11 @@ - (void)showSplashScreen:(BOOL)visible
 - (void)showStatusBar:(BOOL)visible
 {
 #if !defined(TARGET_OS_VISION) || !TARGET_OS_VISION
-    [self.statusBarBackground setAlpha:(visible ? 1 : 0)];
+    _statusBarHidden = !visible;
+
+    UIScrollView *scrollView = [self.webView 
performSelector:@selector(scrollView)];
+    [self scrollViewDidChangeAdjustedContentInset:scrollView];
+

Review Comment:
   I would sync here ` self.statusBarBackground.hidden` directly. After that 
`scrollViewDidChangeAdjustedContentInset` could additionally be called.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to