discord-jadx/app/src/main/java/com/discord/utilities/colors/RepresentativeColors$handle...

114 lines
5.7 KiB
Java

package com.discord.utilities.colors;
import android.graphics.Bitmap;
import com.discord.app.AppLog;
import com.discord.models.domain.ModelAuditLogEntry;
import com.discord.utilities.colors.RepresentativeColors;
import d0.l;
import d0.o;
import d0.t.h0;
import d0.w.h.c;
import d0.w.i.a.b;
import d0.w.i.a.e;
import d0.w.i.a.k;
import d0.z.d.m;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Pair;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.CoroutineScope;
/* compiled from: RepresentativeColors.kt */
@e(c = "com.discord.utilities.colors.RepresentativeColors$handleBitmap$1", f = "RepresentativeColors.kt", l = {59}, m = "invokeSuspend")
public final class RepresentativeColors$handleBitmap$1 extends k implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
public final /* synthetic */ Bitmap $bitmap;
public final /* synthetic */ Object $id;
public final /* synthetic */ String $url;
public int label;
public final /* synthetic */ RepresentativeColors this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public RepresentativeColors$handleBitmap$1(RepresentativeColors representativeColors, Object obj, Bitmap bitmap, String str, Continuation continuation) {
super(2, continuation);
this.this$0 = representativeColors;
this.$id = obj;
this.$bitmap = bitmap;
this.$url = str;
}
@Override // d0.w.i.a.a
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
m.checkNotNullParameter(continuation, "completion");
return new RepresentativeColors$handleBitmap$1(this.this$0, this.$id, this.$bitmap, this.$url, continuation);
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
return ((RepresentativeColors$handleBitmap$1) create(coroutineScope, continuation)).invokeSuspend(Unit.a);
}
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x00ba: APUT
(r4v1 kotlin.Pair[])
(3 ??[int, float, short, byte, char])
(wrap: kotlin.Pair : 0x00b6: INVOKE (r3v7 kotlin.Pair) = ("url"), (r3v6 java.lang.String) type: STATIC call: d0.o.to(java.lang.Object, java.lang.Object):kotlin.Pair)
*/
@Override // d0.w.i.a.a
public final Object invokeSuspend(Object obj) {
int i;
int i2;
Object coroutine_suspended = c.getCOROUTINE_SUSPENDED();
int i3 = this.label;
if (i3 == 0) {
l.throwOnFailure(obj);
if (RepresentativeColors.access$getRepresentativeColors$p(this.this$0).containsKey(this.$id)) {
return Unit.a;
}
if (this.$bitmap.isRecycled()) {
i = RepresentativeColors.access$getBLURPLE$cp();
RepresentativeColors.access$getRepresentativeColors$p(this.this$0).put(this.$id, b.boxInt(i));
RepresentativeColors.access$getRepresentativeColorsSubject$p(this.this$0).onNext(RepresentativeColors.access$getRepresentativeColors$p(this.this$0));
return Unit.a;
}
Bitmap copy = this.$bitmap.copy(Bitmap.Config.ARGB_8888, false);
RepresentativeColors representativeColors = this.this$0;
m.checkNotNullExpressionValue(copy, "copiedBitmap");
this.label = 1;
obj = representativeColors.getRepresentativeColorAsync(copy, this);
if (obj == coroutine_suspended) {
return coroutine_suspended;
}
} else if (i3 == 1) {
l.throwOnFailure(obj);
} else {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
RepresentativeColors.RepresentativeColorResult representativeColorResult = (RepresentativeColors.RepresentativeColorResult) obj;
if (representativeColorResult instanceof RepresentativeColors.RepresentativeColorResult.Success) {
i2 = ((RepresentativeColors.RepresentativeColorResult.Success) representativeColorResult).getColor();
} else if (representativeColorResult instanceof RepresentativeColors.RepresentativeColorResult.Failure) {
i2 = RepresentativeColors.access$getBLURPLE$cp();
} else {
throw new NoWhenBranchMatchedException();
}
if (representativeColorResult instanceof RepresentativeColors.RepresentativeColorResult.Failure) {
AppLog appLog = AppLog.g;
Exception exception = ((RepresentativeColors.RepresentativeColorResult.Failure) representativeColorResult).getException();
Pair[] pairArr = new Pair[4];
pairArr[0] = o.to(ModelAuditLogEntry.CHANGE_KEY_ID, String.valueOf(this.$id));
pairArr[1] = o.to("bitmapWidth", String.valueOf(this.$bitmap.getWidth()));
pairArr[2] = o.to("bitmapHeight", String.valueOf(this.$bitmap.getHeight()));
String str = this.$url;
if (str == null) {
str = "not provided";
}
pairArr[3] = o.to("url", str);
appLog.e("Failed to get representative color for entity", exception, h0.mapOf(pairArr));
}
i = i2;
RepresentativeColors.access$getRepresentativeColors$p(this.this$0).put(this.$id, b.boxInt(i));
RepresentativeColors.access$getRepresentativeColorsSubject$p(this.this$0).onNext(RepresentativeColors.access$getRepresentativeColors$p(this.this$0));
return Unit.a;
}
}