You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2020/01/08 16:09:16 UTC

[GitHub] [cordova-plugin-statusbar] digibusiness opened a new issue #177: Wrong status bar height after input:file "Take Photo" (iOS 13 only)

digibusiness opened a new issue #177: Wrong status bar height after input:file "Take Photo" (iOS 13 only)
URL: https://github.com/apache/cordova-plugin-statusbar/issues/177
 
 
   # Bug Report
   With StatusBarOverlaysWebView=false, if I choose "Take Photo" from an `<input type="file" accept="image/*" />`, when the app goes back to the webview (clicking Cancel is enough) the status bar height is set to 0.
   After that, the status bar aspect is the same as if it was set to StatusBarOverlaysWebView=true.
   In iOS 12 the height is set properly.
   
   ## Problem
   After a photo is taken (or "Cancel" is clicked) `cordovaViewWillAppear` is invoked (file CDVStatusBar.m), then `[self resizeWebView];` is called.
   Inside `resizeWebView`, `[UIApplication sharedApplication].statusBarFrame` returns a 0x0 CGRect.
   Consequently, the height of the status bar is set to 0.
   
   ### What is expected to happen?
   The status bar height should be set to the correct height.
   
   ### What does actually happen?
   The status bar height is set to 0, so the result is the same as StatusBarOverlaysWebView=true.
   
   
   ## Information
   <!-- Include all relevant information that might help understand and reproduce the problem -->
   To fix this problem, I have changed the cordovaViewWillAppear method with the same fix applied to statusBarDidChangeFrame.
   I don't know if this has any side effects...
   
   **Before**
   ```
   -(void)cordovaViewWillAppear:(NSNotification*)notification
   {
       [self resizeWebView];
   }
   ```
   
   **After**
   ```
   -(void)cordovaViewWillAppear:(NSNotification*)notification
   {
       //Fix
       //[self resizeWebView];
       //add a small delay ( 0.1 seconds ) or statusbar size will be wrong
       __weak CDVStatusBar* weakSelf = self;
       dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
           [weakSelf resizeWebView];
       });
       //End fix
   }
   ```
   
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   - Create an empty cordova project `cordova create TestApp com.cordova.testApp TestApp`
   - Add iOS platform `cordova platform add ios`
   - Add cordova-plugin-statusbar `cordova plugin add cordova-plugin-statusbar`
   - In www/index.html, replace `<body>` with `<body>TEST<input type="file" accept="image/*" />`
   - In www/css/index.css remove
   `padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-right, 0px)`
   - In config.xml insert:
   `<preference name="StatusBarOverlaysWebView" value="false" />`
   `<preference name="StatusBarBackgroundColor" value="#E4E4E4" />`
   - Run `cordova prepare`
   - From XCode run the app in a physical device (iOS simulator has no camera)
   - Click "Choose File", then "Take Photo", then "OK"
   - Finally click Cancel (or take a photo), now "TEST" is under the status bar
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you experiencing the issue? -->
   iOS 13
   Tested on iPad Pro 9.7 and iPhone X.
   
   ### Version information
   <!-- 
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins 
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   Cordova CLI 9.0.0
   Cordova iOS platform v5.1.1
   cordova-plugin-statusbar v2.4.2
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version
   - [x] I included all the necessary information above

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-statusbar] breautek commented on issue #177: Wrong status bar height after input:file "Take Photo" (iOS 13 only)

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #177: Wrong status bar height after input:file "Take Photo" (iOS 13 only)
URL: https://github.com/apache/cordova-plugin-statusbar/issues/177#issuecomment-572171237
 
 
   I wonder if there is another way to do this instead of simply adding a timer to wait x amount of time.
   
   Generally speaking, I dislike waiting x amount of time as that doesn't necessary guarantee that what we are waiting for will actually be ready to read.
   
   I'm not really an iOS expert, but is there a way to listen for statusbar/UI changes instead? Perhaps the `application:didChangeStatusBarFrame` delegate method will be a better approach to resize the webview.
   
   https://stackoverflow.com/a/2944534/4685664

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-statusbar] jcesarmobile commented on issue #177: Wrong status bar height after input:file "Take Photo" (iOS 13 only)

Posted by GitBox <gi...@apache.org>.
jcesarmobile commented on issue #177: Wrong status bar height after input:file "Take Photo" (iOS 13 only)
URL: https://github.com/apache/cordova-plugin-statusbar/issues/177#issuecomment-579405161
 
 
   it's already fixed, but not released yet
   https://github.com/apache/cordova-plugin-statusbar/pull/157/files

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-statusbar] digibusiness commented on issue #177: Wrong status bar height after input:file "Take Photo" (iOS 13 only)

Posted by GitBox <gi...@apache.org>.
digibusiness commented on issue #177: Wrong status bar height after input:file "Take Photo" (iOS 13 only)
URL: https://github.com/apache/cordova-plugin-statusbar/issues/177#issuecomment-572711899
 
 
   We are not iOS developers either.
   Probably that fix is not the most elegant solution, but we needed something that would solve the problem as soon as possible.
   We implemented that code because the problem seemed the same as the one addressed in the statusBarDidChangeFrame method; the cordovaViewWillAppear event also appears to be invoked before the actual frame change (at least in the reported case).
   If so, and if there is no other event available, appending the event to the dispatcher may be the only solution.
   However, if another way to solve the problem could be found, such as using the events you suggested, it would certainly be better, but we do not have the ability to verify your suggestion, we would need knowledge of the iOS apps that unfortunately we don't have.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-statusbar] jcesarmobile commented on issue #177: Wrong status bar height after input:file "Take Photo" (iOS 13 only)

Posted by GitBox <gi...@apache.org>.
jcesarmobile commented on issue #177: Wrong status bar height after input:file "Take Photo" (iOS 13 only)
URL: https://github.com/apache/cordova-plugin-statusbar/issues/177#issuecomment-579406626
 
 
   @breautek didChangeStatusBarFrame is already used, but the size is wrong, it has a delay there too to get the correct size, and it's not called when it has another view on top (camera, inAppBrowser, or as in this issue, the input file picker)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-statusbar] jcesarmobile closed issue #177: Wrong status bar height after input:file "Take Photo" (iOS 13 only)

Posted by GitBox <gi...@apache.org>.
jcesarmobile closed issue #177: Wrong status bar height after input:file "Take Photo" (iOS 13 only)
URL: https://github.com/apache/cordova-plugin-statusbar/issues/177
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org