From 15731c47c3c321a0e23dfd80aaf1889e9323ba33 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 2 Jan 2019 10:35:35 +0100 Subject: [PATCH] MOBILE-2630 message: Decrease time to check unread messages --- src/addon/messages/providers/mainmenu-handler.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/addon/messages/providers/mainmenu-handler.ts b/src/addon/messages/providers/mainmenu-handler.ts index 36df9b041..170d86082 100644 --- a/src/addon/messages/providers/mainmenu-handler.ts +++ b/src/addon/messages/providers/mainmenu-handler.ts @@ -187,7 +187,13 @@ export class AddonMessagesMainMenuHandler implements CoreMainMenuHandler, CoreCr * @return {number} Time between consecutive executions (in ms). */ getInterval(): number { - return this.appProvider.isDesktop() ? 60000 : 600000; // 1 or 10 minutes. + if (this.appProvider.isDesktop()) { + return 60000; // Desktop usually has a WiFi connection, check it every minute. + } else if (this.messagesProvider.isGroupMessagingEnabled() || this.messagesProvider.isMessageCountEnabled()) { + return 300000; // We have a WS to check the number, check it every 5 minutes. + } else { + return 600000; // Check it every 10 minutes. + } } /**