apkfuckery/com.discord/smali/com/discord/utilities/rest/SendUtilsKt.smali
2019-07-31 02:08:31 +02:00

232 lines
5.3 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-string v0, "uri"
invoke-static {p0, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
const-string v0, "contentResolver"
invoke-static {p1, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
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 v0
check-cast v0, Ljava/io/Closeable;
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_2
const/4 v1, 0x0
:try_start_1
move-object v2, v0
check-cast v2, Landroid/database/Cursor;
:try_end_1
.catch Ljava/lang/Throwable; {:try_start_1 .. :try_end_1} :catch_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
if-eqz v2, :cond_0
:try_start_2
const-string v3, "_size"
invoke-interface {v2, v3}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I
move-result v3
invoke-interface {v2}, Landroid/database/Cursor;->moveToFirst()Z
invoke-interface {v2, v3}, 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
:cond_0
move-object v2, v1
: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_3
: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, v1
: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_2
.catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0
.catch Ljava/lang/Throwable; {:try_start_2 .. :try_end_2} :catch_1
.catchall {:try_start_2 .. :try_end_2} :catchall_0
goto :goto_2
:cond_4
move-wide v2, v7
:goto_2
:try_start_3
invoke-static {v0, v1}, Lkotlin/d/a;->a(Ljava/io/Closeable;Ljava/lang/Throwable;)V
:try_end_3
.catch Ljava/lang/Exception; {:try_start_3 .. :try_end_3} :catch_0
return-wide v2
:catch_0
move-wide v2, v7
:goto_3
:try_start_4
invoke-static {v0, v1}, Lkotlin/d/a;->a(Ljava/io/Closeable;Ljava/lang/Throwable;)V
:try_end_4
.catch Ljava/lang/Exception; {:try_start_4 .. :try_end_4} :catch_2
return-wide v2
:catchall_0
move-exception p1
goto :goto_4
:catch_1
move-exception p1
move-object v1, p1
:try_start_5
throw v1
:try_end_5
.catchall {:try_start_5 .. :try_end_5} :catchall_0
:goto_4
:try_start_6
invoke-static {v0, v1}, Lkotlin/d/a;->a(Ljava/io/Closeable;Ljava/lang/Throwable;)V
throw p1
:try_end_6
.catch Ljava/lang/Exception; {:try_start_6 .. :try_end_6} :catch_2
:catch_2
move-exception p1
sget-object v0, Lcom/discord/app/AppLog;->uC:Lcom/discord/app/AppLog;
invoke-static {p0}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
move-result-object p0
const-string v1, "Failed querying size of file "
invoke-virtual {v1, p0}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
move-result-object v1
move-object v2, p1
check-cast v2, Ljava/lang/Throwable;
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
.end method
.method public static final computeFileSizeMegabytes(Landroid/net/Uri;Landroid/content/ContentResolver;)F
.locals 1
const-string v0, "uri"
invoke-static {p0, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
const-string v0, "contentResolver"
invoke-static {p1, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
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, 0x49800000 # 1048576.0f
div-float/2addr p0, p1
return p0
.end method