package o;

import android.content.SharedPreferences;
import android.webkit.WebView;
import android.widget.Toast;
import ir.devixor.app.activity.WebViewActivity;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class Uk0 extends Sb0 implements SC {
    public final /* synthetic */ int p;
    public int q;
    public final /* synthetic */ WebViewActivity r;

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

    @Override // o.SC
    public final Object f(Object obj, Object obj2) {
        InterfaceC0065Cn interfaceC0065Cn = (InterfaceC0065Cn) obj;
        InterfaceC0220Im interfaceC0220Im = (InterfaceC0220Im) obj2;
        switch (this.p) {
        }
        return ((Uk0) l(interfaceC0065Cn, interfaceC0220Im)).n(Oh0.a);
    }

    @Override // o.AbstractC0728ad
    public final InterfaceC0220Im l(Object obj, InterfaceC0220Im interfaceC0220Im) {
        switch (this.p) {
            case 0:
                return new Uk0(this.r, interfaceC0220Im, 0);
            case 1:
                return new Uk0(this.r, interfaceC0220Im, 1);
            case 2:
                return new Uk0(this.r, interfaceC0220Im, 2);
            default:
                return new Uk0(this.r, interfaceC0220Im, 3);
        }
    }

    @Override // o.AbstractC0728ad
    public final Object n(Object obj) {
        WebView webView;
        WebView webView2;
        WebView webView3;
        switch (this.p) {
            case 0:
                int i = this.q;
                WebViewActivity webViewActivity = this.r;
                if (i == 0) {
                    IJ.H(obj);
                    this.q = 1;
                    obj = WebViewActivity.f(webViewActivity, this);
                    EnumC0091Dn enumC0091Dn = EnumC0091Dn.l;
                    if (obj == enumC0091Dn) {
                        return enumC0091Dn;
                    }
                } else {
                    if (i != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    IJ.H(obj);
                }
                String str = (String) obj;
                if (!Za0.Y(str)) {
                    WebView webView4 = webViewActivity.m;
                    if (webView4 == null) {
                        webView4 = null;
                    }
                    String url = webView4.getUrl();
                    if (!webViewActivity.isFinishing() && !webViewActivity.isDestroyed() && webViewActivity.m != null && !F3.c(url, str) && !F3.c(url, "about:blank")) {
                        WebView webView5 = webViewActivity.m;
                        (webView5 != null ? webView5 : null).loadUrl(str);
                    }
                }
                return Oh0.a;
            case 1:
                int i2 = this.q;
                WebViewActivity webViewActivity2 = this.r;
                if (i2 == 0) {
                    IJ.H(obj);
                    this.q = 1;
                    obj = WebViewActivity.f(webViewActivity2, this);
                    EnumC0091Dn enumC0091Dn2 = EnumC0091Dn.l;
                    if (obj == enumC0091Dn2) {
                        return enumC0091Dn2;
                    }
                } else {
                    if (i2 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    IJ.H(obj);
                }
                String string = (String) obj;
                if (Za0.Y(string)) {
                    SharedPreferences sharedPreferences = webViewActivity2.n;
                    if (sharedPreferences == null) {
                        sharedPreferences = null;
                    }
                    string = sharedPreferences.getString("current_url", null);
                    if (string == null) {
                        string = "https://digikala.com";
                    }
                }
                if (!webViewActivity2.isFinishing() && !webViewActivity2.isDestroyed() && (webView = webViewActivity2.m) != null) {
                    webView.loadUrl(string);
                    Toast.makeText(webViewActivity2, "اتصال برقرار شد", 0).show();
                }
                return Oh0.a;
            case 2:
                int i3 = this.q;
                WebViewActivity webViewActivity3 = this.r;
                if (i3 == 0) {
                    IJ.H(obj);
                    this.q = 1;
                    obj = WebViewActivity.f(webViewActivity3, this);
                    EnumC0091Dn enumC0091Dn3 = EnumC0091Dn.l;
                    if (obj == enumC0091Dn3) {
                        return enumC0091Dn3;
                    }
                } else {
                    if (i3 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    IJ.H(obj);
                }
                CharSequence charSequence = (CharSequence) obj;
                if (Za0.Y(charSequence)) {
                    charSequence = "https://digikala.com";
                }
                String str2 = (String) charSequence;
                if (!webViewActivity3.isFinishing() && !webViewActivity3.isDestroyed() && (webView2 = webViewActivity3.m) != null) {
                    webView2.loadUrl(str2);
                }
                return Oh0.a;
            default:
                int i4 = this.q;
                WebViewActivity webViewActivity4 = this.r;
                if (i4 == 0) {
                    IJ.H(obj);
                    this.q = 1;
                    obj = WebViewActivity.f(webViewActivity4, this);
                    EnumC0091Dn enumC0091Dn4 = EnumC0091Dn.l;
                    if (obj == enumC0091Dn4) {
                        return enumC0091Dn4;
                    }
                } else {
                    if (i4 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    IJ.H(obj);
                }
                String string2 = (String) obj;
                if (Za0.Y(string2)) {
                    SharedPreferences sharedPreferences2 = webViewActivity4.n;
                    if (sharedPreferences2 == null) {
                        sharedPreferences2 = null;
                    }
                    string2 = sharedPreferences2.getString("current_url", null);
                    if (string2 == null) {
                        string2 = "https://digikala.com";
                    }
                }
                if (!webViewActivity4.isFinishing() && !webViewActivity4.isDestroyed() && (webView3 = webViewActivity4.m) != null) {
                    webView3.loadUrl(string2);
                }
                return Oh0.a;
        }
    }
}
