DestructionTaskManager.smali
.class public Lio/rong/imlib/destruct/DestructionTaskManager;
.super Ljava/lang/Object;
.source "DestructionTaskManager.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lio/rong/imlib/destruct/DestructionTaskManager$DestructionTaskManagerHolder;
}
.end annotation
# static fields
.field private static final TAG:Ljava/lang/String; = "DestructionTaskManager"
# instance fields
.field private mCountDownTimers:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/String;",
"Lio/rong/imlib/destruct/DestructCountDownTimer;",
">;"
}
.end annotation
.end field
# direct methods
.method private constructor <init>()V
.registers 2
.line 2
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 3
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
iput-object v0, p0, Lio/rong/imlib/destruct/DestructionTaskManager;->mCountDownTimers:Ljava/util/Map;
return-void
.end method
.method synthetic constructor <init>(Lio/rong/imlib/destruct/DestructionTaskManager$1;)V
.registers 2
.line 1
invoke-direct {p0}, Lio/rong/imlib/destruct/DestructionTaskManager;-><init>()V
return-void
.end method
.method static synthetic access$200(Lio/rong/imlib/destruct/DestructionTaskManager;)Ljava/util/Map;
.registers 1
.line 1
iget-object p0, p0, Lio/rong/imlib/destruct/DestructionTaskManager;->mCountDownTimers:Ljava/util/Map;
return-object p0
.end method
.method private cancelCountDown(Ljava/lang/String;)V
.registers 3
.line 1
iget-object v0, p0, Lio/rong/imlib/destruct/DestructionTaskManager;->mCountDownTimers:Ljava/util/Map;
invoke-interface {v0, p1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_1a
.line 2
iget-object v0, p0, Lio/rong/imlib/destruct/DestructionTaskManager;->mCountDownTimers:Ljava/util/Map;
invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lio/rong/imlib/destruct/DestructCountDownTimer;
if-eqz v0, :cond_15
.line 3
invoke-virtual {v0}, Lio/rong/imlib/destruct/DestructCountDownTimer;->cancel()V
.line 4
:cond_15
iget-object v0, p0, Lio/rong/imlib/destruct/DestructionTaskManager;->mCountDownTimers:Ljava/util/Map;
invoke-interface {v0, p1}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;
:cond_1a
return-void
.end method
.method public static getInstance()Lio/rong/imlib/destruct/DestructionTaskManager;
.registers 1
.line 1
# getter for: Lio/rong/imlib/destruct/DestructionTaskManager$DestructionTaskManagerHolder;->instance:Lio/rong/imlib/destruct/DestructionTaskManager;
invoke-static {}, Lio/rong/imlib/destruct/DestructionTaskManager$DestructionTaskManagerHolder;->access$100()Lio/rong/imlib/destruct/DestructionTaskManager;
move-result-object v0
return-object v0
.end method
.method private resetReadTime(Lio/rong/imlib/model/Message;)V
.registers 8
.line 1
invoke-static {}, Lio/rong/imlib/RongIMClient;->getInstance()Lio/rong/imlib/RongIMClient;
move-result-object v0
.line 2
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getMessageId()I
move-result v1
int-to-long v1, v1
const-wide/16 v3, 0x0
const/4 v5, 0x0
invoke-virtual/range {v0 .. v5}, Lio/rong/imlib/RongIMClient;->setMessageReadTime(JJLio/rong/imlib/RongIMClient$OperationCallback;)V
const-wide/16 v0, 0x0
.line 3
invoke-virtual {p1, v0, v1}, Lio/rong/imlib/model/Message;->setReadTime(J)V
return-void
.end method
.method private sendDestructingMsg(Lio/rong/imlib/model/Message;)V
.registers 13
.line 1
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getReadTime()J
move-result-wide v0
const-wide/16 v2, 0x0
cmp-long v4, v0, v2
if-gtz v4, :cond_3e
.line 2
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v0
.line 3
invoke-static {}, Lio/rong/imlib/RongIMClient;->getInstance()Lio/rong/imlib/RongIMClient;
move-result-object v5
.line 4
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getMessageId()I
move-result v2
int-to-long v6, v2
const/4 v10, 0x0
move-wide v8, v0
invoke-virtual/range {v5 .. v10}, Lio/rong/imlib/RongIMClient;->setMessageReadTime(JJLio/rong/imlib/RongIMClient$OperationCallback;)V
.line 5
invoke-virtual {p1, v0, v1}, Lio/rong/imlib/model/Message;->setReadTime(J)V
.line 6
new-instance v0, Lio/rong/message/DestructionCmdMessage;
invoke-direct {v0}, Lio/rong/message/DestructionCmdMessage;-><init>()V
.line 7
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getUId()Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Lio/rong/message/DestructionCmdMessage;->addBurnMessageUId(Ljava/lang/String;)V
.line 8
invoke-static {}, Lio/rong/imlib/destruct/MessageBufferPool;->getInstance()Lio/rong/imlib/destruct/MessageBufferPool;
move-result-object v1
.line 9
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getTargetId()Ljava/lang/String;
move-result-object v2
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getConversationType()Lio/rong/imlib/model/Conversation$ConversationType;
move-result-object p1
invoke-static {v2, p1, v0}, Lio/rong/imlib/model/Message;->obtain(Ljava/lang/String;Lio/rong/imlib/model/Conversation$ConversationType;Lio/rong/imlib/model/MessageContent;)Lio/rong/imlib/model/Message;
move-result-object p1
.line 10
invoke-virtual {v1, p1}, Lio/rong/imlib/destruct/MessageBufferPool;->putMessageInBuffer(Lio/rong/imlib/model/Message;)V
:cond_3e
return-void
.end method
.method private startCountDown(Lio/rong/imlib/model/Message;Lio/rong/imlib/RongIMClient$DestructCountDownTimerListener;)V
.registers 11
.line 1
iget-object v0, p0, Lio/rong/imlib/destruct/DestructionTaskManager;->mCountDownTimers:Ljava/util/Map;
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getUId()Ljava/lang/String;
move-result-object v1
invoke-interface {v0, v1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_19
.line 2
iget-object p2, p0, Lio/rong/imlib/destruct/DestructionTaskManager;->mCountDownTimers:Ljava/util/Map;
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getUId()Ljava/lang/String;
move-result-object p1
invoke-interface {p2, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Lio/rong/imlib/destruct/DestructCountDownTimer;
goto :goto_61
.line 3
:cond_19
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getReadTime()J
move-result-wide v0
const-wide/16 v2, 0x3e8
const-wide/16 v4, 0x0
cmp-long v6, v0, v4
if-gtz v6, :cond_30
.line 4
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getContent()Lio/rong/imlib/model/MessageContent;
move-result-object v0
invoke-virtual {v0}, Lio/rong/imlib/model/MessageContent;->getDestructTime()J
move-result-wide v0
mul-long v0, v0, v2
goto :goto_49
.line 5
:cond_30
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getContent()Lio/rong/imlib/model/MessageContent;
move-result-object v0
invoke-virtual {v0}, Lio/rong/imlib/model/MessageContent;->getDestructTime()J
move-result-wide v0
mul-long v0, v0, v2
.line 6
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v2
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getReadTime()J
move-result-wide v6
sub-long/2addr v2, v6
sub-long/2addr v0, v2
cmp-long v2, v0, v4
if-gtz v2, :cond_49
move-wide v0, v4
.line 7
:cond_49
:goto_49
new-instance v2, Lio/rong/imlib/destruct/DestructCountDownTimer;
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getUId()Ljava/lang/String;
move-result-object v3
new-instance v4, Lio/rong/imlib/destruct/DestructionTaskManager$1;
invoke-direct {v4, p0, p2, p1}, Lio/rong/imlib/destruct/DestructionTaskManager$1;-><init>(Lio/rong/imlib/destruct/DestructionTaskManager;Lio/rong/imlib/RongIMClient$DestructCountDownTimerListener;Lio/rong/imlib/model/Message;)V
invoke-direct {v2, v3, v4, v0, v1}, Lio/rong/imlib/destruct/DestructCountDownTimer;-><init>(Ljava/lang/String;Lio/rong/imlib/RongIMClient$DestructCountDownTimerListener;J)V
.line 8
iget-object p2, p0, Lio/rong/imlib/destruct/DestructionTaskManager;->mCountDownTimers:Ljava/util/Map;
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getUId()Ljava/lang/String;
move-result-object p1
invoke-interface {p2, p1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
move-object p1, v2
.line 9
:goto_61
invoke-virtual {p1}, Lio/rong/imlib/destruct/DestructCountDownTimer;->start()V
return-void
.end method
# virtual methods
.method public BeginDestruct(Lio/rong/imlib/model/Message;Lio/rong/imlib/RongIMClient$DestructCountDownTimerListener;)V
.registers 5
if-eqz p1, :cond_24
.line 1
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getContent()Lio/rong/imlib/model/MessageContent;
move-result-object v0
if-eqz v0, :cond_24
if-nez p2, :cond_b
goto :goto_24
.line 2
:cond_b
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getContent()Lio/rong/imlib/model/MessageContent;
move-result-object v0
invoke-virtual {v0}, Lio/rong/imlib/model/MessageContent;->isDestruct()Z
move-result v0
if-eqz v0, :cond_23
.line 3
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getMessageDirection()Lio/rong/imlib/model/Message$MessageDirection;
move-result-object v0
sget-object v1, Lio/rong/imlib/model/Message$MessageDirection;->RECEIVE:Lio/rong/imlib/model/Message$MessageDirection;
if-ne v0, v1, :cond_23
.line 4
invoke-direct {p0, p1, p2}, Lio/rong/imlib/destruct/DestructionTaskManager;->startCountDown(Lio/rong/imlib/model/Message;Lio/rong/imlib/RongIMClient$DestructCountDownTimerListener;)V
.line 5
invoke-direct {p0, p1}, Lio/rong/imlib/destruct/DestructionTaskManager;->sendDestructingMsg(Lio/rong/imlib/model/Message;)V
:cond_23
return-void
:cond_24
:goto_24
const-string p1, "DestructionTaskManager"
const-string p2, "BeginDestruct pMessage or content or pListener should not be null!"
.line 6
invoke-static {p1, p2}, Lio/rong/common/RLog;->e(Ljava/lang/String;Ljava/lang/String;)I
return-void
.end method
.method public deleteMessage(Lio/rong/imlib/model/Message;)V
.registers 9
if-eqz p1, :cond_27
.line 1
invoke-static {}, Lio/rong/imlib/RongIMClient;->getInstance()Lio/rong/imlib/RongIMClient;
move-result-object v0
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getConversationType()Lio/rong/imlib/model/Conversation$ConversationType;
move-result-object v1
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getTargetId()Ljava/lang/String;
move-result-object v2
const/4 v3, 0x1
new-array v4, v3, [Lio/rong/imlib/model/Message;
const/4 v5, 0x0
aput-object p1, v4, v5
const/4 v6, 0x0
invoke-virtual {v0, v1, v2, v4, v6}, Lio/rong/imlib/RongIMClient;->deleteRemoteMessages(Lio/rong/imlib/model/Conversation$ConversationType;Ljava/lang/String;[Lio/rong/imlib/model/Message;Lio/rong/imlib/RongIMClient$OperationCallback;)V
.line 2
invoke-static {}, Lio/rong/imlib/RongIMClient;->getInstance()Lio/rong/imlib/RongIMClient;
move-result-object v0
new-array v1, v3, [I
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getMessageId()I
move-result p1
aput p1, v1, v5
invoke-virtual {v0, v1, v6}, Lio/rong/imlib/RongIMClient;->deleteMessages([ILio/rong/imlib/RongIMClient$ResultCallback;)V
:cond_27
return-void
.end method
.method public deleteMessages(Lio/rong/imlib/model/Conversation$ConversationType;Ljava/lang/String;[Lio/rong/imlib/model/Message;)V
.registers 7
if-eqz p3, :cond_2e
.line 1
array-length v0, p3
if-lez v0, :cond_2e
if-eqz p1, :cond_2e
if-eqz p2, :cond_2e
.line 2
array-length v0, p3
new-array v0, v0, [I
const/4 v1, 0x0
.line 3
:goto_d
array-length v2, p3
if-ge v1, v2, :cond_1f
.line 4
aget-object v2, p3, v1
if-eqz v2, :cond_1c
.line 5
aget-object v2, p3, v1
invoke-virtual {v2}, Lio/rong/imlib/model/Message;->getMessageId()I
move-result v2
aput v2, v0, v1
:cond_1c
add-int/lit8 v1, v1, 0x1
goto :goto_d
.line 6
:cond_1f
invoke-static {}, Lio/rong/imlib/RongIMClient;->getInstance()Lio/rong/imlib/RongIMClient;
move-result-object v1
const/4 v2, 0x0
invoke-virtual {v1, v0, v2}, Lio/rong/imlib/RongIMClient;->deleteMessages([ILio/rong/imlib/RongIMClient$ResultCallback;)V
.line 7
invoke-static {}, Lio/rong/imlib/RongIMClient;->getInstance()Lio/rong/imlib/RongIMClient;
move-result-object v0
invoke-virtual {v0, p1, p2, p3, v2}, Lio/rong/imlib/RongIMClient;->deleteRemoteMessages(Lio/rong/imlib/model/Conversation$ConversationType;Ljava/lang/String;[Lio/rong/imlib/model/Message;Lio/rong/imlib/RongIMClient$OperationCallback;)V
:cond_2e
return-void
.end method
.method public messageStopDestruct(Lio/rong/imlib/model/Message;)V
.registers 4
if-eqz p1, :cond_26
.line 1
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getContent()Lio/rong/imlib/model/MessageContent;
move-result-object v0
if-nez v0, :cond_9
goto :goto_26
.line 2
:cond_9
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getContent()Lio/rong/imlib/model/MessageContent;
move-result-object v0
invoke-virtual {v0}, Lio/rong/imlib/model/MessageContent;->isDestruct()Z
move-result v0
if-eqz v0, :cond_25
.line 3
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getMessageDirection()Lio/rong/imlib/model/Message$MessageDirection;
move-result-object v0
sget-object v1, Lio/rong/imlib/model/Message$MessageDirection;->RECEIVE:Lio/rong/imlib/model/Message$MessageDirection;
if-ne v0, v1, :cond_25
.line 4
invoke-virtual {p1}, Lio/rong/imlib/model/Message;->getUId()Ljava/lang/String;
move-result-object v0
invoke-direct {p0, v0}, Lio/rong/imlib/destruct/DestructionTaskManager;->cancelCountDown(Ljava/lang/String;)V
.line 5
invoke-direct {p0, p1}, Lio/rong/imlib/destruct/DestructionTaskManager;->resetReadTime(Lio/rong/imlib/model/Message;)V
:cond_25
return-void
:cond_26
:goto_26
const-string p1, "DestructionTaskManager"
const-string v0, "messageStopDestruct pMessage or content should not be null!"
.line 6
invoke-static {p1, v0}, Lio/rong/common/RLog;->e(Ljava/lang/String;Ljava/lang/String;)I
return-void
.end method