package com.strmr.ps.ui.contextmenu;

import android.widget.Toast;
import com.strmr.ps.data.model.ContentItem;
import com.strmr.ps.ui.contextmenu.a;
import defpackage.ak1;
import defpackage.ck1;
import defpackage.cr4;
import defpackage.e6a;
import defpackage.gr3;
import defpackage.ir3;
import defpackage.s38;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0002\u001a\u00020\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0002\u0010\u0003"}, d2 = {"Lak1;", "Le6a;", "<anonymous>", "(Lak1;)V"}, k = 3, mv = {2, 0, 0})
@DebugMetadata(c = "com.strmr.ps.ui.contextmenu.ContextMenuActionHandler$executeAction$2$1", f = "ContextMenuActionHandler.kt", i = {}, l = {}, m = "invokeSuspend", n = {}, s = {})
final class c extends SuspendLambda implements gr3<ak1, Continuation<? super e6a>, Object> {
    public final /* synthetic */ boolean a;
    public final /* synthetic */ k b;
    public final /* synthetic */ a c;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public c(boolean z, k kVar, a aVar, Continuation continuation) {
        super(2, continuation);
        this.a = z;
        this.b = kVar;
        this.c = aVar;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Continuation create(Object obj, Continuation continuation) {
        return new c(this.a, this.b, this.c, continuation);
    }

    @Override // defpackage.gr3
    public final Object invoke(Object obj, Object obj2) {
        c cVar = (c) create((ak1) obj, (Continuation) obj2);
        e6a e6aVar = e6a.a;
        cVar.invokeSuspend(e6aVar);
        return e6aVar;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Object invokeSuspend(Object obj) {
        k kVar = this.b;
        h hVar = kVar.a;
        ck1 ck1Var = ck1.a;
        s38.b(obj);
        boolean z = this.a;
        a aVar = this.c;
        if (z) {
            ir3 ir3Var = hVar.e;
            ContentItem contentItem = kVar.b;
            cr4.g(aVar, "action");
            boolean z2 = aVar instanceof a.k;
            Toast.makeText(hVar.a, z2 ? "Marked as watched" : aVar instanceof a.j ? "Marked as unwatched" : aVar instanceof a.i ? "Episode marked as watched" : aVar instanceof a.h ? "Episode marked as unwatched" : aVar instanceof a.C0109a ? "Added to collection" : aVar instanceof a.q ? "Removed from collection" : aVar instanceof a.c ? "Added to watchlist" : aVar instanceof a.t ? "Removed from watchlist" : aVar instanceof a.r ? "Removed from Continue Watching" : aVar instanceof a.b ? "Added to list" : aVar instanceof a.s ? "Removed from list" : aVar instanceof a.g ? "All episodes marked as watched" : aVar instanceof a.f ? "All episodes marked as unwatched" : aVar instanceof a.e ? "Show dropped" : aVar instanceof a.ab ? "Show undropped" : "Done", 0).show();
            if (z2 || (aVar instanceof a.g)) {
                if (ir3Var != null) {
                    ir3Var.invoke(Integer.valueOf(contentItem.getTmdbId()), contentItem.getItemType(), Boolean.TRUE);
                }
            } else if (((aVar instanceof a.j) || (aVar instanceof a.f)) && ir3Var != null) {
                ir3Var.invoke(Integer.valueOf(contentItem.getTmdbId()), contentItem.getItemType(), Boolean.FALSE);
            }
        } else {
            cr4.g(aVar, "action");
            Toast.makeText(hVar.a, "Trakt is unavailable. Please try again later.", 0).show();
        }
        return e6a.a;
    }
}
