225 lines
4.1 KiB
Smali
225 lines
4.1 KiB
Smali
.class public final Lcom/discord/widgets/chat/input/MentionUtilsKt;
|
|
.super Ljava/lang/Object;
|
|
.source "MentionUtils.kt"
|
|
|
|
|
|
# static fields
|
|
.field public static final CHANNELS_CHAR:C = '#'
|
|
|
|
.field public static final DEFAULT_LEADING_IDENTIFIERS:Ljava/util/Set;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/Set<",
|
|
"Ljava/lang/Character;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field public static final EMOJIS_CHAR:C = ':'
|
|
|
|
.field public static final MENTIONS_CHAR:C = '@'
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 3
|
|
|
|
const/4 v0, 0x3
|
|
|
|
new-array v0, v0, [Ljava/lang/Character;
|
|
|
|
const/16 v1, 0x40
|
|
|
|
invoke-static {v1}, Ljava/lang/Character;->valueOf(C)Ljava/lang/Character;
|
|
|
|
move-result-object v1
|
|
|
|
const/4 v2, 0x0
|
|
|
|
aput-object v1, v0, v2
|
|
|
|
const/16 v1, 0x3a
|
|
|
|
invoke-static {v1}, Ljava/lang/Character;->valueOf(C)Ljava/lang/Character;
|
|
|
|
move-result-object v1
|
|
|
|
const/4 v2, 0x1
|
|
|
|
aput-object v1, v0, v2
|
|
|
|
const/16 v1, 0x23
|
|
|
|
invoke-static {v1}, Ljava/lang/Character;->valueOf(C)Ljava/lang/Character;
|
|
|
|
move-result-object v1
|
|
|
|
const/4 v2, 0x2
|
|
|
|
aput-object v1, v0, v2
|
|
|
|
invoke-static {v0}, Lf/n/a/k/a;->hashSetOf([Ljava/lang/Object;)Ljava/util/HashSet;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lcom/discord/widgets/chat/input/MentionUtilsKt;->DEFAULT_LEADING_IDENTIFIERS:Ljava/util/Set;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static final getDEFAULT_LEADING_IDENTIFIERS()Ljava/util/Set;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Ljava/util/Set<",
|
|
"Ljava/lang/Character;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
sget-object v0, Lcom/discord/widgets/chat/input/MentionUtilsKt;->DEFAULT_LEADING_IDENTIFIERS:Ljava/util/Set;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static final getSelectedToken(Ljava/lang/String;I)Ljava/lang/String;
|
|
.locals 5
|
|
|
|
const-string v0, "content"
|
|
|
|
invoke-static {p0, v0}, Lk0/o/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-interface {p0}, Ljava/lang/CharSequence;->length()I
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
const/4 v2, 0x1
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
const/4 v3, 0x0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
return-object v3
|
|
|
|
:cond_1
|
|
invoke-virtual {p0}, Ljava/lang/String;->length()I
|
|
|
|
move-result v0
|
|
|
|
if-ne p1, v0, :cond_2
|
|
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_2
|
|
const/4 v0, 0x0
|
|
|
|
:goto_1
|
|
if-eqz p1, :cond_4
|
|
|
|
add-int/lit8 v4, p1, -0x1
|
|
|
|
invoke-virtual {p0, v4}, Ljava/lang/String;->charAt(I)C
|
|
|
|
move-result v4
|
|
|
|
invoke-static {v4}, Lf/n/a/k/a;->isWhitespace(C)Z
|
|
|
|
move-result v4
|
|
|
|
if-eqz v4, :cond_3
|
|
|
|
goto :goto_2
|
|
|
|
:cond_3
|
|
const/4 v4, 0x0
|
|
|
|
goto :goto_3
|
|
|
|
:cond_4
|
|
:goto_2
|
|
const/4 v4, 0x1
|
|
|
|
:goto_3
|
|
if-eqz v0, :cond_5
|
|
|
|
if-eqz v4, :cond_5
|
|
|
|
return-object v3
|
|
|
|
:cond_5
|
|
const/16 v0, 0x20
|
|
|
|
invoke-static {p0, v0, p1}, Lcom/discord/widgets/chat/input/MentionUtilsKt;->reverseIndexOf(Ljava/lang/String;CI)I
|
|
|
|
move-result v0
|
|
|
|
add-int/2addr v0, v2
|
|
|
|
invoke-virtual {p0, v0, p1}, Ljava/lang/String;->substring(II)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
const-string p1, "(this as java.lang.Strin\u2026ing(startIndex, endIndex)"
|
|
|
|
invoke-static {p0, p1}, Lk0/o/c/i;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-interface {p0}, Ljava/lang/CharSequence;->length()I
|
|
|
|
move-result p1
|
|
|
|
if-lez p1, :cond_6
|
|
|
|
const/4 v1, 0x1
|
|
|
|
:cond_6
|
|
if-eqz v1, :cond_7
|
|
|
|
move-object v3, p0
|
|
|
|
:cond_7
|
|
return-object v3
|
|
.end method
|
|
|
|
.method public static final reverseIndexOf(Ljava/lang/String;CI)I
|
|
.locals 2
|
|
|
|
const/4 v0, -0x1
|
|
|
|
add-int/2addr p2, v0
|
|
|
|
:goto_0
|
|
if-ltz p2, :cond_1
|
|
|
|
invoke-virtual {p0, p2}, Ljava/lang/String;->charAt(I)C
|
|
|
|
move-result v1
|
|
|
|
if-ne v1, p1, :cond_0
|
|
|
|
return p2
|
|
|
|
:cond_0
|
|
add-int/lit8 p2, p2, -0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
return v0
|
|
.end method
|