apkfuckery/com.discord/smali/com/discord/stores/StoreMessageState.smali

561 lines
15 KiB
Smali

.class public final Lcom/discord/stores/StoreMessageState;
.super Ljava/lang/Object;
.source "StoreMessageState.kt"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/discord/stores/StoreMessageState$State;
}
.end annotation
# instance fields
.field private final messageStateSubject:Lrx/subjects/BehaviorSubject;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lrx/subjects/BehaviorSubject<",
"Ljava/util/Map<",
"Ljava/lang/Long;",
"Lcom/discord/stores/StoreMessageState$State;",
">;>;"
}
.end annotation
.end field
.field private final stream:Lcom/discord/stores/StoreStream;
# direct methods
.method public constructor <init>(Lcom/discord/stores/StoreStream;)V
.locals 1
const-string v0, "stream"
invoke-static {p1, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p1, p0, Lcom/discord/stores/StoreMessageState;->stream:Lcom/discord/stores/StoreStream;
invoke-static {}, Lkotlin/a/ab;->emptyMap()Ljava/util/Map;
move-result-object p1
invoke-static {p1}, Lrx/subjects/BehaviorSubject;->bI(Ljava/lang/Object;)Lrx/subjects/BehaviorSubject;
move-result-object p1
const-string v0, "BehaviorSubject.create(emptyMap())"
invoke-static {p1, v0}, Lkotlin/jvm/internal/j;->g(Ljava/lang/Object;Ljava/lang/String;)V
iput-object p1, p0, Lcom/discord/stores/StoreMessageState;->messageStateSubject:Lrx/subjects/BehaviorSubject;
return-void
.end method
.method public static final synthetic access$updateState(Lcom/discord/stores/StoreMessageState;JLkotlin/jvm/functions/Function1;)V
.locals 0
invoke-direct {p0, p1, p2, p3}, Lcom/discord/stores/StoreMessageState;->updateState(JLkotlin/jvm/functions/Function1;)V
return-void
.end method
.method private final resetState(Ljava/util/List;)V
.locals 6
.annotation runtime Lcom/discord/stores/StoreThread;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/List<",
"Ljava/lang/Long;",
">;)V"
}
.end annotation
iget-object v0, p0, Lcom/discord/stores/StoreMessageState;->messageStateSubject:Lrx/subjects/BehaviorSubject;
invoke-virtual {v0}, Lrx/subjects/BehaviorSubject;->getValue()Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/util/Map;
check-cast p1, Ljava/lang/Iterable;
new-instance v1, Ljava/util/ArrayList;
invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V
check-cast v1, Ljava/util/Collection;
invoke-interface {p1}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
move-result-object p1
:cond_0
:goto_0
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
move-result v2
if-eqz v2, :cond_1
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v2
move-object v3, v2
check-cast v3, Ljava/lang/Number;
invoke-virtual {v3}, Ljava/lang/Number;->longValue()J
move-result-wide v3
const-string v5, "messageStateMap"
invoke-static {v0, v5}, Lkotlin/jvm/internal/j;->g(Ljava/lang/Object;Ljava/lang/String;)V
invoke-static {v3, v4}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
move-result-object v3
invoke-interface {v0, v3}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_0
invoke-interface {v1, v2}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z
goto :goto_0
:cond_1
check-cast v1, Ljava/util/List;
invoke-interface {v1}, Ljava/util/List;->isEmpty()Z
move-result p1
if-eqz p1, :cond_2
return-void
:cond_2
iget-object p1, p0, Lcom/discord/stores/StoreMessageState;->messageStateSubject:Lrx/subjects/BehaviorSubject;
const-string v2, "messageStateMap"
invoke-static {v0, v2}, Lkotlin/jvm/internal/j;->g(Ljava/lang/Object;Ljava/lang/String;)V
check-cast v1, Ljava/lang/Iterable;
const-string v2, "receiver$0"
invoke-static {v0, v2}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
const-string v2, "keys"
invoke-static {v1, v2}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
const-string v2, "receiver$0"
invoke-static {v0, v2}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
new-instance v2, Ljava/util/LinkedHashMap;
invoke-direct {v2, v0}, Ljava/util/LinkedHashMap;-><init>(Ljava/util/Map;)V
check-cast v2, Ljava/util/Map;
invoke-interface {v2}, Ljava/util/Map;->keySet()Ljava/util/Set;
move-result-object v0
check-cast v0, Ljava/util/Collection;
const-string v3, "receiver$0"
invoke-static {v0, v3}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
const-string v3, "elements"
invoke-static {v1, v3}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
move-object v3, v0
check-cast v3, Ljava/lang/Iterable;
invoke-static {v1, v3}, Lkotlin/a/l;->a(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Collection;
move-result-object v1
invoke-static {v0}, Lkotlin/jvm/internal/z;->aX(Ljava/lang/Object;)Ljava/util/Collection;
move-result-object v0
invoke-interface {v0, v1}, Ljava/util/Collection;->removeAll(Ljava/util/Collection;)Z
const-string v0, "receiver$0"
invoke-static {v2, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
invoke-interface {v2}, Ljava/util/Map;->size()I
move-result v0
packed-switch v0, :pswitch_data_0
goto :goto_1
:pswitch_0
const-string v0, "receiver$0"
invoke-static {v2, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
invoke-interface {v2}, Ljava/util/Map;->entrySet()Ljava/util/Set;
move-result-object v0
invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object v0
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/util/Map$Entry;
invoke-interface {v0}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
move-result-object v1
invoke-interface {v0}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
move-result-object v0
invoke-static {v1, v0}, Ljava/util/Collections;->singletonMap(Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/Map;
move-result-object v2
const-string v0, "java.util.Collections.singletonMap(key, value)"
invoke-static {v2, v0}, Lkotlin/jvm/internal/j;->g(Ljava/lang/Object;Ljava/lang/String;)V
const-string v0, "with(entries.iterator().\u2026ingletonMap(key, value) }"
invoke-static {v2, v0}, Lkotlin/jvm/internal/j;->g(Ljava/lang/Object;Ljava/lang/String;)V
goto :goto_1
:pswitch_1
invoke-static {}, Lkotlin/a/ab;->emptyMap()Ljava/util/Map;
move-result-object v2
:goto_1
invoke-virtual {p1, v2}, Lrx/subjects/BehaviorSubject;->onNext(Ljava/lang/Object;)V
return-void
:pswitch_data_0
.packed-switch 0x0
:pswitch_1
:pswitch_0
.end packed-switch
.end method
.method private final updateState(JLkotlin/jvm/functions/Function1;)V
.locals 4
.annotation runtime Lcom/discord/stores/StoreThread;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(J",
"Lkotlin/jvm/functions/Function1<",
"-",
"Lcom/discord/stores/StoreMessageState$State;",
"Lcom/discord/stores/StoreMessageState$State;",
">;)V"
}
.end annotation
iget-object v0, p0, Lcom/discord/stores/StoreMessageState;->messageStateSubject:Lrx/subjects/BehaviorSubject;
invoke-virtual {v0}, Lrx/subjects/BehaviorSubject;->getValue()Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/util/Map;
invoke-static {p1, p2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
move-result-object v1
invoke-interface {v0, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
check-cast v1, Lcom/discord/stores/StoreMessageState$State;
if-nez v1, :cond_0
new-instance v1, Lcom/discord/stores/StoreMessageState$State;
const/4 v2, 0x3
const/4 v3, 0x0
invoke-direct {v1, v3, v3, v2, v3}, Lcom/discord/stores/StoreMessageState$State;-><init>(Ljava/util/Set;Ljava/util/Map;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
:cond_0
invoke-interface {p3, v1}, Lkotlin/jvm/functions/Function1;->invoke(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p3
check-cast p3, Lcom/discord/stores/StoreMessageState$State;
iget-object v1, p0, Lcom/discord/stores/StoreMessageState;->messageStateSubject:Lrx/subjects/BehaviorSubject;
const-string v2, "messageStateMap"
invoke-static {v0, v2}, Lkotlin/jvm/internal/j;->g(Ljava/lang/Object;Ljava/lang/String;)V
invoke-static {p1, p2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
move-result-object p1
invoke-static {p1, p3}, Lkotlin/q;->m(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
move-result-object p1
invoke-static {v0, p1}, Lkotlin/a/ab;->a(Ljava/util/Map;Lkotlin/Pair;)Ljava/util/Map;
move-result-object p1
invoke-virtual {v1, p1}, Lrx/subjects/BehaviorSubject;->onNext(Ljava/lang/Object;)V
return-void
.end method
# virtual methods
.method public final getMessageState()Lrx/Observable;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Lrx/Observable<",
"Ljava/util/Map<",
"Ljava/lang/Long;",
"Lcom/discord/stores/StoreMessageState$State;",
">;>;"
}
.end annotation
iget-object v0, p0, Lcom/discord/stores/StoreMessageState;->messageStateSubject:Lrx/subjects/BehaviorSubject;
invoke-virtual {v0}, Lrx/subjects/BehaviorSubject;->Dz()Lrx/Observable;
move-result-object v0
const-string v1, "messageStateSubject.distinctUntilChanged()"
invoke-static {v0, v1}, Lkotlin/jvm/internal/j;->g(Ljava/lang/Object;Ljava/lang/String;)V
return-object v0
.end method
.method public final handleChannelSelected()V
.locals 2
.annotation runtime Lcom/discord/stores/StoreThread;
.end annotation
iget-object v0, p0, Lcom/discord/stores/StoreMessageState;->messageStateSubject:Lrx/subjects/BehaviorSubject;
invoke-static {}, Lkotlin/a/ab;->emptyMap()Ljava/util/Map;
move-result-object v1
invoke-virtual {v0, v1}, Lrx/subjects/BehaviorSubject;->onNext(Ljava/lang/Object;)V
return-void
.end method
.method public final handleMessageDelete(Lcom/discord/models/domain/ModelMessageDelete;)V
.locals 1
.annotation runtime Lcom/discord/stores/StoreThread;
.end annotation
const-string v0, "messageDelete"
invoke-static {p1, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
invoke-virtual {p1}, Lcom/discord/models/domain/ModelMessageDelete;->getMessageIds()Ljava/util/List;
move-result-object p1
const-string v0, "messageDelete.messageIds"
invoke-static {p1, v0}, Lkotlin/jvm/internal/j;->g(Ljava/lang/Object;Ljava/lang/String;)V
invoke-direct {p0, p1}, Lcom/discord/stores/StoreMessageState;->resetState(Ljava/util/List;)V
return-void
.end method
.method public final handleMessageUpdate(Ljava/util/List;)V
.locals 3
.annotation runtime Lcom/discord/stores/StoreThread;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/List<",
"+",
"Lcom/discord/models/domain/ModelMessage;",
">;)V"
}
.end annotation
const-string v0, "messagesList"
invoke-static {p1, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
check-cast p1, Ljava/lang/Iterable;
new-instance v0, Ljava/util/ArrayList;
const/16 v1, 0xa
invoke-static {p1, v1}, Lkotlin/a/l;->a(Ljava/lang/Iterable;I)I
move-result v1
invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(I)V
check-cast v0, Ljava/util/Collection;
invoke-interface {p1}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
move-result-object p1
:goto_0
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_0
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Lcom/discord/models/domain/ModelMessage;
invoke-virtual {v1}, Lcom/discord/models/domain/ModelMessage;->getId()J
move-result-wide v1
invoke-static {v1, v2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
move-result-object v1
invoke-interface {v0, v1}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z
goto :goto_0
:cond_0
check-cast v0, Ljava/util/List;
invoke-direct {p0, v0}, Lcom/discord/stores/StoreMessageState;->resetState(Ljava/util/List;)V
return-void
.end method
.method public final revealSpoiler(JI)V
.locals 2
if-gez p3, :cond_0
return-void
:cond_0
iget-object v0, p0, Lcom/discord/stores/StoreMessageState;->stream:Lcom/discord/stores/StoreStream;
new-instance v1, Lcom/discord/stores/StoreMessageState$revealSpoiler$1;
invoke-direct {v1, p0, p1, p2, p3}, Lcom/discord/stores/StoreMessageState$revealSpoiler$1;-><init>(Lcom/discord/stores/StoreMessageState;JI)V
check-cast v1, Lrx/functions/Action0;
invoke-virtual {v0, v1}, Lcom/discord/stores/StoreStream;->schedule(Lrx/functions/Action0;)V
return-void
.end method
.method public final revealSpoilerEmbed(JI)V
.locals 2
if-gez p3, :cond_0
return-void
:cond_0
iget-object v0, p0, Lcom/discord/stores/StoreMessageState;->stream:Lcom/discord/stores/StoreStream;
new-instance v1, Lcom/discord/stores/StoreMessageState$revealSpoilerEmbed$1;
invoke-direct {v1, p0, p1, p2, p3}, Lcom/discord/stores/StoreMessageState$revealSpoilerEmbed$1;-><init>(Lcom/discord/stores/StoreMessageState;JI)V
check-cast v1, Lrx/functions/Action0;
invoke-virtual {v0, v1}, Lcom/discord/stores/StoreStream;->schedule(Lrx/functions/Action0;)V
return-void
.end method
.method public final revealSpoilerEmbedData(JILjava/lang/String;)V
.locals 8
const-string v0, "key"
invoke-static {p4, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
if-gez p3, :cond_0
return-void
:cond_0
iget-object v0, p0, Lcom/discord/stores/StoreMessageState;->stream:Lcom/discord/stores/StoreStream;
new-instance v7, Lcom/discord/stores/StoreMessageState$revealSpoilerEmbedData$1;
move-object v1, v7
move-object v2, p0
move-wide v3, p1
move v5, p3
move-object v6, p4
invoke-direct/range {v1 .. v6}, Lcom/discord/stores/StoreMessageState$revealSpoilerEmbedData$1;-><init>(Lcom/discord/stores/StoreMessageState;JILjava/lang/String;)V
check-cast v7, Lrx/functions/Action0;
invoke-virtual {v0, v7}, Lcom/discord/stores/StoreStream;->schedule(Lrx/functions/Action0;)V
return-void
.end method