151 lines
5.2 KiB
Smali
151 lines
5.2 KiB
Smali
.class public final Lcom/discord/utilities/textprocessing/DiscordParser;
|
|
.super Ljava/lang/Object;
|
|
.source "DiscordParser.kt"
|
|
|
|
|
|
# static fields
|
|
.field public static final INSTANCE:Lcom/discord/utilities/textprocessing/DiscordParser;
|
|
|
|
.field public static final MASKED_LINK_PARSER:Lcom/discord/simpleast/core/parser/Parser;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Lcom/discord/simpleast/core/parser/Parser<",
|
|
"Lcom/discord/utilities/textprocessing/MessageRenderContext;",
|
|
"Lcom/discord/simpleast/core/node/Node<",
|
|
"Lcom/discord/utilities/textprocessing/MessageRenderContext;",
|
|
">;",
|
|
"Lcom/discord/utilities/textprocessing/MessageParseState;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field public static final SAFE_LINK_PARSER:Lcom/discord/simpleast/core/parser/Parser;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Lcom/discord/simpleast/core/parser/Parser<",
|
|
"Lcom/discord/utilities/textprocessing/MessageRenderContext;",
|
|
"Lcom/discord/simpleast/core/node/Node<",
|
|
"Lcom/discord/utilities/textprocessing/MessageRenderContext;",
|
|
">;",
|
|
"Lcom/discord/utilities/textprocessing/MessageParseState;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 2
|
|
|
|
new-instance v0, Lcom/discord/utilities/textprocessing/DiscordParser;
|
|
|
|
invoke-direct {v0}, Lcom/discord/utilities/textprocessing/DiscordParser;-><init>()V
|
|
|
|
sput-object v0, Lcom/discord/utilities/textprocessing/DiscordParser;->INSTANCE:Lcom/discord/utilities/textprocessing/DiscordParser;
|
|
|
|
const/4 v0, 0x0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
invoke-static {v0, v1}, Lcom/discord/utilities/textprocessing/Parsers;->createParser(ZZ)Lcom/discord/simpleast/core/parser/Parser;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lcom/discord/utilities/textprocessing/DiscordParser;->SAFE_LINK_PARSER:Lcom/discord/simpleast/core/parser/Parser;
|
|
|
|
invoke-static {v1, v1}, Lcom/discord/utilities/textprocessing/Parsers;->createParser(ZZ)Lcom/discord/simpleast/core/parser/Parser;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lcom/discord/utilities/textprocessing/DiscordParser;->MASKED_LINK_PARSER:Lcom/discord/simpleast/core/parser/Parser;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static final parseChannelMessage(Landroid/content/Context;Ljava/lang/String;Lcom/discord/utilities/textprocessing/MessageRenderContext;Lcom/discord/utilities/textprocessing/MessagePreprocessor;ZZ)Lcom/facebook/drawee/span/DraweeSpanStringBuilder;
|
|
.locals 6
|
|
|
|
const-string v0, "context"
|
|
|
|
invoke-static {p0, v0}, Lz/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "messageRenderContext"
|
|
|
|
invoke-static {p2, v0}, Lz/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "preprocessor"
|
|
|
|
invoke-static {p3, v0}, Lz/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
if-eqz p4, :cond_0
|
|
|
|
sget-object p4, Lcom/discord/utilities/textprocessing/DiscordParser;->MASKED_LINK_PARSER:Lcom/discord/simpleast/core/parser/Parser;
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
sget-object p4, Lcom/discord/utilities/textprocessing/DiscordParser;->SAFE_LINK_PARSER:Lcom/discord/simpleast/core/parser/Parser;
|
|
|
|
:goto_0
|
|
move-object v0, p4
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
const-string p1, ""
|
|
|
|
:goto_1
|
|
move-object v1, p1
|
|
|
|
sget-object p1, Lcom/discord/utilities/textprocessing/MessageParseState;->Companion:Lcom/discord/utilities/textprocessing/MessageParseState$Companion;
|
|
|
|
invoke-virtual {p1}, Lcom/discord/utilities/textprocessing/MessageParseState$Companion;->getInitialState()Lcom/discord/utilities/textprocessing/MessageParseState;
|
|
|
|
move-result-object v2
|
|
|
|
const/4 v3, 0x0
|
|
|
|
const/4 v4, 0x4
|
|
|
|
const/4 v5, 0x0
|
|
|
|
invoke-static/range {v0 .. v5}, Lcom/discord/simpleast/core/parser/Parser;->parse$default(Lcom/discord/simpleast/core/parser/Parser;Ljava/lang/CharSequence;Ljava/lang/Object;Ljava/util/List;ILjava/lang/Object;)Ljava/util/List;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p3, p1}, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->process(Ljava/util/Collection;)V
|
|
|
|
if-eqz p5, :cond_2
|
|
|
|
new-instance p3, Lcom/discord/utilities/textprocessing/node/EditedMessageNode;
|
|
|
|
invoke-direct {p3, p0}, Lcom/discord/utilities/textprocessing/node/EditedMessageNode;-><init>(Landroid/content/Context;)V
|
|
|
|
invoke-interface {p1, p3}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
:cond_2
|
|
new-instance p0, Lcom/discord/utilities/textprocessing/node/ZeroSpaceWidthNode;
|
|
|
|
invoke-direct {p0}, Lcom/discord/utilities/textprocessing/node/ZeroSpaceWidthNode;-><init>()V
|
|
|
|
invoke-interface {p1, p0}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
invoke-static {p1, p2}, Lcom/discord/utilities/textprocessing/AstRenderer;->render(Ljava/util/Collection;Ljava/lang/Object;)Lcom/facebook/drawee/span/DraweeSpanStringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|