Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-5291

Capture Audio - status bar issues under iOS 7

    Details

      Description

      1. Since most of mobile spec test pages have a dark background, I set the value of 'UIStatusBarStyle' as 'UIStatusBarStyleLightContent' in info.plist in order to display statusbar correctly! For most of the test pages, everything goes well.

      2. However, open the test:Capture->'Capture 10 secs of audio and play', the status bar's text cannot be seen clearly(See attached screenshots).

      I think there are two ways to fix it:
      1. hide status bar but maybe it's not a good idea
      2. set status bar's style to UIStatusBarStyleDefault(dark content) in plugin native code

      1. IMG_0214.PNG
        613 kB
        lmnbeyond

        Activity

        Hide
        lmnbeyond lmnbeyond added a comment -

        I have fixed it and sent a pull request from GitHub, if it's convenient, please review this:
        https://github.com/apache/cordova-plugin-media-capture/pull/5

        Show
        lmnbeyond lmnbeyond added a comment - I have fixed it and sent a pull request from GitHub, if it's convenient, please review this: https://github.com/apache/cordova-plugin-media-capture/pull/5
        Hide
        shazron Shazron Abdullah added a comment -

        Testing your assertions there is a problem.

        1. In a new app, setting UIStatusBarStyleLightContent in iOS 7 does nothing. The default style (black) still shows. This is because UIViewControllerBasedStatusBarAppearance is YES (default, if it is missing). To use this you would set UIViewControllerBasedStatusBarAppearance to NO. Doing this, you would get the white text throughout.

        2. In a new app, the default text is already black, thus the Capture plugin shows fine.

        We want to avoid depending on the value of UIViewControllerBasedStatusBarAppearance.The proper fix is to add a preferredStatusBarStyle override in your MainViewController.m to set the status bar style (when UIViewControllerBasedStatusBarAppearance is YES), and to also set it in viewWillAppear (for when UIViewControllerBasedStatusBarAppearance is NO). You could detect this setting as well to conditionally run your code. In this case for mobile-spec it would set it to UIStatusBarStyleDefault (or you could use the org.apache.cordova.statusbar plugin to control this by API, it uses the same concept).

        With the assumptions above corrected, the pull request will now test ok (so you can see the statusbar change back from black to white when the plugin is dismissed)

        Show
        shazron Shazron Abdullah added a comment - Testing your assertions there is a problem. 1. In a new app, setting UIStatusBarStyleLightContent in iOS 7 does nothing. The default style (black) still shows. This is because UIViewControllerBasedStatusBarAppearance is YES (default, if it is missing). To use this you would set UIViewControllerBasedStatusBarAppearance to NO. Doing this, you would get the white text throughout. 2. In a new app, the default text is already black, thus the Capture plugin shows fine. We want to avoid depending on the value of UIViewControllerBasedStatusBarAppearance.The proper fix is to add a preferredStatusBarStyle override in your MainViewController.m to set the status bar style (when UIViewControllerBasedStatusBarAppearance is YES), and to also set it in viewWillAppear (for when UIViewControllerBasedStatusBarAppearance is NO). You could detect this setting as well to conditionally run your code. In this case for mobile-spec it would set it to UIStatusBarStyleDefault (or you could use the org.apache.cordova.statusbar plugin to control this by API, it uses the same concept). With the assumptions above corrected, the pull request will now test ok (so you can see the statusbar change back from black to white when the plugin is dismissed)
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 1b42035b88bc3554f9ee466f8f6e951c44f3e0c4 in branch refs/heads/dev from lmnbeyond
        [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-media-capture.git;h=1b42035 ]

        CB-5291 - ios - Media Capture Audio - status bar issues under iOS 7

        When AudioRecorderView shows, use UIStatusBarStyleDefault; when
        AudioRecorderView is dismissed, use previous status bar style.

        Show
        jira-bot ASF subversion and git services added a comment - Commit 1b42035b88bc3554f9ee466f8f6e951c44f3e0c4 in branch refs/heads/dev from lmnbeyond [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-media-capture.git;h=1b42035 ] CB-5291 - ios - Media Capture Audio - status bar issues under iOS 7 When AudioRecorderView shows, use UIStatusBarStyleDefault; when AudioRecorderView is dismissed, use previous status bar style.
        Hide
        lmnbeyond lmnbeyond added a comment - - edited

        Shazron Abdullah You're right. I did set UIViewControllerBasedStatusBarAppearance to NO. Sorry, it's my fault that I didn't mention that earlier.

        Show
        lmnbeyond lmnbeyond added a comment - - edited Shazron Abdullah You're right. I did set UIViewControllerBasedStatusBarAppearance to NO. Sorry, it's my fault that I didn't mention that earlier.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 1b42035b88bc3554f9ee466f8f6e951c44f3e0c4 in branch refs/heads/master from glmnbeyond
        [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-media-capture.git;h=1b42035 ]

        CB-5291 - ios - Media Capture Audio - status bar issues under iOS 7

        When AudioRecorderView shows, use UIStatusBarStyleDefault; when
        AudioRecorderView is dismissed, use previous status bar style.

        Show
        jira-bot ASF subversion and git services added a comment - Commit 1b42035b88bc3554f9ee466f8f6e951c44f3e0c4 in branch refs/heads/master from glmnbeyond [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-media-capture.git;h=1b42035 ] CB-5291 - ios - Media Capture Audio - status bar issues under iOS 7 When AudioRecorderView shows, use UIStatusBarStyleDefault; when AudioRecorderView is dismissed, use previous status bar style.

          People

          • Assignee:
            shazron Shazron Abdullah
            Reporter:
            lmnbeyond lmnbeyond
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development