.class public final Lcom/discord/utilities/textprocessing/MessagePreprocessor; .super Ljava/lang/Object; .source "MessagePreprocessor.kt" # interfaces .implements Lf/a/j/a/c/a; # annotations .annotation system Ldalvik/annotation/MemberClasses; value = { Lcom/discord/utilities/textprocessing/MessagePreprocessor$Companion; } .end annotation # static fields .field public static final Companion:Lcom/discord/utilities/textprocessing/MessagePreprocessor$Companion; .field public static final MAX_JUMBO_EMOJI_COUNT:I = 0x5 # instance fields .field public customEmojiCount:I .field public final embeds:Ljava/util/List; .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/List<", "Lcom/discord/models/domain/ModelMessageEmbed;", ">;" } .end annotation .end field .field public hasLinkConflictingNode:Z .field public isFoundSelfMention:Z .field public final myUserId:J .field public shouldJumboify:Z .field public spoilers:Ljava/util/List; .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/List<", "Lcom/discord/utilities/textprocessing/node/SpoilerNode<", "*>;>;" } .end annotation .end field .field public final visibleSpoilerNodeIndices:Ljava/util/Collection; .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/Collection<", "Ljava/lang/Integer;", ">;" } .end annotation .end field # direct methods .method public static constructor ()V .locals 2 new-instance v0, Lcom/discord/utilities/textprocessing/MessagePreprocessor$Companion; const/4 v1, 0x0 invoke-direct {v0, v1}, Lcom/discord/utilities/textprocessing/MessagePreprocessor$Companion;->(Lkotlin/jvm/internal/DefaultConstructorMarker;)V sput-object v0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->Companion:Lcom/discord/utilities/textprocessing/MessagePreprocessor$Companion; return-void .end method .method public constructor (JLcom/discord/stores/StoreMessageState$State;)V .locals 1 const/4 v0, 0x0 if-eqz p3, :cond_0 invoke-virtual {p3}, Lcom/discord/stores/StoreMessageState$State;->getVisibleSpoilerNodeIndices()Ljava/util/Set; move-result-object p3 goto :goto_0 :cond_0 move-object p3, v0 :goto_0 invoke-direct {p0, p1, p2, p3, v0}, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->(JLjava/util/Collection;Ljava/util/List;)V return-void .end method .method public constructor (JLcom/discord/stores/StoreMessageState$State;Ljava/util/List;)V .locals 0 .annotation system Ldalvik/annotation/Signature; value = { "(J", "Lcom/discord/stores/StoreMessageState$State;", "Ljava/util/List<", "+", "Lcom/discord/models/domain/ModelMessageEmbed;", ">;)V" } .end annotation if-eqz p3, :cond_0 invoke-virtual {p3}, Lcom/discord/stores/StoreMessageState$State;->getVisibleSpoilerNodeIndices()Ljava/util/Set; move-result-object p3 goto :goto_0 :cond_0 const/4 p3, 0x0 :goto_0 invoke-direct {p0, p1, p2, p3, p4}, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->(JLjava/util/Collection;Ljava/util/List;)V return-void .end method .method public constructor (JLjava/util/Collection;Ljava/util/List;)V .locals 0 .annotation system Ldalvik/annotation/Signature; value = { "(J", "Ljava/util/Collection<", "Ljava/lang/Integer;", ">;", "Ljava/util/List<", "+", "Lcom/discord/models/domain/ModelMessageEmbed;", ">;)V" } .end annotation invoke-direct {p0}, Ljava/lang/Object;->()V iput-wide p1, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->myUserId:J iput-object p3, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->visibleSpoilerNodeIndices:Ljava/util/Collection; iput-object p4, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->embeds:Ljava/util/List; const/4 p1, 0x1 iput-boolean p1, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->shouldJumboify:Z return-void .end method .method public synthetic constructor (JLjava/util/Collection;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V .locals 1 and-int/lit8 p6, p5, 0x2 const/4 v0, 0x0 if-eqz p6, :cond_0 move-object p3, v0 :cond_0 and-int/lit8 p5, p5, 0x4 if-eqz p5, :cond_1 move-object p4, v0 :cond_1 invoke-direct {p0, p1, p2, p3, p4}, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->(JLjava/util/Collection;Ljava/util/List;)V return-void .end method .method public static final synthetic access$mergeConsecutiveQuoteNodes(Lcom/discord/utilities/textprocessing/MessagePreprocessor;Ljava/util/Collection;)V .locals 0 invoke-direct {p0, p1}, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->mergeConsecutiveQuoteNodes(Ljava/util/Collection;)V return-void .end method .method private final mergeConsecutiveQuoteNodes(Ljava/util/Collection;)V .locals 6 .annotation system Ldalvik/annotation/Signature; value = { "(", "Ljava/util/Collection<", "Lcom/discord/simpleast/core/node/Node<", "TR;>;>;)V" } .end annotation new-instance v0, Ljava/util/ArrayList; invoke-direct {v0}, Ljava/util/ArrayList;->()V invoke-interface {p1}, Ljava/util/Collection;->iterator()Ljava/util/Iterator; move-result-object v1 const/4 v2, 0x0 :goto_0 move-object v3, v2 :cond_0 :goto_1 invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z move-result v4 if-eqz v4, :cond_3 invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v4 check-cast v4, Lcom/discord/simpleast/core/node/Node; instance-of v5, v4, Lcom/discord/utilities/textprocessing/node/BlockQuoteNode; if-nez v5, :cond_1 goto :goto_0 :cond_1 if-nez v3, :cond_2 move-object v3, v4 check-cast v3, Lcom/discord/utilities/textprocessing/node/BlockQuoteNode; goto :goto_1 :cond_2 invoke-interface {v0, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z invoke-virtual {v4}, Lcom/discord/simpleast/core/node/Node;->getChildren()Ljava/util/Collection; move-result-object v4 if-eqz v4, :cond_0 invoke-interface {v4}, Ljava/util/Collection;->iterator()Ljava/util/Iterator; move-result-object v4 :goto_2 invoke-interface {v4}, Ljava/util/Iterator;->hasNext()Z move-result v5 if-eqz v5, :cond_0 invoke-interface {v4}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v5 check-cast v5, Lcom/discord/simpleast/core/node/Node; invoke-virtual {v3, v5}, Lcom/discord/simpleast/core/node/Node;->addChild(Lcom/discord/simpleast/core/node/Node;)V goto :goto_2 :cond_3 invoke-interface {p1, v0}, Ljava/util/Collection;->removeAll(Ljava/util/Collection;)Z return-void .end method .method private final processQuoteChildren(Ljava/util/Collection;)V .locals 2 .annotation system Ldalvik/annotation/Signature; value = { "(", "Ljava/util/Collection<", "+", "Lcom/discord/simpleast/core/node/Node<", "TR;>;>;)V" } .end annotation if-eqz p1, :cond_1 invoke-static {p1}, Lj0/n/c/u;->asMutableCollection(Ljava/lang/Object;)Ljava/util/Collection; move-result-object v0 invoke-direct {p0, v0}, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->mergeConsecutiveQuoteNodes(Ljava/util/Collection;)V new-instance v0, Lcom/discord/utilities/textprocessing/MessagePreprocessor$processQuoteChildren$1; invoke-direct {v0, p0}, Lcom/discord/utilities/textprocessing/MessagePreprocessor$processQuoteChildren$1;->(Lcom/discord/utilities/textprocessing/MessagePreprocessor;)V invoke-interface {p1}, Ljava/util/Collection;->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/simpleast/core/node/Node; invoke-static {v1, v0}, Ld0/a/b/b/a;->Z0(Lcom/discord/simpleast/core/node/Node;Lf/a/j/a/c/a;)V goto :goto_0 :cond_0 return-void :cond_1 new-instance p1, Lkotlin/TypeCastException; const-string v0, "null cannot be cast to non-null type kotlin.collections.MutableCollection>" invoke-direct {p1, v0}, Lkotlin/TypeCastException;->(Ljava/lang/String;)V throw p1 .end method .method private final processSpoilerChildren()V .locals 5 iget-object v0, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->spoilers:Ljava/util/List; const/4 v1, 0x1 if-eqz v0, :cond_1 invoke-interface {v0}, Ljava/util/Collection;->isEmpty()Z move-result v2 if-eqz v2, :cond_0 goto :goto_0 :cond_0 const/4 v2, 0x0 goto :goto_1 :cond_1 :goto_0 const/4 v2, 0x1 :goto_1 xor-int/2addr v2, v1 if-eqz v2, :cond_2 goto :goto_2 :cond_2 const/4 v0, 0x0 :goto_2 if-eqz v0, :cond_5 new-instance v2, Ljava/util/ArrayList; invoke-direct {v2}, Ljava/util/ArrayList;->()V invoke-interface {v0}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator; move-result-object v0 :cond_3 :goto_3 invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z move-result v3 if-eqz v3, :cond_4 invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v3 move-object v4, v3 check-cast v4, Lcom/discord/utilities/textprocessing/node/SpoilerNode; invoke-virtual {v4}, Lcom/discord/utilities/textprocessing/node/SpoilerNode;->isRevealed()Z move-result v4 xor-int/2addr v4, v1 if-eqz v4, :cond_3 invoke-interface {v2, v3}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z goto :goto_3 :cond_4 invoke-interface {v2}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator; move-result-object v0 :goto_4 invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z move-result v1 if-eqz v1, :cond_5 invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v1 check-cast v1, Lcom/discord/utilities/textprocessing/node/SpoilerNode; invoke-virtual {v1}, Lcom/discord/simpleast/core/node/Node;->getChildren()Ljava/util/Collection; move-result-object v1 sget-object v2, Lcom/discord/utilities/textprocessing/MessagePreprocessor$processSpoilerChildren$3$1;->INSTANCE:Lcom/discord/utilities/textprocessing/MessagePreprocessor$processSpoilerChildren$3$1; invoke-static {v1, v2}, Ld0/a/b/b/a;->X0(Ljava/util/Collection;Lf/a/j/a/c/a;)V goto :goto_4 :cond_5 return-void .end method .method private final stripSimpleEmbedLink(Ljava/util/Collection;)V .locals 3 .annotation system Ldalvik/annotation/Signature; value = { "(", "Ljava/util/Collection<", "Lcom/discord/simpleast/core/node/Node<", "Lcom/discord/utilities/textprocessing/MessageRenderContext;", ">;>;)V" } .end annotation invoke-interface {p1}, Ljava/util/Collection;->size()I move-result v0 const/4 v1, 0x1 if-ne v0, v1, :cond_2 iget-object v0, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->embeds:Ljava/util/List; if-eqz v0, :cond_2 invoke-interface {v0}, Ljava/util/List;->size()I move-result v0 if-eq v0, v1, :cond_0 goto :goto_0 :cond_0 const/4 v0, 0x0 invoke-static {p1, v0}, Lj0/i/l;->elementAt(Ljava/lang/Iterable;I)Ljava/lang/Object; move-result-object v1 check-cast v1, Lcom/discord/simpleast/core/node/Node; iget-object v2, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->embeds:Ljava/util/List; invoke-interface {v2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object; move-result-object v0 check-cast v0, Lcom/discord/models/domain/ModelMessageEmbed; instance-of v1, v1, Lcom/discord/utilities/textprocessing/node/UrlNode; if-nez v1, :cond_1 return-void :cond_1 invoke-virtual {v0}, Lcom/discord/models/domain/ModelMessageEmbed;->isSimpleEmbed()Z move-result v0 if-eqz v0, :cond_2 invoke-interface {p1}, Ljava/util/Collection;->clear()V :cond_2 :goto_0 return-void .end method # virtual methods .method public final getMyUserId()J .locals 2 iget-wide v0, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->myUserId:J return-wide v0 .end method .method public final getSpoilers()Ljava/util/List; .locals 1 .annotation system Ldalvik/annotation/Signature; value = { "()", "Ljava/util/List<", "Lcom/discord/utilities/textprocessing/node/SpoilerNode<", "*>;>;" } .end annotation iget-object v0, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->spoilers:Ljava/util/List; return-object v0 .end method .method public final isFoundSelfMention()Z .locals 1 iget-boolean v0, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->isFoundSelfMention:Z return v0 .end method .method public final isLinkifyConflicting()Z .locals 3 iget-boolean v0, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->hasLinkConflictingNode:Z const/4 v1, 0x0 const/4 v2, 0x1 if-nez v0, :cond_2 iget-object v0, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->spoilers:Ljava/util/List; if-eqz v0, :cond_1 invoke-interface {v0}, Ljava/util/Collection;->isEmpty()Z move-result v0 if-eqz v0, :cond_0 goto :goto_0 :cond_0 const/4 v0, 0x0 goto :goto_1 :cond_1 :goto_0 const/4 v0, 0x1 :goto_1 if-nez v0, :cond_3 :cond_2 const/4 v1, 0x1 :cond_3 return v1 .end method .method public final process(Ljava/util/Collection;)V .locals 1 .annotation system Ldalvik/annotation/Signature; value = { "(", "Ljava/util/Collection<", "+", "Lcom/discord/simpleast/core/node/Node<", "TR;>;>;)V" } .end annotation if-eqz p1, :cond_1 invoke-static {p1}, Lj0/n/c/u;->asMutableCollection(Ljava/lang/Object;)Ljava/util/Collection; move-result-object v0 invoke-direct {p0, v0}, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->stripSimpleEmbedLink(Ljava/util/Collection;)V invoke-static {p1, p0}, Ld0/a/b/b/a;->X0(Ljava/util/Collection;Lf/a/j/a/c/a;)V iget-boolean v0, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->shouldJumboify:Z if-eqz v0, :cond_0 sget-object v0, Lcom/discord/utilities/textprocessing/MessagePreprocessor$process$1;->INSTANCE:Lcom/discord/utilities/textprocessing/MessagePreprocessor$process$1; invoke-static {p1, v0}, Ld0/a/b/b/a;->X0(Ljava/util/Collection;Lf/a/j/a/c/a;)V :cond_0 invoke-direct {p0}, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->processSpoilerChildren()V invoke-direct {p0, p1}, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->processQuoteChildren(Ljava/util/Collection;)V return-void :cond_1 const-string p1, "ast" invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V const/4 p1, 0x0 throw p1 .end method .method public processNode(Lcom/discord/simpleast/core/node/Node;)V .locals 5 .annotation system Ldalvik/annotation/Signature; value = { "(", "Lcom/discord/simpleast/core/node/Node<", "*>;)V" } .end annotation if-eqz p1, :cond_a iget-boolean v0, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->shouldJumboify:Z const/4 v1, 0x0 const/4 v2, 0x1 if-eqz v0, :cond_3 instance-of v0, p1, Lcom/discord/utilities/textprocessing/node/EmojiNode; if-eqz v0, :cond_1 iget v0, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->customEmojiCount:I add-int/2addr v0, v2 iput v0, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->customEmojiCount:I const/4 v3, 0x5 if-gt v0, v3, :cond_0 goto :goto_0 :cond_0 const/4 v0, 0x0 goto :goto_1 :cond_1 instance-of v0, p1, Lcom/discord/simpleast/core/node/StyleNode; if-eqz v0, :cond_2 :goto_0 const/4 v0, 0x1 goto :goto_1 :cond_2 instance-of v0, p1, Lf/a/j/a/a/a; if-eqz v0, :cond_0 move-object v0, p1 check-cast v0, Lf/a/j/a/a/a; invoke-virtual {v0}, Lf/a/j/a/a/a;->getContent()Ljava/lang/String; move-result-object v0 invoke-static {v0}, Lj0/t/k;->isBlank(Ljava/lang/CharSequence;)Z move-result v0 :goto_1 if-eqz v0, :cond_3 const/4 v0, 0x1 goto :goto_2 :cond_3 const/4 v0, 0x0 :goto_2 iput-boolean v0, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->shouldJumboify:Z instance-of v0, p1, Lcom/discord/utilities/textprocessing/node/CodeNode; if-eqz v0, :cond_4 iput-boolean v2, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->hasLinkConflictingNode:Z goto :goto_4 :cond_4 instance-of v0, p1, Lcom/discord/utilities/textprocessing/node/UrlNode; if-eqz v0, :cond_5 iput-boolean v2, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->hasLinkConflictingNode:Z goto :goto_4 :cond_5 instance-of v0, p1, Lcom/discord/utilities/textprocessing/node/UserMentionNode; if-eqz v0, :cond_6 check-cast p1, Lcom/discord/utilities/textprocessing/node/UserMentionNode; invoke-virtual {p1}, Lcom/discord/utilities/textprocessing/node/UserMentionNode;->getUserId()J move-result-wide v0 iget-wide v3, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->myUserId:J cmp-long p1, v0, v3 if-nez p1, :cond_9 iput-boolean v2, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->isFoundSelfMention:Z goto :goto_4 :cond_6 instance-of v0, p1, Lcom/discord/utilities/textprocessing/node/SpoilerNode; if-eqz v0, :cond_9 iget-object v0, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->spoilers:Ljava/util/List; if-eqz v0, :cond_7 goto :goto_3 :cond_7 new-instance v0, Ljava/util/ArrayList; invoke-direct {v0}, Ljava/util/ArrayList;->()V iput-object v0, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->spoilers:Ljava/util/List; :goto_3 invoke-interface {v0}, Ljava/util/List;->size()I move-result v2 invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z iget-object v0, p0, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->visibleSpoilerNodeIndices:Ljava/util/Collection; if-eqz v0, :cond_8 invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v1 invoke-interface {v0, v1}, Ljava/util/Collection;->contains(Ljava/lang/Object;)Z move-result v1 :cond_8 check-cast p1, Lcom/discord/utilities/textprocessing/node/SpoilerNode; invoke-virtual {p1, v2, v1}, Lcom/discord/utilities/textprocessing/node/SpoilerNode;->updateState(IZ)V :cond_9 :goto_4 return-void :cond_a const-string p1, "node" invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V const/4 p1, 0x0 throw p1 .end method