2020-05-17 12:40:10 +00:00
|
|
|
.class public final Lcom/discord/utilities/rest/AttachmentRequestBody;
|
|
|
|
.super Lokhttp3/RequestBody;
|
|
|
|
.source "AttachmentRequestBody.kt"
|
|
|
|
|
|
|
|
|
|
|
|
# instance fields
|
|
|
|
.field public final attachment:Lcom/lytefast/flexinput/model/Attachment;
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
|
|
value = {
|
|
|
|
"Lcom/lytefast/flexinput/model/Attachment<",
|
|
|
|
"*>;"
|
|
|
|
}
|
|
|
|
.end annotation
|
|
|
|
.end field
|
|
|
|
|
|
|
|
.field public final contentResolver:Landroid/content/ContentResolver;
|
|
|
|
|
|
|
|
.field public final size:J
|
|
|
|
|
|
|
|
|
|
|
|
# direct methods
|
|
|
|
.method public constructor <init>(Landroid/content/ContentResolver;Lcom/lytefast/flexinput/model/Attachment;)V
|
|
|
|
.locals 1
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
|
|
value = {
|
|
|
|
"(",
|
|
|
|
"Landroid/content/ContentResolver;",
|
|
|
|
"Lcom/lytefast/flexinput/model/Attachment<",
|
|
|
|
"*>;)V"
|
|
|
|
}
|
|
|
|
.end annotation
|
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
const/4 v0, 0x0
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
if-eqz p1, :cond_3
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
if-eqz p2, :cond_2
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
invoke-direct {p0}, Lokhttp3/RequestBody;-><init>()V
|
|
|
|
|
|
|
|
iput-object p1, p0, Lcom/discord/utilities/rest/AttachmentRequestBody;->contentResolver:Landroid/content/ContentResolver;
|
|
|
|
|
|
|
|
iput-object p2, p0, Lcom/discord/utilities/rest/AttachmentRequestBody;->attachment:Lcom/lytefast/flexinput/model/Attachment;
|
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
invoke-virtual {p2}, Lcom/lytefast/flexinput/model/Attachment;->getData()Ljava/lang/Object;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
move-result-object p1
|
|
|
|
|
|
|
|
instance-of p2, p1, Ljava/io/File;
|
|
|
|
|
|
|
|
if-nez p2, :cond_0
|
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
goto :goto_0
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
:cond_0
|
2020-09-16 21:45:36 +00:00
|
|
|
move-object v0, p1
|
2020-09-08 08:16:32 +00:00
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
:goto_0
|
|
|
|
check-cast v0, Ljava/io/File;
|
2020-07-08 16:44:49 +00:00
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
if-eqz v0, :cond_1
|
|
|
|
|
|
|
|
invoke-virtual {v0}, Ljava/io/File;->length()J
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
move-result-wide p1
|
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
goto :goto_1
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
:cond_1
|
|
|
|
iget-object p1, p0, Lcom/discord/utilities/rest/AttachmentRequestBody;->attachment:Lcom/lytefast/flexinput/model/Attachment;
|
|
|
|
|
|
|
|
invoke-virtual {p1}, Lcom/lytefast/flexinput/model/Attachment;->getUri()Landroid/net/Uri;
|
|
|
|
|
|
|
|
move-result-object p1
|
|
|
|
|
|
|
|
iget-object p2, p0, Lcom/discord/utilities/rest/AttachmentRequestBody;->contentResolver:Landroid/content/ContentResolver;
|
|
|
|
|
|
|
|
invoke-static {p1, p2}, Lcom/discord/utilities/rest/SendUtilsKt;->computeFileSizeBytes(Landroid/net/Uri;Landroid/content/ContentResolver;)J
|
|
|
|
|
|
|
|
move-result-wide p1
|
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
:goto_1
|
2020-05-17 12:40:10 +00:00
|
|
|
iput-wide p1, p0, Lcom/discord/utilities/rest/AttachmentRequestBody;->size:J
|
|
|
|
|
|
|
|
return-void
|
2020-09-16 21:45:36 +00:00
|
|
|
|
|
|
|
:cond_2
|
|
|
|
const-string p1, "attachment"
|
|
|
|
|
|
|
|
invoke-static {p1}, Lk0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw v0
|
|
|
|
|
|
|
|
:cond_3
|
|
|
|
const-string p1, "contentResolver"
|
|
|
|
|
|
|
|
invoke-static {p1}, Lk0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw v0
|
2020-05-17 12:40:10 +00:00
|
|
|
.end method
|
|
|
|
|
|
|
|
|
|
|
|
# virtual methods
|
|
|
|
.method public contentLength()J
|
|
|
|
.locals 2
|
|
|
|
|
|
|
|
iget-wide v0, p0, Lcom/discord/utilities/rest/AttachmentRequestBody;->size:J
|
|
|
|
|
|
|
|
return-wide v0
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public contentType()Lokhttp3/MediaType;
|
2020-07-08 16:44:49 +00:00
|
|
|
.locals 2
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
sget-object v0, Lokhttp3/MediaType;->g:Lokhttp3/MediaType$a;
|
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
iget-object v0, p0, Lcom/discord/utilities/rest/AttachmentRequestBody;->attachment:Lcom/lytefast/flexinput/model/Attachment;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
iget-object v1, p0, Lcom/discord/utilities/rest/AttachmentRequestBody;->contentResolver:Landroid/content/ContentResolver;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
invoke-static {v0, v1}, Lcom/discord/utilities/attachments/AttachmentUtilsKt;->getMimeType(Lcom/lytefast/flexinput/model/Attachment;Landroid/content/ContentResolver;)Ljava/lang/String;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
move-result-object v0
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
invoke-static {v0}, Lokhttp3/MediaType$a;->b(Ljava/lang/String;)Lokhttp3/MediaType;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
|
|
|
return-object v0
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public writeTo(Lokio/BufferedSink;)V
|
2020-09-16 21:45:36 +00:00
|
|
|
.locals 4
|
2020-05-17 12:40:10 +00:00
|
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
|
|
value = {
|
|
|
|
Ljava/io/IOException;
|
|
|
|
}
|
|
|
|
.end annotation
|
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
const/4 v0, 0x0
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
if-eqz p1, :cond_1
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
:try_start_0
|
2020-09-16 21:45:36 +00:00
|
|
|
iget-object v1, p0, Lcom/discord/utilities/rest/AttachmentRequestBody;->contentResolver:Landroid/content/ContentResolver;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
iget-object v2, p0, Lcom/discord/utilities/rest/AttachmentRequestBody;->attachment:Lcom/lytefast/flexinput/model/Attachment;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
invoke-virtual {v2}, Lcom/lytefast/flexinput/model/Attachment;->getUri()Landroid/net/Uri;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
move-result-object v2
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
invoke-virtual {v1, v2}, Landroid/content/ContentResolver;->openInputStream(Landroid/net/Uri;)Ljava/io/InputStream;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
move-result-object v1
|
2020-05-17 12:40:10 +00:00
|
|
|
:try_end_0
|
|
|
|
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
if-eqz v1, :cond_0
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
:try_start_1
|
2020-09-16 21:45:36 +00:00
|
|
|
const-string v2, "inputStream"
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
invoke-static {v1, v2}, Lk0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
invoke-static {v1}, Lf/n/a/k/a;->X(Ljava/io/InputStream;)Lp0/w;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
move-result-object v2
|
2020-05-17 12:40:10 +00:00
|
|
|
:try_end_1
|
|
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_2
|
|
|
|
|
|
|
|
:try_start_2
|
2020-09-16 21:45:36 +00:00
|
|
|
invoke-interface {p1, v2}, Lokio/BufferedSink;->i0(Lp0/w;)J
|
2020-05-17 12:40:10 +00:00
|
|
|
:try_end_2
|
|
|
|
.catchall {:try_start_2 .. :try_end_2} :catchall_0
|
|
|
|
|
|
|
|
:try_start_3
|
2020-09-16 21:45:36 +00:00
|
|
|
invoke-static {v2, v0}, Lf/n/a/k/a;->closeFinally(Ljava/io/Closeable;Ljava/lang/Throwable;)V
|
2020-05-17 12:40:10 +00:00
|
|
|
:try_end_3
|
|
|
|
.catchall {:try_start_3 .. :try_end_3} :catchall_2
|
|
|
|
|
|
|
|
:try_start_4
|
2020-09-16 21:45:36 +00:00
|
|
|
invoke-static {v1, v0}, Lf/n/a/k/a;->closeFinally(Ljava/io/Closeable;Ljava/lang/Throwable;)V
|
2020-05-17 12:40:10 +00:00
|
|
|
:try_end_4
|
|
|
|
.catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_0
|
|
|
|
|
|
|
|
goto :goto_0
|
|
|
|
|
|
|
|
:catchall_0
|
|
|
|
move-exception p1
|
|
|
|
|
|
|
|
:try_start_5
|
|
|
|
throw p1
|
|
|
|
:try_end_5
|
|
|
|
.catchall {:try_start_5 .. :try_end_5} :catchall_1
|
|
|
|
|
|
|
|
:catchall_1
|
2020-09-16 21:45:36 +00:00
|
|
|
move-exception v3
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
:try_start_6
|
2020-09-16 21:45:36 +00:00
|
|
|
invoke-static {v2, p1}, Lf/n/a/k/a;->closeFinally(Ljava/io/Closeable;Ljava/lang/Throwable;)V
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
throw v3
|
2020-05-17 12:40:10 +00:00
|
|
|
:try_end_6
|
|
|
|
.catchall {:try_start_6 .. :try_end_6} :catchall_2
|
|
|
|
|
|
|
|
:catchall_2
|
|
|
|
move-exception p1
|
|
|
|
|
|
|
|
:try_start_7
|
|
|
|
throw p1
|
|
|
|
:try_end_7
|
|
|
|
.catchall {:try_start_7 .. :try_end_7} :catchall_3
|
|
|
|
|
|
|
|
:catchall_3
|
2020-09-16 21:45:36 +00:00
|
|
|
move-exception v2
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
:try_start_8
|
2020-09-16 21:45:36 +00:00
|
|
|
invoke-static {v1, p1}, Lf/n/a/k/a;->closeFinally(Ljava/io/Closeable;Ljava/lang/Throwable;)V
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
throw v2
|
2020-05-17 12:40:10 +00:00
|
|
|
:try_end_8
|
|
|
|
.catch Ljava/io/IOException; {:try_start_8 .. :try_end_8} :catch_0
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
:goto_0
|
|
|
|
return-void
|
|
|
|
|
|
|
|
:catch_0
|
|
|
|
move-exception p1
|
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
sget-object v1, Lcom/discord/app/AppLog;->d:Lcom/discord/app/AppLog;
|
|
|
|
|
|
|
|
const/4 v2, 0x4
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
const-string v3, "Could not write to sink"
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-09-16 21:45:36 +00:00
|
|
|
invoke-virtual {v1, v3, v2, p1, v0}, Lcom/discord/app/AppLog;->c(Ljava/lang/String;ILjava/lang/Throwable;Ljava/util/Map;)V
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
throw p1
|
2020-09-16 21:45:36 +00:00
|
|
|
|
|
|
|
:cond_1
|
|
|
|
const-string p1, "sink"
|
|
|
|
|
|
|
|
invoke-static {p1}, Lk0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw v0
|
2020-05-17 12:40:10 +00:00
|
|
|
.end method
|