.class public Lcom/helpshift/notification/RequestUnreadMessageCountHandler; .super Ljava/lang/Object; .source "SourceFile" # instance fields .field public final eventProxy:Lcom/helpshift/chat/HSEventProxy; .field public final fetchNotificationUpdate:Lcom/helpshift/poller/FetchNotificationUpdate; .field public final persistentStorage:Lcom/helpshift/storage/HSPersistentStorage; .field public final threadingService:Lcom/helpshift/concurrency/HSThreadingService; .field public final userManager:Lcom/helpshift/user/UserManager; # direct methods .method public constructor (Lcom/helpshift/storage/HSPersistentStorage;Lcom/helpshift/poller/FetchNotificationUpdate;Lcom/helpshift/user/UserManager;Lcom/helpshift/chat/HSEventProxy;Lcom/helpshift/concurrency/HSThreadingService;)V .locals 0 .line 35 invoke-direct {p0}, Ljava/lang/Object;->()V iput-object p1, p0, Lcom/helpshift/notification/RequestUnreadMessageCountHandler;->persistentStorage:Lcom/helpshift/storage/HSPersistentStorage; iput-object p2, p0, Lcom/helpshift/notification/RequestUnreadMessageCountHandler;->fetchNotificationUpdate:Lcom/helpshift/poller/FetchNotificationUpdate; iput-object p3, p0, Lcom/helpshift/notification/RequestUnreadMessageCountHandler;->userManager:Lcom/helpshift/user/UserManager; iput-object p4, p0, Lcom/helpshift/notification/RequestUnreadMessageCountHandler;->eventProxy:Lcom/helpshift/chat/HSEventProxy; iput-object p5, p0, Lcom/helpshift/notification/RequestUnreadMessageCountHandler;->threadingService:Lcom/helpshift/concurrency/HSThreadingService; return-void .end method .method public static synthetic access$000(Lcom/helpshift/notification/RequestUnreadMessageCountHandler;)Lcom/helpshift/poller/FetchNotificationUpdate; .locals 0 .line 18 iget-object p0, p0, Lcom/helpshift/notification/RequestUnreadMessageCountHandler;->fetchNotificationUpdate:Lcom/helpshift/poller/FetchNotificationUpdate; return-object p0 .end method .method public static synthetic access$100(Lcom/helpshift/notification/RequestUnreadMessageCountHandler;)Lcom/helpshift/user/UserManager; .locals 0 .line 18 iget-object p0, p0, Lcom/helpshift/notification/RequestUnreadMessageCountHandler;->userManager:Lcom/helpshift/user/UserManager; return-object p0 .end method .method public static synthetic access$200(Lcom/helpshift/notification/RequestUnreadMessageCountHandler;)Lcom/helpshift/chat/HSEventProxy; .locals 0 .line 18 iget-object p0, p0, Lcom/helpshift/notification/RequestUnreadMessageCountHandler;->eventProxy:Lcom/helpshift/chat/HSEventProxy; return-object p0 .end method # virtual methods .method public handleLocalCacheRequest()V .locals 3 const-string v0, "rqUnrdCntHdlr" const-string v1, "Serving count from local cache." .line 47 invoke-static {v0, v1}, Lcom/helpshift/log/HSLogger;->d(Ljava/lang/String;Ljava/lang/String;)V .line 48 new-instance v0, Ljava/util/HashMap; invoke-direct {v0}, Ljava/util/HashMap;->()V iget-object v1, p0, Lcom/helpshift/notification/RequestUnreadMessageCountHandler;->userManager:Lcom/helpshift/user/UserManager; .line 50 invoke-virtual {v1}, Lcom/helpshift/user/UserManager;->getUnreadNotificationCount()I move-result v1 iget-object v2, p0, Lcom/helpshift/notification/RequestUnreadMessageCountHandler;->userManager:Lcom/helpshift/user/UserManager; invoke-virtual {v2}, Lcom/helpshift/user/UserManager;->getPushUnreadNotificationCount()I move-result v2 invoke-static {v1, v2}, Ljava/lang/Math;->max(II)I move-result v1 const-string v2, "count" .line 51 invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v1 invoke-interface {v0, v2, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; const-string v1, "fromCache" sget-object v2, Ljava/lang/Boolean;->TRUE:Ljava/lang/Boolean; .line 52 invoke-interface {v0, v1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; iget-object v1, p0, Lcom/helpshift/notification/RequestUnreadMessageCountHandler;->eventProxy:Lcom/helpshift/chat/HSEventProxy; const-string v2, "receivedUnreadMessageCount" .line 53 invoke-virtual {v1, v2, v0}, Lcom/helpshift/chat/HSEventProxy;->sendEvent(Ljava/lang/String;Ljava/util/Map;)V return-void .end method .method public handleRemoteRequest()V .locals 7 .line 61 invoke-static {}, Ljava/lang/System;->currentTimeMillis()J move-result-wide v0 iget-object v2, p0, Lcom/helpshift/notification/RequestUnreadMessageCountHandler;->persistentStorage:Lcom/helpshift/storage/HSPersistentStorage; .line 62 invoke-virtual {v2}, Lcom/helpshift/storage/HSPersistentStorage;->getLastRequestUnreadCountApiAccess()J move-result-wide v2 iget-object v4, p0, Lcom/helpshift/notification/RequestUnreadMessageCountHandler;->userManager:Lcom/helpshift/user/UserManager; .line 66 invoke-virtual {v4}, Lcom/helpshift/user/UserManager;->shouldPoll()Z move-result v4 if-eqz v4, :cond_0 const v4, 0xea60 goto :goto_0 :cond_0 const v4, 0x493e0 :goto_0 const-wide/16 v5, 0x0 cmp-long v5, v2, v5 if-eqz v5, :cond_1 sub-long v2, v0, v2 int-to-long v4, v4 cmp-long v2, v2, v4 if-gez v2, :cond_1 .line 71 invoke-virtual {p0}, Lcom/helpshift/notification/RequestUnreadMessageCountHandler;->handleLocalCacheRequest()V return-void :cond_1 iget-object v2, p0, Lcom/helpshift/notification/RequestUnreadMessageCountHandler;->persistentStorage:Lcom/helpshift/storage/HSPersistentStorage; .line 77 invoke-virtual {v2, v0, v1}, Lcom/helpshift/storage/HSPersistentStorage;->setLastRequestUnreadCountApiAccess(J)V const-string v0, "rqUnrdCntHdlr" const-string v1, "Fetching unread count from remote." .line 79 invoke-static {v0, v1}, Lcom/helpshift/log/HSLogger;->d(Ljava/lang/String;Ljava/lang/String;)V iget-object v0, p0, Lcom/helpshift/notification/RequestUnreadMessageCountHandler;->threadingService:Lcom/helpshift/concurrency/HSThreadingService; .line 80 invoke-virtual {v0}, Lcom/helpshift/concurrency/HSThreadingService;->getNetworkService()Lcom/helpshift/concurrency/HSThreader; move-result-object v0 new-instance v1, Lcom/helpshift/notification/RequestUnreadMessageCountHandler$1; invoke-direct {v1, p0}, Lcom/helpshift/notification/RequestUnreadMessageCountHandler$1;->(Lcom/helpshift/notification/RequestUnreadMessageCountHandler;)V invoke-interface {v0, v1}, Lcom/helpshift/concurrency/HSThreader;->submit(Ljava/lang/Runnable;)V return-void .end method