ripple-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "lmnbeyond (JIRA)" <j...@apache.org>
Subject [jira] [Created] (RIPPLE-47) navigator.notification.confirm can't get correct index of button pressed
Date Thu, 14 Nov 2013 09:51:28 GMT
lmnbeyond created RIPPLE-47:
-------------------------------

             Summary: navigator.notification.confirm can't get correct index of button pressed
                 Key: RIPPLE-47
                 URL: https://issues.apache.org/jira/browse/RIPPLE-47
             Project: Apache Ripple
          Issue Type: Bug
         Environment: Ripple: 0.9.19
Platform: Apache Cordova 3.0.0
            Reporter: lmnbeyond
            Priority: Minor


Steps to reproduce it:

1. Use 'ripple emulate' to start cordova mobile spec tests
2. Select 'Apache Cordova 3.0.0'
3. Run Notification->Confirm Dialog, which will invoke the following method:
navigator.notification.confirm('You pressed confirm',
            function(r) {
                console.log("You selected " + r);
                alert("You selected " + (buttons.split(","))[r-1]);
            },
            'Confirm Dialog',
            'Yes,No,Maybe');

Results:
Console window outputs:
TypeError: Object [object Array] has no method 'split'
    at _processConfirm 
    at Object.module.exports.confirmNotification 

After I referred to the confirm method which is defined in org.apache.cordova.dialogs/www/notification.js,
I found that the buttonLabels may already be splitted:

if (platform.id == "android" || platform.id == "ios" || platform.id == "windowsphone" || platform.id
== "firefoxos") {
            if (typeof _buttonLabels === 'string') {
                var buttonLabelString = _buttonLabels;
                _buttonLabels = _buttonLabels.split(","); // not crazy about changing the
var type here
            }
        } else {
            if (Array.isArray(_buttonLabels)) {
                var buttonLabelArray = _buttonLabels;
                _buttonLabels = buttonLabelArray.toString();
            }
        }

I added a quick workaround for it, then the confirm dialog can be showed up. But I found another
issue: the  returned index of button pressed is 0, 1, 2, which is different from Cordova definition:

confirmCallback: Callback to invoke with index of button pressed (1, 2, or 3) or when the
dialog is dismissed without a button press (0). (Function)





--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message