241 lines
5.1 KiB
Smali
241 lines
5.1 KiB
Smali
.class public final Lcom/discord/utilities/rest/SendUtilsKt;
|
|
.super Ljava/lang/Object;
|
|
.source "SendUtils.kt"
|
|
|
|
|
|
# direct methods
|
|
.method public static final computeFileSizeBytes(Landroid/net/Uri;Landroid/content/ContentResolver;)J
|
|
.locals 10
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p0, :cond_6
|
|
|
|
if-eqz p1, :cond_5
|
|
|
|
const/4 v3, 0x0
|
|
|
|
const/4 v4, 0x0
|
|
|
|
const/4 v5, 0x0
|
|
|
|
const/4 v6, 0x0
|
|
|
|
const-wide/16 v7, -0x1
|
|
|
|
move-object v1, p1
|
|
|
|
move-object v2, p0
|
|
|
|
:try_start_0
|
|
invoke-virtual/range {v1 .. v6}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;
|
|
|
|
move-result-object v1
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_1
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
:try_start_1
|
|
const-string v2, "_size"
|
|
|
|
invoke-interface {v1, v2}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I
|
|
|
|
move-result v2
|
|
|
|
invoke-interface {v1}, Landroid/database/Cursor;->moveToFirst()Z
|
|
|
|
invoke-interface {v1, v2}, Landroid/database/Cursor;->getLong(I)J
|
|
|
|
move-result-wide v2
|
|
|
|
invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object v2
|
|
|
|
goto :goto_0
|
|
|
|
:catchall_0
|
|
move-exception p1
|
|
|
|
goto :goto_3
|
|
|
|
:cond_0
|
|
move-object v2, v0
|
|
|
|
:goto_0
|
|
if-eqz v2, :cond_1
|
|
|
|
invoke-virtual {v2}, Ljava/lang/Long;->longValue()J
|
|
|
|
move-result-wide v3
|
|
|
|
const-wide/16 v5, 0x0
|
|
|
|
cmp-long v9, v3, v5
|
|
|
|
if-lez v9, :cond_1
|
|
|
|
invoke-virtual {v2}, Ljava/lang/Long;->longValue()J
|
|
|
|
move-result-wide v2
|
|
|
|
goto :goto_4
|
|
|
|
:cond_1
|
|
const-string v2, "r"
|
|
|
|
invoke-virtual {p1, p0, v2}, Landroid/content/ContentResolver;->openFileDescriptor(Landroid/net/Uri;Ljava/lang/String;)Landroid/os/ParcelFileDescriptor;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_2
|
|
|
|
invoke-virtual {p1}, Landroid/os/ParcelFileDescriptor;->getStatSize()J
|
|
|
|
move-result-wide v2
|
|
|
|
invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object v2
|
|
|
|
goto :goto_1
|
|
|
|
:cond_2
|
|
move-object v2, v0
|
|
|
|
:goto_1
|
|
if-eqz p1, :cond_3
|
|
|
|
invoke-virtual {p1}, Landroid/os/ParcelFileDescriptor;->close()V
|
|
|
|
:cond_3
|
|
if-eqz v2, :cond_4
|
|
|
|
invoke-virtual {v2}, Ljava/lang/Long;->longValue()J
|
|
|
|
move-result-wide v2
|
|
:try_end_1
|
|
.catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
goto :goto_2
|
|
|
|
:cond_4
|
|
move-wide v2, v7
|
|
|
|
:goto_2
|
|
:try_start_2
|
|
invoke-static {v1, v0}, Lf/n/a/j/a;->closeFinally(Ljava/io/Closeable;Ljava/lang/Throwable;)V
|
|
:try_end_2
|
|
.catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0
|
|
|
|
return-wide v2
|
|
|
|
:goto_3
|
|
:try_start_3
|
|
throw p1
|
|
:try_end_3
|
|
.catchall {:try_start_3 .. :try_end_3} :catchall_1
|
|
|
|
:catchall_1
|
|
move-exception v0
|
|
|
|
:try_start_4
|
|
invoke-static {v1, p1}, Lf/n/a/j/a;->closeFinally(Ljava/io/Closeable;Ljava/lang/Throwable;)V
|
|
|
|
throw v0
|
|
|
|
:catch_0
|
|
move-wide v2, v7
|
|
|
|
:goto_4
|
|
invoke-static {v1, v0}, Lf/n/a/j/a;->closeFinally(Ljava/io/Closeable;Ljava/lang/Throwable;)V
|
|
:try_end_4
|
|
.catch Ljava/lang/Exception; {:try_start_4 .. :try_end_4} :catch_1
|
|
|
|
return-wide v2
|
|
|
|
:catch_1
|
|
move-exception p1
|
|
|
|
move-object v2, p1
|
|
|
|
sget-object v0, Lcom/discord/app/AppLog;->c:Lcom/discord/app/AppLog;
|
|
|
|
new-instance p1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v1, "Failed querying size of file "
|
|
|
|
invoke-virtual {p1, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
const/4 v3, 0x0
|
|
|
|
const/4 v4, 0x4
|
|
|
|
const/4 v5, 0x0
|
|
|
|
invoke-static/range {v0 .. v5}, Lcom/discord/utilities/logging/Logger;->e$default(Lcom/discord/utilities/logging/Logger;Ljava/lang/String;Ljava/lang/Throwable;Ljava/util/Map;ILjava/lang/Object;)V
|
|
|
|
return-wide v7
|
|
|
|
:cond_5
|
|
const-string p0, "contentResolver"
|
|
|
|
invoke-static {p0}, Ly/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_6
|
|
const-string p0, "uri"
|
|
|
|
invoke-static {p0}, Ly/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public static final computeFileSizeMegabytes(Landroid/net/Uri;Landroid/content/ContentResolver;)F
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p0, :cond_1
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
invoke-static {p0, p1}, Lcom/discord/utilities/rest/SendUtilsKt;->computeFileSizeBytes(Landroid/net/Uri;Landroid/content/ContentResolver;)J
|
|
|
|
move-result-wide p0
|
|
|
|
long-to-float p0, p0
|
|
|
|
const/high16 p1, 0x100000
|
|
|
|
int-to-float p1, p1
|
|
|
|
div-float/2addr p0, p1
|
|
|
|
return p0
|
|
|
|
:cond_0
|
|
const-string p0, "contentResolver"
|
|
|
|
invoke-static {p0}, Ly/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_1
|
|
const-string p0, "uri"
|
|
|
|
invoke-static {p0}, Ly/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|