225 lines
5.2 KiB
Smali
225 lines
5.2 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/l;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "contentResolver"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/l;->checkParameterIsNotNull(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_1
|
|
|
|
:try_start_1
|
|
move-object v1, v0
|
|
|
|
check-cast v1, Landroid/database/Cursor;
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
const/4 v2, 0x0
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
:try_start_2
|
|
const-string v3, "_size"
|
|
|
|
invoke-interface {v1, v3}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I
|
|
|
|
move-result v3
|
|
|
|
invoke-interface {v1}, Landroid/database/Cursor;->moveToFirst()Z
|
|
|
|
invoke-interface {v1, v3}, Landroid/database/Cursor;->getLong(I)J
|
|
|
|
move-result-wide v3
|
|
|
|
invoke-static {v3, v4}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object v1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
move-object v1, v2
|
|
|
|
:goto_0
|
|
if-eqz v1, :cond_1
|
|
|
|
invoke-virtual {v1}, 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 {v1}, Ljava/lang/Long;->longValue()J
|
|
|
|
move-result-wide v3
|
|
|
|
goto :goto_3
|
|
|
|
:cond_1
|
|
const-string v1, "r"
|
|
|
|
invoke-virtual {p1, p0, v1}, 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 v3
|
|
|
|
invoke-static {v3, v4}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object v1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_2
|
|
move-object v1, v2
|
|
|
|
:goto_1
|
|
if-eqz p1, :cond_3
|
|
|
|
invoke-virtual {p1}, Landroid/os/ParcelFileDescriptor;->close()V
|
|
|
|
:cond_3
|
|
if-eqz v1, :cond_4
|
|
|
|
invoke-virtual {v1}, Ljava/lang/Long;->longValue()J
|
|
|
|
move-result-wide v3
|
|
:try_end_2
|
|
.catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0
|
|
.catchall {:try_start_2 .. :try_end_2} :catchall_0
|
|
|
|
goto :goto_2
|
|
|
|
:cond_4
|
|
move-wide v3, v7
|
|
|
|
:goto_2
|
|
:try_start_3
|
|
invoke-static {v0, v2}, Lkotlin/d/a;->closeFinally(Ljava/io/Closeable;Ljava/lang/Throwable;)V
|
|
:try_end_3
|
|
.catch Ljava/lang/Exception; {:try_start_3 .. :try_end_3} :catch_0
|
|
|
|
return-wide v3
|
|
|
|
:catch_0
|
|
move-wide v3, v7
|
|
|
|
:goto_3
|
|
:try_start_4
|
|
invoke-static {v0, v2}, Lkotlin/d/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 v3
|
|
|
|
:catchall_0
|
|
move-exception p1
|
|
|
|
:try_start_5
|
|
throw p1
|
|
:try_end_5
|
|
.catchall {:try_start_5 .. :try_end_5} :catchall_1
|
|
|
|
:catchall_1
|
|
move-exception v1
|
|
|
|
:try_start_6
|
|
invoke-static {v0, p1}, Lkotlin/d/a;->closeFinally(Ljava/io/Closeable;Ljava/lang/Throwable;)V
|
|
|
|
throw v1
|
|
:try_end_6
|
|
.catch Ljava/lang/Exception; {:try_start_6 .. :try_end_6} :catch_1
|
|
|
|
:catch_1
|
|
move-exception p1
|
|
|
|
sget-object v0, Lcom/discord/app/AppLog;->vn: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/l;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "contentResolver"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/l;->checkParameterIsNotNull(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
|