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

86 lines
4.2 KiB
Java

package com.discord.utilities.colors;
import android.graphics.Bitmap;
import com.discord.app.AppLog;
import com.discord.utilities.colors.RepresentativeColors;
import d0.l;
import d0.o;
import d0.t.g0;
import d0.w.g.c;
import d0.w.h.a.b;
import d0.w.h.a.e;
import d0.w.h.a.k;
import d0.z.d.m;
import kotlin.NoWhenBranchMatchedException;
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 = {51}, 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 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, Continuation continuation) {
super(2, continuation);
this.this$0 = representativeColors;
this.$id = obj;
this.$bitmap = bitmap;
}
@Override // d0.w.h.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, 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);
}
@Override // d0.w.h.a.a
public final Object invokeSuspend(Object obj) {
int i;
Object coroutine_suspended = c.getCOROUTINE_SUSPENDED();
int i2 = this.label;
if (i2 == 0) {
l.throwOnFailure(obj);
if (RepresentativeColors.access$getRepresentativeColors$p(this.this$0).containsKey(this.$id)) {
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 (i2 == 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) {
i = ((RepresentativeColors.RepresentativeColorResult.Success) representativeColorResult).getColor();
} else if (representativeColorResult instanceof RepresentativeColors.RepresentativeColorResult.Failure) {
i = RepresentativeColors.access$getBLURPLE$cp();
} else {
throw new NoWhenBranchMatchedException();
}
if (representativeColorResult instanceof RepresentativeColors.RepresentativeColorResult.Failure) {
AppLog.g.e("Failed to get representative color for entity", ((RepresentativeColors.RepresentativeColorResult.Failure) representativeColorResult).getException(), g0.mapOf(o.to("id", String.valueOf(this.$id))));
}
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;
}
}