package xyz.stream.api.database;

import androidx.room.RoomDatabase;
import java.util.HashMap;
import java.util.List;
import xyz.stream.api.database.entity.LiveHistory;
import xyz.stream.utils.f0;

/* JADX INFO: loaded from: classes3.dex */
public final /* synthetic */ class h implements Runnable {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f35816a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ l f35817b;

    public /* synthetic */ h(l lVar, int i10) {
        this.f35816a = i10;
        this.f35817b = lVar;
    }

    @Override // java.lang.Runnable
    public final void run() {
        int i10 = 2;
        int i11 = 0;
        int i12 = this.f35816a;
        int i13 = 1;
        l lVar = this.f35817b;
        switch (i12) {
            case 0:
                List listF = ((com.bumptech.glide.load.engine.p) lVar.f35829b).f(f0.o().q("flutter.selectRoles", ""));
                xyz.stream.api.o.f().getClass();
                if (!xyz.stream.api.o.D()) {
                    xyz.stream.api.o oVarF = xyz.stream.api.o.f();
                    k kVar = new k(lVar, listF, i11);
                    oVarF.getClass();
                    if (xyz.stream.api.o.D()) {
                        kVar.onSuccess(null);
                    } else {
                        HashMap map = new HashMap();
                        map.put("role_id", f0.o().q("flutter.selectRoles", ""));
                        xyz.stream.api.o.g("user/live_channel/history", oVarF.n(), map, new xyz.stream.api.m(oVarF, kVar, "user/live_channel/history", map, 9));
                    }
                    break;
                }
                break;
            case 1:
                List list = (List) androidx.room.util.b.b((RoomDatabase) ((com.bumptech.glide.load.engine.p) lVar.f35829b).f5756a, true, false, new h3.b(f0.o().q("flutter.selectRoles", ""), i10));
                xyz.stream.api.o.f().getClass();
                if (!xyz.stream.api.o.D()) {
                    xyz.stream.api.o oVarF2 = xyz.stream.api.o.f();
                    k kVar2 = new k(lVar, list, i13);
                    oVarF2.getClass();
                    if (xyz.stream.api.o.D()) {
                        kVar2.onSuccess(null);
                    } else {
                        HashMap map2 = new HashMap();
                        map2.put("role_id", f0.o().q("flutter.selectRoles", ""));
                        xyz.stream.api.o.g("user/live_channel/favorite", oVarF2.n(), map2, new xyz.stream.api.m(oVarF2, kVar2, "user/live_channel/favorite", map2, 10));
                    }
                    break;
                }
                break;
            default:
                List<LiveHistory> listF2 = ((com.bumptech.glide.load.engine.p) lVar.f35829b).f(f0.o().q("flutter.selectRoles", ""));
                if (listF2 != null && !listF2.isEmpty()) {
                    xyz.stream.api.o.f().d(true, null);
                    for (LiveHistory liveHistory : listF2) {
                        com.bumptech.glide.load.engine.p pVar = (com.bumptech.glide.load.engine.p) lVar.f35829b;
                        androidx.room.util.b.b((RoomDatabase) pVar.f5756a, false, true, new vf.n(pVar, liveHistory, 2));
                    }
                    break;
                }
                break;
        }
    }
}
