Commit 814845e8 authored by JC Brand's avatar JC Brand

Provide a nicer notification when reconnecting

after a dropped connection.
parent b0de7948
......@@ -403,8 +403,9 @@
converse.connection.reconnecting = true;
converse.connection.disconnect('re-connecting');
converse.connection.reset();
converse.log('Attempting to reconnect');
converse.giveFeedback(__('Attempting to reconnect'), 'error');
converse.log('The connection has dropped, attempting to reconnect.');
converse.giveFeedback(
__('The connection has dropped, attempting to reconnect.'), 'warn');
converse.clearSession();
converse._tearDown();
if (converse.authentication !== "prebind") {
......
......@@ -194,8 +194,16 @@
setTimeout(n.close.bind(n), 5000);
};
converse.showErrorNotification = function (data) {
var n = new Notification(__('An error has occured'), {
converse.showFeedbackNotification = function (data) {
var subject;
if (data.klass === 'error') {
subject = __('An error has occured');
} else if (data.klass === 'warn') {
subject = __('Please be aware');
} else {
return;
}
var n = new Notification(subject, {
body: data.message,
lang: converse.i18n.locale_data.converse[""].lang,
icon: 'logo/conversejs.png'
......@@ -234,8 +242,8 @@
};
converse.handleFeedback = function (evt, data) {
if (data.klass === 'error' && converse.areDesktopNotificationsEnabled(true)) {
converse.showErrorNotification(data);
if (converse.areDesktopNotificationsEnabled(true)) {
converse.showFeedbackNotification(data);
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment