[ 
https://issues.apache.org/jira/browse/CB-12248?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

jcesarmobile updated CB-12248:
------------------------------
    Labels:   (was: ios)

> navigator.notification.confirm callback doesn't return an index but a boolean
> -----------------------------------------------------------------------------
>
>                 Key: CB-12248
>                 URL: https://issues.apache.org/jira/browse/CB-12248
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Dialogs
>    Affects Versions: [email protected]
>         Environment: OS: Ubuntu_16_LTS x86_64,  Kernel Version: 
> 4.4.0-31-generic, Browser: Google Chrome 54.0.2840.71 (stable), Framework: 
> MobileFirst 8
>            Reporter: Alessandro Pasi
>            Assignee: jcesarmobile
>            Priority: Minor
>
> Since the buttonIndex should return an integer, the following code should be 
> working but the default case is always fired:
> {code:javascript}
>     navigator.notification.confirm("Description",
>         function (buttonIndex) {
>             switch(buttonIndex){
>                 case:1
>                     //do something
>                     break;
>                 default:
>                     //do something
>             }
>         }
>     }, "Title", ["OK", "Cancel"]);
> {code}
> A little inspection reveal that the confirm method is returning a boolean 
> instead of a number. The following code is working:
> {code:javascript}
>     navigator.notification.confirm("Description",
>         function (buttonIndex) {
>             if(buttonIndex){
>                 //do something
>             }else{
>                 //do something
>             }
>         }
>     }, "Title", ["OK", "Cancel"]);
> {code}
> The documentation states "The callback takes the argument buttonIndex 
> (Number), which is the index of the pressed button. Note that the index uses 
> one-based indexing, so the value is 1, 2, 3, etc." and it should be changed 
> accordingly.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to