[
https://issues.apache.org/jira/browse/RIPPLE-85?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tim Barham closed RIPPLE-85.
----------------------------
Resolution: Fixed
> notifications: button index is incremented twice
> ------------------------------------------------
>
> Key: RIPPLE-85
> URL: https://issues.apache.org/jira/browse/RIPPLE-85
> Project: Apache Ripple
> Issue Type: Bug
> Reporter: Arzhan Kinzhalin
>
> [notifications.js:92|https://github.com/apache/incubator-ripple/blob/master/lib/client/notifications.js#L92]
> {code:title=lib/client/notifications.js}
> btnArray.forEach(function(btnLabel,index) {
> var button = {};
> button["text"] = btnLabel;
> button["click"] = function () {
> if(resultCallback !== typeof "undefined")
> resultCallback(index+1);
> jQuery( this ).dialog( "close" );
> };
> buttons.push(button);
> });
> {code}
> [lib/client/platform/cordova/2.0.0/bridge/notification.js:43|https://github.com/apache/incubator-ripple/blob/master/lib/client/platform/cordova/2.0.0/bridge/notification.js#L43]
> {code:title=lib/client/platform/cordova/2.0.0/bridge/notification.js}
> var callback = resultCallback && function(r) {
> resultCallback(++r);
> };
> notifications.confirmNotification(message, callback, title,
> buttonLabels);
> },
> {code}
> The latter calls the former and in both cases the index is adjusted to be
> 1-based instead of 0-based.
> Also, the check {{if(resultCallback !== typeof "undefined")}} does not make
> any sense: it ensures {{resultCallback}} is not a string {{"string"}}. Should
> be just {{typeof resultCalback !== "undefined"}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)