Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-4080 in Sprint 31.
  1. #1
    Sencha User
    Join Date
    Feb 2011
    Location
    Düsseldorf, Germany
    Posts
    246
    Vote Rating
    4
    Kurt001 is on a distinguished road

      0  

    Default Ext.device.notification.PhoneGap broken

    Ext.device.notification.PhoneGap broken


    Hi there,

    the PhoneGap notification is not working, because its broken at several points.

    VERSION
    Sencha Touch 2.1.1

    FILE
    Ext.device.notification.PhoneGap

    REPRODUCTION
    Add anywhere:
    Code:
    Ext.device.Notifcation.show({
        title: 'foo',
        message: 'bar',
        buttons: Ext.MessageBox.OKCANCEL,
        callback: function() {alert('closed')}
    });
    RESULT
    1) button is written as buton
    2) buttons are not shown, as the buttons are passed in the wrong way
    3) callback throws an error, as it tries to make an array to lowercase

    EXPECTED RESULT
    Show a native popup and call the callback fn at the end.

    WORKING CODE
    Code:
        show: function () {
            var config = this.callParent(arguments),
                buttons = (config.buttons),
                onShowCallback = function (index) {
                    if (config.callback) {
                        config.callback.apply(config.scope, (config.buttons) ? [config.buttons[index - 1].itemId.toLowerCase()] : []);
                    }
                };
    
    
            // change Ext.MessageBox buttons into normal arrays
            var ln = buttons.length;
            if (ln && typeof buttons[0] != "string") {
                var newButtons = [],
                    i;
    
    
                for (i = 0; i < ln; i++) {
                    newButtons.push(buttons[i].text);
                }
    
    
                buttons = newButtons.join(',');
            }
    
    
            navigator.notification.confirm(
                config.message, // message
                onShowCallback, // callback
                config.title, // title
                buttons // array of button names
            );
    
    
        }

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,714
    Vote Rating
    438
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

Tags for this Thread