package o;

import android.content.Context;
import android.content.SharedPreferences;
import java.io.IOException;
import java.util.Iterator;
import java.util.Set;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.ep, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C1134ep extends Sb0 implements OC {
    public final /* synthetic */ int p;
    public int q;
    public final /* synthetic */ Object r;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public /* synthetic */ C1134ep(Object obj, InterfaceC0220Im interfaceC0220Im, int i) {
        super(1, interfaceC0220Im);
        this.p = i;
        this.r = obj;
    }

    @Override // o.OC
    public final Object g(Object obj) {
        InterfaceC0220Im interfaceC0220Im = (InterfaceC0220Im) obj;
        switch (this.p) {
            case 0:
                return new C1134ep((C1743l80) this.r, interfaceC0220Im, 0).n(Oh0.a);
            default:
                return new C1134ep((C3036yp) this.r, interfaceC0220Im, 1).n(Oh0.a);
        }
    }

    @Override // o.AbstractC0728ad
    public final Object n(Object obj) throws IOException {
        Context context;
        String str;
        switch (this.p) {
            case 0:
                int i = this.q;
                Oh0 oh0 = Oh0.a;
                if (i != 0) {
                    if (i != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    IJ.H(obj);
                    return oh0;
                }
                IJ.H(obj);
                C1743l80 c1743l80 = (C1743l80) this.r;
                this.q = 1;
                SharedPreferences.Editor editorEdit = ((SharedPreferences) c1743l80.e.getValue()).edit();
                Set set = c1743l80.f;
                if (set == null) {
                    editorEdit.clear();
                } else {
                    Iterator it = set.iterator();
                    while (it.hasNext()) {
                        editorEdit.remove((String) it.next());
                    }
                }
                if (!editorEdit.commit()) {
                    throw new IOException("Unable to delete migrated keys from SharedPreferences.");
                }
                if (((SharedPreferences) c1743l80.e.getValue()).getAll().isEmpty() && (context = c1743l80.c) != null && (str = c1743l80.d) != null) {
                    AbstractC1553j80.a(context, str);
                }
                if (set != null) {
                    set.clear();
                }
                EnumC0091Dn enumC0091Dn = EnumC0091Dn.l;
                return oh0 == enumC0091Dn ? enumC0091Dn : oh0;
            default:
                int i2 = this.q;
                if (i2 != 0) {
                    if (i2 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    IJ.H(obj);
                    return obj;
                }
                IJ.H(obj);
                C3036yp c3036yp = (C3036yp) this.r;
                this.q = 1;
                Object objG = c3036yp.g(this);
                EnumC0091Dn enumC0091Dn2 = EnumC0091Dn.l;
                return objG == enumC0091Dn2 ? enumC0091Dn2 : objG;
        }
    }
}
