PDA

View Full Version : PhoneGap Notification issue



Kurt001
2 Mar 2013, 3:32 AM
Hi there,
I am using the native notifications inPhoneGap with Ext.device.Notification.
As the native code is broken at several points I wrote an override for this.
Here is the solution:



Ext.define('App.override.device.notification.PhoneGap', {
override: 'Ext.device.notification.PhoneGap',


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()] : []);
}
};
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, onShowCallback, config.title, buttons);
}
});


I hope you find this helpful.

mitchellsimoens
4 Mar 2013, 7:58 AM
Moved to the showcases forum.

Kurt001
4 Mar 2013, 11:01 AM
Moved to the showcases forum.
I did not want to post it there, because if someone has a poblem, Q&A might be the place to search. But I guess you know the hits better than I do.
Thanks:D