You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by idpaterson <gi...@git.apache.org> on 2015/08/04 22:34:07 UTC

[GitHub] cordova-plugin-dialogs pull request: CB-9449 - Allow a blank strin...

GitHub user idpaterson opened a pull request:

    https://github.com/apache/cordova-plugin-dialogs/pull/55

    CB-9449 - Allow a blank string for dialog titles and messages.

    Currently there is no way to create a dialog in the Cordova Dialogs plugin without a title. Providing an empty string as the title for any of alert, confirm, or prompt results in a non-localized default title. This makes it impossible to show message-only dialogs on platforms that support such a thing, like iOS. Currently, all dialogs must have a title and additionally prompts must have a message, whether they are provided by the developer or forced by the plugin.
    
    ### No workarounds
    
    There are no known workarounds. One that came to mind was passing a space character `navigator.notification.alert('message', null, ' ');` but on iOS this results in a blank space for the title at the top of the alert. Sending an object that will evaluate to true but return a blank string when stringified causes the app to crash `navigator.notification.alert('message', null, {toString: function() { return ''; }});`
    
    ### Solution
    
    Rather than testing whether title is falsy to set the default, test whether it is a string, regardless of whether it is a falsy empty string.
    
    ### Breaking change?
    
    Requiring the title to be a string prevents numeric and other values from being used, while previously they were passed through to the native plugin. This is a *good thing* because sending anything other than a string causes the plugin to crash the app (at least on iOS), so despite being more restrictive about the data type, I do not consider it a breaking change.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Newstex/cordova-plugin-dialogs pull-requests/blank-titles

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-dialogs/pull/55.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #55
    
----
commit 03444fcfe204d0576313702b5fe5ac2c6732798d
Author: ipaterson <ip...@newstex.com>
Date:   2015-08-04T19:33:40Z

    Allow a blank string for dialog titles and messages.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-plugin-dialogs pull request: CB-9449 - Allow a blank strin...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-plugin-dialogs/pull/55


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-plugin-dialogs pull request: CB-9449 - Allow a blank strin...

Posted by jcesarmobile <gi...@git.apache.org>.
Github user jcesarmobile commented on the pull request:

    https://github.com/apache/cordova-plugin-dialogs/pull/55#issuecomment-127889230
  
    Tested on iOS, seems good.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-plugin-dialogs pull request: CB-9449 - Allow a blank strin...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on the pull request:

    https://github.com/apache/cordova-plugin-dialogs/pull/55#issuecomment-127771911
  
    good additions here! Thanks


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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