From 9da2a8f9917691de3fc139d233a2a6b5d1fa56c7 Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Wed, 5 Feb 2014 15:47:27 +0100 Subject: [PATCH] [WO-223] handle imap errors and timeouts specific before and after login screen to avoid jumping bug --- src/js/app-controller.js | 14 +++++++++++++- src/js/controller/navigation.js | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/js/app-controller.js b/src/js/app-controller.js index 40f469c..c0c55b2 100644 --- a/src/js/app-controller.js +++ b/src/js/app-controller.js @@ -120,7 +120,19 @@ define(function(require) { console.log('IMAP error.', err); console.log('IMAP reconnecting...'); // re-init client modules on error - self.onConnect(callback); + self.onConnect(function(err) { + if (!self._initialized) { + callback(err); + return; + } + + if (err) { + console.error('IMAP reconnect failed!', err); + return; + } + + console.log('IMAP reconnect attempt complete.'); + }); }; // connect to clients diff --git a/src/js/controller/navigation.js b/src/js/controller/navigation.js index f0ae27b..1b33ddf 100644 --- a/src/js/controller/navigation.js +++ b/src/js/controller/navigation.js @@ -19,6 +19,9 @@ define(function(require) { // attach global error handler errorUtil.attachHandler($scope); + // app controller is initialized + appController._initialized = true; + emailDao = appController._emailDao; outboxBo = appController._outboxBo;