211 lines
5.8 KiB
Smali
211 lines
5.8 KiB
Smali
.class public final Lcom/discord/utilities/dsti/DstiUtils;
|
|
.super Ljava/lang/Object;
|
|
.source "DstiUtils.kt"
|
|
|
|
|
|
# static fields
|
|
.field public static final DEFAULT_STICKER_SIZE_PX:I = 0x140
|
|
|
|
.field public static final INSTANCE:Lcom/discord/utilities/dsti/DstiUtils;
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
new-instance v0, Lcom/discord/utilities/dsti/DstiUtils;
|
|
|
|
invoke-direct {v0}, Lcom/discord/utilities/dsti/DstiUtils;-><init>()V
|
|
|
|
sput-object v0, Lcom/discord/utilities/dsti/DstiUtils;->INSTANCE:Lcom/discord/utilities/dsti/DstiUtils;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final fetchLottieSticker(Landroid/content/Context;Lcom/discord/models/dsti/dto/ModelDsti;)Lrx/Observable;
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Landroid/content/Context;",
|
|
"Lcom/discord/models/dsti/dto/ModelDsti;",
|
|
")",
|
|
"Lrx/Observable<",
|
|
"Lcom/discord/utilities/file/FileUtils$DownloadState;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p1, :cond_3
|
|
|
|
if-eqz p2, :cond_2
|
|
|
|
invoke-virtual {p2}, Lcom/discord/models/dsti/dto/ModelDsti;->getType()Lcom/discord/models/dsti/dto/ModelDsti$Type;
|
|
|
|
move-result-object v0
|
|
|
|
sget-object v1, Lcom/discord/models/dsti/dto/ModelDsti$Type;->LOTTIE:Lcom/discord/models/dsti/dto/ModelDsti$Type;
|
|
|
|
if-eq v0, v1, :cond_0
|
|
|
|
new-instance p1, Lcom/discord/utilities/file/FileUtils$DownloadState$Failure;
|
|
|
|
new-instance v0, Ljava/lang/Exception;
|
|
|
|
const-string v1, "Invalid Dsti Format Type: "
|
|
|
|
invoke-static {v1}, Lf/e/b/a/a;->D(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {p2}, Lcom/discord/models/dsti/dto/ModelDsti;->getType()Lcom/discord/models/dsti/dto/ModelDsti$Type;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-direct {v0, p2}, Ljava/lang/Exception;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-direct {p1, v0}, Lcom/discord/utilities/file/FileUtils$DownloadState$Failure;-><init>(Ljava/lang/Exception;)V
|
|
|
|
new-instance p2, Lr0/l/e/j;
|
|
|
|
invoke-direct {p2, p1}, Lr0/l/e/j;-><init>(Ljava/lang/Object;)V
|
|
|
|
const-string p1, "Observable.just(\n \u2026()}\")\n )\n )"
|
|
|
|
invoke-static {p2, p1}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object p2
|
|
|
|
:cond_0
|
|
new-instance v0, Ljava/io/File;
|
|
|
|
invoke-virtual {p1}, Landroid/content/Context;->getCacheDir()Ljava/io/File;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {p2}, Lcom/discord/models/dsti/dto/ModelDsti;->getAssetUrl()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-direct {v0, v1, v2}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v0}, Ljava/io/File;->exists()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
new-instance p1, Lcom/discord/utilities/file/FileUtils$DownloadState$Completed;
|
|
|
|
invoke-direct {p1, v0}, Lcom/discord/utilities/file/FileUtils$DownloadState$Completed;-><init>(Ljava/io/File;)V
|
|
|
|
new-instance p2, Lr0/l/e/j;
|
|
|
|
invoke-direct {p2, p1}, Lr0/l/e/j;-><init>(Ljava/lang/Object;)V
|
|
|
|
const-string p1, "Observable.just(FileUtil\u2026oadState.Completed(file))"
|
|
|
|
invoke-static {p2, p1}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
invoke-virtual {p0, p2}, Lcom/discord/utilities/dsti/DstiUtils;->getCDNAssetUrl(Lcom/discord/models/dsti/dto/ModelDsti;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p2}, Lcom/discord/models/dsti/dto/ModelDsti;->getAssetUrl()Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-virtual {p1}, Landroid/content/Context;->getCacheDir()Ljava/io/File;
|
|
|
|
move-result-object v1
|
|
|
|
const-string v2, "context.cacheDir"
|
|
|
|
invoke-static {v1, v2}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-static {p1, v0, p2, v1}, Lcom/discord/utilities/file/FileUtils;->downloadFile(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Ljava/io/File;)Lrx/Observable;
|
|
|
|
move-result-object p2
|
|
|
|
:goto_0
|
|
return-object p2
|
|
|
|
:cond_2
|
|
const-string p1, "dsti"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_3
|
|
const-string p1, "context"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public final getCDNAssetUrl(Lcom/discord/models/dsti/dto/ModelDsti;)Ljava/lang/String;
|
|
.locals 3
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
const-string v0, "https://cdn.discordapp.com/stickers/"
|
|
|
|
invoke-static {v0}, Lf/e/b/a/a;->D(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p1}, Lcom/discord/models/dsti/dto/ModelDsti;->getId()J
|
|
|
|
move-result-wide v1
|
|
|
|
invoke-virtual {v0, v1, v2}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
const/16 v1, 0x2f
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p1}, Lcom/discord/models/dsti/dto/ModelDsti;->getAssetUrl()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
|
|
:cond_0
|
|
const-string p1, "dsti"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
throw p1
|
|
.end method
|