375 lines
10 KiB
Smali
375 lines
10 KiB
Smali
.class public final Lcom/discord/utilities/attachments/AttachmentUtilsKt;
|
|
.super Ljava/lang/Object;
|
|
.source "AttachmentUtils.kt"
|
|
|
|
|
|
# static fields
|
|
.field static final synthetic $$delegatedProperties:[Lkotlin/reflect/KProperty;
|
|
|
|
.field private static final REGEX_FILE_NAME_PATTERN$delegate:Lkotlin/Lazy;
|
|
|
|
|
|
# direct methods
|
|
.method static constructor <clinit>()V
|
|
.locals 5
|
|
|
|
const/4 v0, 0x1
|
|
|
|
new-array v0, v0, [Lkotlin/reflect/KProperty;
|
|
|
|
new-instance v1, Lkotlin/jvm/internal/r;
|
|
|
|
const-class v2, Lcom/discord/utilities/attachments/AttachmentUtilsKt;
|
|
|
|
const-string v3, "app_productionExternalRelease"
|
|
|
|
invoke-static {v2, v3}, Lkotlin/jvm/internal/u;->f(Ljava/lang/Class;Ljava/lang/String;)Lkotlin/reflect/KDeclarationContainer;
|
|
|
|
move-result-object v2
|
|
|
|
const-string v3, "REGEX_FILE_NAME_PATTERN"
|
|
|
|
const-string v4, "getREGEX_FILE_NAME_PATTERN()Ljava/util/regex/Pattern;"
|
|
|
|
invoke-direct {v1, v2, v3, v4}, Lkotlin/jvm/internal/r;-><init>(Lkotlin/reflect/KDeclarationContainer;Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
invoke-static {v1}, Lkotlin/jvm/internal/u;->a(Lkotlin/jvm/internal/q;)Lkotlin/reflect/e;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Lkotlin/reflect/KProperty;
|
|
|
|
const/4 v2, 0x0
|
|
|
|
aput-object v1, v0, v2
|
|
|
|
sput-object v0, Lcom/discord/utilities/attachments/AttachmentUtilsKt;->$$delegatedProperties:[Lkotlin/reflect/KProperty;
|
|
|
|
sget-object v0, Lcom/discord/utilities/attachments/AttachmentUtilsKt$REGEX_FILE_NAME_PATTERN$2;->INSTANCE:Lcom/discord/utilities/attachments/AttachmentUtilsKt$REGEX_FILE_NAME_PATTERN$2;
|
|
|
|
check-cast v0, Lkotlin/jvm/functions/Function0;
|
|
|
|
invoke-static {v0}, Lkotlin/f;->b(Lkotlin/jvm/functions/Function0;)Lkotlin/Lazy;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lcom/discord/utilities/attachments/AttachmentUtilsKt;->REGEX_FILE_NAME_PATTERN$delegate:Lkotlin/Lazy;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static final synthetic access$getREGEX_FILE_NAME_PATTERN$p()Ljava/util/regex/Pattern;
|
|
.locals 1
|
|
|
|
invoke-static {}, Lcom/discord/utilities/attachments/AttachmentUtilsKt;->getREGEX_FILE_NAME_PATTERN()Ljava/util/regex/Pattern;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static final createFormData(Lcom/lytefast/flexinput/model/Attachment;Ljava/lang/String;Lokhttp3/RequestBody;Landroid/graphics/Bitmap$CompressFormat;)Lokhttp3/MultipartBody$Part;
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/lytefast/flexinput/model/Attachment<",
|
|
"*>;",
|
|
"Ljava/lang/String;",
|
|
"Lokhttp3/RequestBody;",
|
|
"Landroid/graphics/Bitmap$CompressFormat;",
|
|
")",
|
|
"Lokhttp3/MultipartBody$Part;"
|
|
}
|
|
.end annotation
|
|
|
|
const-string v0, "receiver$0"
|
|
|
|
invoke-static {p0, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "name"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "requestBody"
|
|
|
|
invoke-static {p2, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
if-nez p3, :cond_0
|
|
|
|
invoke-virtual {p0}, Lcom/lytefast/flexinput/model/Attachment;->getDisplayName()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
goto :goto_1
|
|
|
|
:cond_0
|
|
invoke-static {}, Lcom/discord/utilities/attachments/AttachmentUtilsKt;->getREGEX_FILE_NAME_PATTERN()Ljava/util/regex/Pattern;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p0}, Lcom/lytefast/flexinput/model/Attachment;->getDisplayName()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Ljava/lang/CharSequence;
|
|
|
|
invoke-virtual {v0, v1}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0}, Ljava/util/regex/Matcher;->matches()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
const/4 p0, 0x1
|
|
|
|
invoke-virtual {v0, p0}, Ljava/util/regex/Matcher;->group(I)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
invoke-virtual {p0}, Lcom/lytefast/flexinput/model/Attachment;->getDisplayName()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
:goto_0
|
|
invoke-static {p3}, Lcom/discord/utilities/attachments/AttachmentUtilsKt;->getExtension(Landroid/graphics/Bitmap$CompressFormat;)Ljava/lang/String;
|
|
|
|
move-result-object p3
|
|
|
|
new-instance v0, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const/16 p0, 0x2e
|
|
|
|
invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
:goto_1
|
|
invoke-static {p1, p0, p2}, Lokhttp3/MultipartBody$Part;->a(Ljava/lang/String;Ljava/lang/String;Lokhttp3/RequestBody;)Lokhttp3/MultipartBody$Part;
|
|
|
|
move-result-object p0
|
|
|
|
const-string p1, "MultipartBody.Part.creat\u2026e, fileName, requestBody)"
|
|
|
|
invoke-static {p0, p1}, Lkotlin/jvm/internal/j;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method private static final getExtension(Landroid/graphics/Bitmap$CompressFormat;)Ljava/lang/String;
|
|
.locals 1
|
|
|
|
sget-object v0, Lcom/discord/utilities/attachments/AttachmentUtilsKt$WhenMappings;->$EnumSwitchMapping$1:[I
|
|
|
|
invoke-virtual {p0}, Landroid/graphics/Bitmap$CompressFormat;->ordinal()I
|
|
|
|
move-result p0
|
|
|
|
aget p0, v0, p0
|
|
|
|
packed-switch p0, :pswitch_data_0
|
|
|
|
const-string p0, "jpg"
|
|
|
|
return-object p0
|
|
|
|
:pswitch_0
|
|
const-string p0, "jpg"
|
|
|
|
return-object p0
|
|
|
|
:pswitch_1
|
|
const-string p0, "webp"
|
|
|
|
return-object p0
|
|
|
|
:pswitch_2
|
|
const-string p0, "png"
|
|
|
|
return-object p0
|
|
|
|
nop
|
|
|
|
:pswitch_data_0
|
|
.packed-switch 0x1
|
|
:pswitch_2
|
|
:pswitch_1
|
|
:pswitch_0
|
|
.end packed-switch
|
|
.end method
|
|
|
|
.method public static final getMimeType(Landroid/content/ContentResolver;Landroid/net/Uri;Ljava/lang/String;)Ljava/lang/String;
|
|
.locals 1
|
|
|
|
const-string v0, "uri"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p0, :cond_0
|
|
|
|
invoke-virtual {p0, p1}, Landroid/content/ContentResolver;->getType(Landroid/net/Uri;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
move-object p0, v0
|
|
|
|
:goto_0
|
|
if-eqz p0, :cond_1
|
|
|
|
return-object p0
|
|
|
|
:cond_1
|
|
sget-object p0, Lcom/discord/utilities/attachments/AttachmentUtilsKt$getMimeType$1;->INSTANCE:Lcom/discord/utilities/attachments/AttachmentUtilsKt$getMimeType$1;
|
|
|
|
:try_start_0
|
|
invoke-static {p1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p0, p1}, Lcom/discord/utilities/attachments/AttachmentUtilsKt$getMimeType$1;->invoke(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
if-nez p1, :cond_2
|
|
|
|
invoke-static {p2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p0, p1}, Lcom/discord/utilities/attachments/AttachmentUtilsKt$getMimeType$1;->invoke(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
move-object v0, p0
|
|
|
|
goto :goto_1
|
|
|
|
:cond_2
|
|
move-object v0, p1
|
|
|
|
:catch_0
|
|
:goto_1
|
|
if-nez v0, :cond_3
|
|
|
|
const-string v0, "application/octet-stream"
|
|
|
|
:cond_3
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static final getMimeType(Lcom/lytefast/flexinput/model/Attachment;Landroid/content/ContentResolver;)Ljava/lang/String;
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/lytefast/flexinput/model/Attachment<",
|
|
"*>;",
|
|
"Landroid/content/ContentResolver;",
|
|
")",
|
|
"Ljava/lang/String;"
|
|
}
|
|
.end annotation
|
|
|
|
const-string v0, "receiver$0"
|
|
|
|
invoke-static {p0, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p0}, Lcom/lytefast/flexinput/model/Attachment;->getData()Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
instance-of v1, v0, Landroidx/core/view/inputmethod/InputContentInfoCompat;
|
|
|
|
const/4 v2, 0x0
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
move-object v0, v2
|
|
|
|
:cond_0
|
|
check-cast v0, Landroidx/core/view/inputmethod/InputContentInfoCompat;
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
invoke-virtual {v0}, Landroidx/core/view/inputmethod/InputContentInfoCompat;->getDescription()Landroid/content/ClipDescription;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-virtual {v0, v1}, Landroid/content/ClipDescription;->getMimeType(I)Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
:cond_1
|
|
if-nez v2, :cond_2
|
|
|
|
invoke-virtual {p0}, Lcom/lytefast/flexinput/model/Attachment;->getUri()Landroid/net/Uri;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p0}, Lcom/lytefast/flexinput/model/Attachment;->getDisplayName()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p1, v0, p0}, Lcom/discord/utilities/attachments/AttachmentUtilsKt;->getMimeType(Landroid/content/ContentResolver;Landroid/net/Uri;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
:cond_2
|
|
return-object v2
|
|
.end method
|
|
|
|
.method public static synthetic getMimeType$default(Landroid/content/ContentResolver;Landroid/net/Uri;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
|
|
.locals 0
|
|
|
|
and-int/lit8 p3, p3, 0x4
|
|
|
|
if-eqz p3, :cond_0
|
|
|
|
const/4 p2, 0x0
|
|
|
|
:cond_0
|
|
invoke-static {p0, p1, p2}, Lcom/discord/utilities/attachments/AttachmentUtilsKt;->getMimeType(Landroid/content/ContentResolver;Landroid/net/Uri;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method private static final getREGEX_FILE_NAME_PATTERN()Ljava/util/regex/Pattern;
|
|
.locals 1
|
|
|
|
sget-object v0, Lcom/discord/utilities/attachments/AttachmentUtilsKt;->REGEX_FILE_NAME_PATTERN$delegate:Lkotlin/Lazy;
|
|
|
|
invoke-interface {v0}, Lkotlin/Lazy;->getValue()Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Ljava/util/regex/Pattern;
|
|
|
|
return-object v0
|
|
.end method
|