542 lines
14 KiB
Smali
542 lines
14 KiB
Smali
.class public final Lcom/discord/utilities/channel/ChannelUtils;
|
|
.super Ljava/lang/Object;
|
|
.source "ChannelUtils.kt"
|
|
|
|
|
|
# static fields
|
|
.field public static final DISPLAY_PREFIX_DM:Ljava/lang/String; = "@"
|
|
|
|
.field public static final DISPLAY_PREFIX_GUILD:Ljava/lang/String; = "#"
|
|
|
|
.field public static final INSTANCE:Lcom/discord/utilities/channel/ChannelUtils;
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
new-instance v0, Lcom/discord/utilities/channel/ChannelUtils;
|
|
|
|
invoke-direct {v0}, Lcom/discord/utilities/channel/ChannelUtils;-><init>()V
|
|
|
|
sput-object v0, Lcom/discord/utilities/channel/ChannelUtils;->INSTANCE:Lcom/discord/utilities/channel/ChannelUtils;
|
|
|
|
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 getDisplayName(Lcom/discord/models/domain/ModelChannel;Landroid/content/Context;)Ljava/lang/String;
|
|
.locals 3
|
|
|
|
const/4 v0, 0x0
|
|
|
|
const/4 v1, 0x2
|
|
|
|
const/4 v2, 0x0
|
|
|
|
invoke-static {p0, p1, v0, v1, v2}, Lcom/discord/utilities/channel/ChannelUtils;->getDisplayName$default(Lcom/discord/models/domain/ModelChannel;Landroid/content/Context;ZILjava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static final getDisplayName(Lcom/discord/models/domain/ModelChannel;Landroid/content/Context;Z)Ljava/lang/String;
|
|
.locals 2
|
|
|
|
const-string v0, "$this$getDisplayName"
|
|
|
|
invoke-static {p0, v0}, Lb0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "context"
|
|
|
|
invoke-static {p1, v0}, Lb0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
sget-object v0, Lcom/discord/utilities/channel/ChannelUtils;->INSTANCE:Lcom/discord/utilities/channel/ChannelUtils;
|
|
|
|
invoke-virtual {p0}, Lcom/discord/models/domain/ModelChannel;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {p0}, Lcom/discord/models/domain/ModelChannel;->getType()I
|
|
|
|
move-result p0
|
|
|
|
invoke-virtual {v0, p1, v1, p0, p2}, Lcom/discord/utilities/channel/ChannelUtils;->getDisplayName(Landroid/content/Context;Ljava/lang/String;IZ)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static synthetic getDisplayName$default(Lcom/discord/models/domain/ModelChannel;Landroid/content/Context;ZILjava/lang/Object;)Ljava/lang/String;
|
|
.locals 0
|
|
|
|
and-int/lit8 p3, p3, 0x2
|
|
|
|
if-eqz p3, :cond_0
|
|
|
|
const/4 p2, 0x1
|
|
|
|
:cond_0
|
|
invoke-static {p0, p1, p2}, Lcom/discord/utilities/channel/ChannelUtils;->getDisplayName(Lcom/discord/models/domain/ModelChannel;Landroid/content/Context;Z)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static synthetic getDisplayName$default(Lcom/discord/utilities/channel/ChannelUtils;Landroid/content/Context;Ljava/lang/String;IZILjava/lang/Object;)Ljava/lang/String;
|
|
.locals 0
|
|
|
|
and-int/lit8 p5, p5, 0x8
|
|
|
|
if-eqz p5, :cond_0
|
|
|
|
const/4 p4, 0x1
|
|
|
|
:cond_0
|
|
invoke-virtual {p0, p1, p2, p3, p4}, Lcom/discord/utilities/channel/ChannelUtils;->getDisplayName(Landroid/content/Context;Ljava/lang/String;IZ)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static final getNickOrUsernames(Ljava/lang/Iterable;Lcom/discord/models/domain/ModelChannel;Ljava/util/Map;Ljava/util/Map;)Ljava/util/Map;
|
|
.locals 4
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/lang/Iterable<",
|
|
"+",
|
|
"Lcom/discord/models/domain/ModelUser;",
|
|
">;",
|
|
"Lcom/discord/models/domain/ModelChannel;",
|
|
"Ljava/util/Map<",
|
|
"Ljava/lang/Long;",
|
|
"+",
|
|
"Lcom/discord/models/domain/ModelGuildMember$Computed;",
|
|
">;",
|
|
"Ljava/util/Map<",
|
|
"Ljava/lang/Long;",
|
|
"+",
|
|
"Lcom/discord/models/domain/ModelChannel$RecipientNick;",
|
|
">;)",
|
|
"Ljava/util/Map<",
|
|
"Ljava/lang/Long;",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
const-string/jumbo v0, "users"
|
|
|
|
invoke-static {p0, v0}, Lb0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "channelMembers"
|
|
|
|
invoke-static {p2, v0}, Lb0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "nicks"
|
|
|
|
invoke-static {p3, v0}, Lb0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const/16 v0, 0xa
|
|
|
|
invoke-static {p0, v0}, Lf/h/a/f/e/n/f;->collectionSizeOrDefault(Ljava/lang/Iterable;I)I
|
|
|
|
move-result v0
|
|
|
|
invoke-static {v0}, Lf/h/a/f/e/n/f;->mapCapacity(I)I
|
|
|
|
move-result v0
|
|
|
|
const/16 v1, 0x10
|
|
|
|
if-ge v0, v1, :cond_0
|
|
|
|
const/16 v0, 0x10
|
|
|
|
:cond_0
|
|
new-instance v1, Ljava/util/LinkedHashMap;
|
|
|
|
invoke-direct {v1, v0}, Ljava/util/LinkedHashMap;-><init>(I)V
|
|
|
|
invoke-interface {p0}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object p0
|
|
|
|
:goto_0
|
|
invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Lcom/discord/models/domain/ModelUser;
|
|
|
|
invoke-virtual {v0}, Lcom/discord/models/domain/ModelUser;->getId()J
|
|
|
|
move-result-wide v2
|
|
|
|
invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-static {v0, p2}, Lf/e/c/a/a;->a0(Lcom/discord/models/domain/ModelUser;Ljava/util/Map;)Ljava/lang/Object;
|
|
|
|
move-result-object v3
|
|
|
|
check-cast v3, Lcom/discord/models/domain/ModelGuildMember$Computed;
|
|
|
|
invoke-virtual {v0, v3, p1, p3}, Lcom/discord/models/domain/ModelUser;->getNickOrUsername(Lcom/discord/models/domain/ModelGuildMember$Computed;Lcom/discord/models/domain/ModelChannel;Ljava/util/Map;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
new-instance v3, Lkotlin/Pair;
|
|
|
|
invoke-direct {v3, v2, v0}, Lkotlin/Pair;-><init>(Ljava/lang/Object;Ljava/lang/Object;)V
|
|
|
|
iget-object v0, v3, Lkotlin/Pair;->first:Ljava/lang/Object;
|
|
|
|
iget-object v2, v3, Lkotlin/Pair;->second:Ljava/lang/Object;
|
|
|
|
invoke-interface {v1, v0, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
return-object v1
|
|
.end method
|
|
|
|
.method public static getNickOrUsernames$default(Ljava/lang/Iterable;Lcom/discord/models/domain/ModelChannel;Ljava/util/Map;Ljava/util/Map;ILjava/lang/Object;)Ljava/util/Map;
|
|
.locals 0
|
|
|
|
and-int/lit8 p4, p4, 0x8
|
|
|
|
if-eqz p4, :cond_0
|
|
|
|
sget-object p3, Lb0/i/m;->d:Lb0/i/m;
|
|
|
|
:cond_0
|
|
invoke-static {p0, p1, p2, p3}, Lcom/discord/utilities/channel/ChannelUtils;->getNickOrUsernames(Ljava/lang/Iterable;Lcom/discord/models/domain/ModelChannel;Ljava/util/Map;Ljava/util/Map;)Ljava/util/Map;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final createMostRecentChannelComparator(Ljava/util/Map;)Ljava/util/Comparator;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/Map<",
|
|
"Ljava/lang/Long;",
|
|
"Ljava/lang/Long;",
|
|
">;)",
|
|
"Ljava/util/Comparator<",
|
|
"Lcom/discord/models/domain/ModelChannel;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
const-string v0, "mostRecentMessageIds"
|
|
|
|
invoke-static {p1, v0}, Lb0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
new-instance v0, Lcom/discord/utilities/channel/ChannelUtils$createMostRecentChannelComparator$1;
|
|
|
|
invoke-direct {v0, p1}, Lcom/discord/utilities/channel/ChannelUtils$createMostRecentChannelComparator$1;-><init>(Ljava/util/Map;)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public final getDefaultChannel(J)Lrx/Observable;
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(J)",
|
|
"Lrx/Observable<",
|
|
"Lcom/discord/models/domain/ModelChannel;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
sget-object v0, Lcom/discord/stores/StoreStream;->Companion:Lcom/discord/stores/StoreStream$Companion;
|
|
|
|
invoke-virtual {v0}, Lcom/discord/stores/StoreStream$Companion;->getPermissions()Lcom/discord/stores/StorePermissions;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0, p1, p2}, Lcom/discord/stores/StorePermissions;->getForChannels(J)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
new-instance v1, Lcom/discord/utilities/channel/ChannelUtils$getDefaultChannel$1;
|
|
|
|
invoke-direct {v1, p1, p2}, Lcom/discord/utilities/channel/ChannelUtils$getDefaultChannel$1;-><init>(J)V
|
|
|
|
invoke-virtual {v0, v1}, Lrx/Observable;->U(Lk0/k/b;)Lrx/Observable;
|
|
|
|
move-result-object p1
|
|
|
|
const-string p2, "StoreStream\n .get\u2026 }\n }"
|
|
|
|
invoke-static {p1, p2}, Lb0/n/c/j;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public final getDisplayName(Landroid/content/Context;Ljava/lang/String;I)Ljava/lang/String;
|
|
.locals 7
|
|
|
|
const/4 v4, 0x0
|
|
|
|
const/16 v5, 0x8
|
|
|
|
const/4 v6, 0x0
|
|
|
|
move-object v0, p0
|
|
|
|
move-object v1, p1
|
|
|
|
move-object v2, p2
|
|
|
|
move v3, p3
|
|
|
|
invoke-static/range {v0 .. v6}, Lcom/discord/utilities/channel/ChannelUtils;->getDisplayName$default(Lcom/discord/utilities/channel/ChannelUtils;Landroid/content/Context;Ljava/lang/String;IZILjava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public final getDisplayName(Landroid/content/Context;Ljava/lang/String;IZ)Ljava/lang/String;
|
|
.locals 2
|
|
|
|
const-string v0, "context"
|
|
|
|
invoke-static {p1, v0}, Lb0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-static {p2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz p3, :cond_4
|
|
|
|
const/4 v1, 0x1
|
|
|
|
if-eq p3, v1, :cond_2
|
|
|
|
const/4 v1, 0x2
|
|
|
|
if-eq p3, v1, :cond_1
|
|
|
|
const/4 v1, 0x3
|
|
|
|
if-eq p3, v1, :cond_0
|
|
|
|
const/4 v1, 0x5
|
|
|
|
if-eq p3, v1, :cond_4
|
|
|
|
const/16 v1, 0x9
|
|
|
|
if-eq p3, v1, :cond_4
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
if-eqz v0, :cond_6
|
|
|
|
const p2, 0x7f121796
|
|
|
|
invoke-virtual {p1, p2}, Landroid/content/Context;->getString(I)Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
if-eqz v0, :cond_6
|
|
|
|
const p2, 0x7f120d83
|
|
|
|
invoke-virtual {p1, p2}, Landroid/content/Context;->getString(I)Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
if-eqz v0, :cond_3
|
|
|
|
const p2, 0x7f1205d1
|
|
|
|
invoke-virtual {p1, p2}, Landroid/content/Context;->getString(I)Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
:cond_3
|
|
if-eqz p4, :cond_6
|
|
|
|
const-string p1, "@"
|
|
|
|
invoke-static {p1, p2}, Lf/e/c/a/a;->q(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
goto :goto_0
|
|
|
|
:cond_4
|
|
if-eqz v0, :cond_5
|
|
|
|
const p2, 0x7f120d82
|
|
|
|
invoke-virtual {p1, p2}, Landroid/content/Context;->getString(I)Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
:cond_5
|
|
if-eqz p4, :cond_6
|
|
|
|
const-string p1, "#"
|
|
|
|
invoke-static {p1, p2}, Lf/e/c/a/a;->q(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
:cond_6
|
|
:goto_0
|
|
return-object p2
|
|
.end method
|
|
|
|
.method public final getSortedCategories(Ljava/util/Map;)Ljava/util/Map;
|
|
.locals 5
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/Map<",
|
|
"Ljava/lang/Long;",
|
|
"+",
|
|
"Lcom/discord/models/domain/ModelChannel;",
|
|
">;)",
|
|
"Ljava/util/Map<",
|
|
"Ljava/lang/Long;",
|
|
"Ljava/util/Collection<",
|
|
"Lcom/discord/models/domain/ModelChannel;",
|
|
">;>;"
|
|
}
|
|
.end annotation
|
|
|
|
const-string v0, "guildChannels"
|
|
|
|
invoke-static {p1, v0}, Lb0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-static {}, Lcom/discord/models/domain/ModelChannel;->getSortByNameAndType()Ljava/util/Comparator;
|
|
|
|
move-result-object v0
|
|
|
|
new-instance v1, Ljava/util/TreeMap;
|
|
|
|
new-instance v2, Lcom/discord/utilities/channel/ChannelUtils$getSortedCategories$sortedCategories$1;
|
|
|
|
invoke-direct {v2, v0, p1}, Lcom/discord/utilities/channel/ChannelUtils$getSortedCategories$sortedCategories$1;-><init>(Ljava/util/Comparator;Ljava/util/Map;)V
|
|
|
|
invoke-direct {v1, v2}, Ljava/util/TreeMap;-><init>(Ljava/util/Comparator;)V
|
|
|
|
invoke-interface {p1}, Ljava/util/Map;->values()Ljava/util/Collection;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {p1}, Lb0/i/f;->filterNotNull(Ljava/lang/Iterable;)Ljava/util/List;
|
|
|
|
move-result-object p1
|
|
|
|
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 v2
|
|
|
|
if-eqz v2, :cond_3
|
|
|
|
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
check-cast v2, Lcom/discord/models/domain/ModelChannel;
|
|
|
|
invoke-virtual {v2}, Lcom/discord/models/domain/ModelChannel;->isCategory()Z
|
|
|
|
move-result v3
|
|
|
|
if-nez v3, :cond_1
|
|
|
|
invoke-virtual {v2}, Lcom/discord/models/domain/ModelChannel;->isThread()Z
|
|
|
|
move-result v3
|
|
|
|
if-eqz v3, :cond_0
|
|
|
|
goto :goto_1
|
|
|
|
:cond_0
|
|
invoke-virtual {v2}, Lcom/discord/models/domain/ModelChannel;->getParentId()J
|
|
|
|
move-result-wide v3
|
|
|
|
goto :goto_2
|
|
|
|
:cond_1
|
|
:goto_1
|
|
invoke-virtual {v2}, Lcom/discord/models/domain/ModelChannel;->getId()J
|
|
|
|
move-result-wide v3
|
|
|
|
:goto_2
|
|
invoke-static {v3, v4}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-interface {v1, v3}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v4
|
|
|
|
if-nez v4, :cond_2
|
|
|
|
new-instance v4, Ljava/util/TreeSet;
|
|
|
|
invoke-direct {v4, v0}, Ljava/util/TreeSet;-><init>(Ljava/util/Comparator;)V
|
|
|
|
invoke-interface {v1, v3, v4}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
:cond_2
|
|
check-cast v4, Ljava/util/Set;
|
|
|
|
invoke-interface {v4, v2}, Ljava/util/Set;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_0
|
|
|
|
:cond_3
|
|
return-object v1
|
|
.end method
|