492 lines
13 KiB
Smali
492 lines
13 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 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 private 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 2
|
|
|
|
const-string v0, "receiver$0"
|
|
|
|
invoke-static {p0, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "context"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/j;->h(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}, Lcom/discord/utilities/channel/ChannelUtils;->getDisplayName(Landroid/content/Context;Ljava/lang/String;I)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 5
|
|
.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 v0, "users"
|
|
|
|
invoke-static {p0, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "channelMembers"
|
|
|
|
invoke-static {p2, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "nicks"
|
|
|
|
invoke-static {p3, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const/16 v0, 0xa
|
|
|
|
invoke-static {p0, v0}, Lkotlin/a/l;->a(Ljava/lang/Iterable;I)I
|
|
|
|
move-result v0
|
|
|
|
invoke-static {v0}, Lkotlin/a/ab;->cI(I)I
|
|
|
|
move-result v0
|
|
|
|
const/16 v1, 0x10
|
|
|
|
invoke-static {v0, v1}, Lkotlin/ranges/b;->Z(II)I
|
|
|
|
move-result v0
|
|
|
|
new-instance v1, Ljava/util/LinkedHashMap;
|
|
|
|
invoke-direct {v1, v0}, Ljava/util/LinkedHashMap;-><init>(I)V
|
|
|
|
check-cast v1, Ljava/util/Map;
|
|
|
|
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_0
|
|
|
|
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-virtual {v0}, Lcom/discord/models/domain/ModelUser;->getId()J
|
|
|
|
move-result-wide v3
|
|
|
|
invoke-static {v3, v4}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-interface {p2, v3}, Ljava/util/Map;->get(Ljava/lang/Object;)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
|
|
|
|
invoke-static {v2, v0}, Lkotlin/q;->m(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
|
|
|
|
move-result-object v0
|
|
|
|
iget-object v2, v0, Lkotlin/Pair;->first:Ljava/lang/Object;
|
|
|
|
iget-object v0, v0, Lkotlin/Pair;->second:Ljava/lang/Object;
|
|
|
|
invoke-interface {v1, v2, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
return-object v1
|
|
.end method
|
|
|
|
.method public static synthetic 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
|
|
|
|
invoke-static {}, Lkotlin/a/ab;->emptyMap()Ljava/util/Map;
|
|
|
|
move-result-object p3
|
|
|
|
: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}, Lkotlin/jvm/internal/j;->h(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
|
|
|
|
check-cast v0, Ljava/util/Comparator;
|
|
|
|
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
|
|
|
|
invoke-static {}, Lcom/discord/stores/StoreStream;->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
|
|
|
|
check-cast v1, Lrx/functions/b;
|
|
|
|
invoke-virtual {v0, v1}, Lrx/Observable;->g(Lrx/functions/b;)Lrx/Observable;
|
|
|
|
move-result-object p1
|
|
|
|
const-string p2, "StoreStream\n .get\u2026 }\n }"
|
|
|
|
invoke-static {p1, p2}, Lkotlin/jvm/internal/j;->g(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 2
|
|
|
|
const-string v0, "context"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
move-object v0, p2
|
|
|
|
check-cast v0, Ljava/lang/CharSequence;
|
|
|
|
invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v0
|
|
|
|
packed-switch p3, :pswitch_data_0
|
|
|
|
return-object p2
|
|
|
|
:pswitch_0
|
|
return-object p2
|
|
|
|
:pswitch_1
|
|
if-eqz v0, :cond_0
|
|
|
|
const p2, 0x7f1206f9
|
|
|
|
invoke-virtual {p1, p2}, Landroid/content/Context;->getString(I)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
|
|
:cond_0
|
|
return-object p2
|
|
|
|
:pswitch_2
|
|
if-eqz v0, :cond_1
|
|
|
|
const p2, 0x7f1208a9
|
|
|
|
invoke-virtual {p1, p2}, Landroid/content/Context;->getString(I)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
|
|
:cond_1
|
|
return-object p2
|
|
|
|
:pswitch_3
|
|
new-instance p3, Ljava/lang/StringBuilder;
|
|
|
|
const-string v1, "@"
|
|
|
|
invoke-direct {p3, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
if-eqz v0, :cond_2
|
|
|
|
const p2, 0x7f12046b
|
|
|
|
invoke-virtual {p1, p2}, Landroid/content/Context;->getString(I)Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
:cond_2
|
|
invoke-virtual {p3, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
|
|
:pswitch_4
|
|
new-instance p3, Ljava/lang/StringBuilder;
|
|
|
|
const-string v1, "#"
|
|
|
|
invoke-direct {p3, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
if-eqz v0, :cond_3
|
|
|
|
const p2, 0x7f1208a8
|
|
|
|
invoke-virtual {p1, p2}, Landroid/content/Context;->getString(I)Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
:cond_3
|
|
invoke-virtual {p3, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
|
|
nop
|
|
|
|
:pswitch_data_0
|
|
.packed-switch 0x0
|
|
:pswitch_4
|
|
:pswitch_3
|
|
:pswitch_2
|
|
:pswitch_1
|
|
:pswitch_0
|
|
.end packed-switch
|
|
.end method
|
|
|
|
.method public final getSortedCategories(Ljava/util/Map;)Ljava/util/Map;
|
|
.locals 6
|
|
.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}, Lkotlin/jvm/internal/j;->h(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
|
|
|
|
check-cast v2, Ljava/util/Comparator;
|
|
|
|
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
|
|
|
|
check-cast p1, Ljava/lang/Iterable;
|
|
|
|
invoke-static {p1}, Lkotlin/a/l;->d(Ljava/lang/Iterable;)Ljava/util/List;
|
|
|
|
move-result-object p1
|
|
|
|
check-cast p1, Ljava/lang/Iterable;
|
|
|
|
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_2
|
|
|
|
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-eqz v3, :cond_0
|
|
|
|
invoke-virtual {v2}, Lcom/discord/models/domain/ModelChannel;->getId()J
|
|
|
|
move-result-wide v3
|
|
|
|
goto :goto_1
|
|
|
|
:cond_0
|
|
invoke-virtual {v2}, Lcom/discord/models/domain/ModelChannel;->getParentId()J
|
|
|
|
move-result-wide v3
|
|
|
|
:goto_1
|
|
move-object v5, v1
|
|
|
|
check-cast v5, Ljava/util/Map;
|
|
|
|
invoke-static {v3, v4}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-interface {v5, v3}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v4
|
|
|
|
if-nez v4, :cond_1
|
|
|
|
new-instance v4, Ljava/util/TreeSet;
|
|
|
|
invoke-direct {v4, v0}, Ljava/util/TreeSet;-><init>(Ljava/util/Comparator;)V
|
|
|
|
invoke-interface {v5, v3, v4}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
:cond_1
|
|
check-cast v4, Ljava/util/Set;
|
|
|
|
invoke-interface {v4, v2}, Ljava/util/Set;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
check-cast v1, Ljava/util/Map;
|
|
|
|
return-object v1
|
|
.end method
|