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 @@ ...@@ -403,8 +403,9 @@
converse.connection.reconnecting = true; converse.connection.reconnecting = true;
converse.connection.disconnect('re-connecting'); converse.connection.disconnect('re-connecting');
converse.connection.reset(); converse.connection.reset();
converse.log('Attempting to reconnect'); converse.log('The connection has dropped, attempting to reconnect.');
converse.giveFeedback(__('Attempting to reconnect'), 'error'); converse.giveFeedback(
__('The connection has dropped, attempting to reconnect.'), 'warn');
converse.clearSession(); converse.clearSession();
converse._tearDown(); converse._tearDown();
if (converse.authentication !== "prebind") { if (converse.authentication !== "prebind") {
......
...@@ -194,8 +194,16 @@ ...@@ -194,8 +194,16 @@
setTimeout(n.close.bind(n), 5000); setTimeout(n.close.bind(n), 5000);
}; };
converse.showErrorNotification = function (data) { converse.showFeedbackNotification = function (data) {
var n = new Notification(__('An error has occured'), { 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, body: data.message,
lang: converse.i18n.locale_data.converse[""].lang, lang: converse.i18n.locale_data.converse[""].lang,
icon: 'logo/conversejs.png' icon: 'logo/conversejs.png'
...@@ -234,8 +242,8 @@ ...@@ -234,8 +242,8 @@
}; };
converse.handleFeedback = function (evt, data) { converse.handleFeedback = function (evt, data) {
if (data.klass === 'error' && converse.areDesktopNotificationsEnabled(true)) { if (converse.areDesktopNotificationsEnabled(true)) {
converse.showErrorNotification(data); 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