53 lines
2.7 KiB
Java
53 lines
2.7 KiB
Java
|
package com.discord.utilities.rest;
|
||
|
|
||
|
import android.content.ContentResolver;
|
||
|
import android.graphics.Bitmap;
|
||
|
import com.discord.restapi.utils.CountingRequestBody;
|
||
|
import com.discord.utilities.attachments.AttachmentUtilsKt;
|
||
|
import com.discord.utilities.rest.SendUtils;
|
||
|
import com.lytefast.flexinput.model.Attachment;
|
||
|
import d0.z.d.m;
|
||
|
import d0.z.d.o;
|
||
|
import kotlin.jvm.functions.Function3;
|
||
|
import okhttp3.MultipartBody;
|
||
|
import okhttp3.RequestBody;
|
||
|
import rx.Emitter;
|
||
|
import rx.functions.Action1;
|
||
|
/* compiled from: SendUtils.kt */
|
||
|
public final class SendUtils$getPart$1<T> implements Action1<Emitter<SendUtils.FileUpload>> {
|
||
|
public final /* synthetic */ ContentResolver $contentResolver;
|
||
|
public final /* synthetic */ String $name;
|
||
|
public final /* synthetic */ Attachment $this_getPart;
|
||
|
|
||
|
/* compiled from: SendUtils.kt */
|
||
|
/* renamed from: com.discord.utilities.rest.SendUtils$getPart$1$1 reason: invalid class name */
|
||
|
public static final class AnonymousClass1 extends o implements Function3<RequestBody, String, Bitmap.CompressFormat, SendUtils.FileUpload> {
|
||
|
public final /* synthetic */ SendUtils$getPart$1 this$0;
|
||
|
|
||
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
||
|
public AnonymousClass1(SendUtils$getPart$1 sendUtils$getPart$1) {
|
||
|
super(3);
|
||
|
this.this$0 = sendUtils$getPart$1;
|
||
|
}
|
||
|
|
||
|
public final SendUtils.FileUpload invoke(RequestBody requestBody, String str, Bitmap.CompressFormat compressFormat) {
|
||
|
m.checkNotNullParameter(requestBody, "requestBody");
|
||
|
m.checkNotNullParameter(str, "mimeType");
|
||
|
CountingRequestBody countingRequestBody = new CountingRequestBody(requestBody, 0);
|
||
|
String sanitizedFileName = AttachmentUtilsKt.getSanitizedFileName(this.this$0.$this_getPart.getDisplayName(), compressFormat);
|
||
|
return new SendUtils.FileUpload(sanitizedFileName, countingRequestBody.getEstimatedContentLength(), MultipartBody.Part.b(this.this$0.$name, sanitizedFileName, countingRequestBody), str, countingRequestBody.getBytesWrittenObservable());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public SendUtils$getPart$1(Attachment attachment, String str, ContentResolver contentResolver) {
|
||
|
this.$this_getPart = attachment;
|
||
|
this.$name = str;
|
||
|
this.$contentResolver = contentResolver;
|
||
|
}
|
||
|
|
||
|
public final void call(Emitter<SendUtils.FileUpload> emitter) {
|
||
|
emitter.onNext(new AnonymousClass1(this).invoke((RequestBody) new AttachmentRequestBody(this.$contentResolver, this.$this_getPart), AttachmentUtilsKt.getMimeType(this.$this_getPart, this.$contentResolver), (Bitmap.CompressFormat) null));
|
||
|
emitter.onCompleted();
|
||
|
}
|
||
|
}
|