Luno v7.28.0版本的 MD5 值为:08d81b3b88ef7df48c89cb5d56dc11a2

以下内容为反编译后的 ToyPokemonViewModel.java 源代码,内容仅作参考


package co.bitx.android.walleu.app.modules.debug.toys.pokemon;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import co.bitx.android.walleu.R;
import co.bitx.android.walleu.model.wire.result.ResultScreen;
import co.bitx.android.walleu.model.wire.toys.PokemonResponse;
import co.bitx.android.walleu.model.wire.walletinfo.CelebrationScreen;
import co.bitx.android.walleu.ui.bottomsheet.BottomSheetItem;
import java.util.List;
import kotlin.Unit;
import kotlin.coroutines.jvm.internal.c;
import kotlin.jvm.internal.DefaultConstructorMarker;
import mdi.sdk.ac1;
import mdi.sdk.ah;
import mdi.sdk.c85;
import mdi.sdk.gf4;
import mdi.sdk.hs;
import mdi.sdk.hy;
import mdi.sdk.jd2;
import mdi.sdk.n40;
import mdi.sdk.n50;
import mdi.sdk.nf4;
import mdi.sdk.pf4;
import mdi.sdk.rs;
import mdi.sdk.sd5;
import mdi.sdk.t55;
import mdi.sdk.ti4;
import mdi.sdk.us;
import mdi.sdk.w32;
import mdi.sdk.x32;
import mdi.sdk.y95;

public final class ToyPokemonViewModel extends ah {
    private final gf4 d;
    private final sd5 e;
    private final ti4 f;
    private final MutableLiveData<List<BottomSheetItem>> g;
    private final MutableLiveData<String> h;
    private final MutableLiveData<y95> i;
    private final LiveData<y95> j;
    private final MutableLiveData<BottomSheetItem> k;
    private final MutableLiveData<y95> l;
    private final LiveData<y95> m;
    private boolean v;

    public static final class a {
        private a() {
        }

        public a(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }
    }

    @c(c = "co.bitx.android.walleu.app.modules.debug.toys.pokemon.ToyPokemonViewModel$createPokemon$1", f = "ToyPokemonViewModel.kt", l = {78}, m = "invokeSuspend")
    public static final class b extends c85 implements ac1<n50, n40<? super Unit>, Object> {
        Object a;
        int b;
        final String d;
        final String e;

        b(String str, String str2, n40<? super b> n40Var) {
            super(2, n40Var);
            this.d = str;
            this.e = str2;
        }

        @Override
        public final n40<Unit> create(Object obj, n40<?> n40Var) {
            return new b(this.d, this.e, n40Var);
        }

        @Override
        public final Object invoke(n50 n50Var, n40<? super Unit> n40Var) {
            return ((b) create(n50Var, n40Var)).invokeSuspend(Unit.a);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            ah ahVar;
            Object d = x32.d();
            int i = this.b;
            if (i == 0) {
                pf4.b(obj);
                ToyPokemonViewModel toyPokemonViewModel = ToyPokemonViewModel.this;
                String str = this.d;
                String str2 = this.e;
                ah.d0(toyPokemonViewModel, true);
                sd5 sd5Var = toyPokemonViewModel.e;
                this.a = toyPokemonViewModel;
                this.b = 1;
                Object v1 = sd5Var.v1("ivan@luno.com", str, str2, this);
                if (v1 == d) {
                    return d;
                }
                ahVar = toyPokemonViewModel;
                obj = v1;
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                ahVar = (ah) this.a;
                pf4.b(obj);
            }
            nf4 nf4Var = (nf4) obj;
            ah.d0(ahVar, false);
            ToyPokemonViewModel toyPokemonViewModel2 = ToyPokemonViewModel.this;
            if (nf4Var instanceof nf4.b) {
                toyPokemonViewModel2.q0(((nf4.b) nf4Var).c());
            }
            ToyPokemonViewModel toyPokemonViewModel3 = ToyPokemonViewModel.this;
            if (nf4Var instanceof nf4.c) {
                PokemonResponse pokemonResponse = (PokemonResponse) ((nf4.c) nf4Var).c();
                gf4 gf4Var = toyPokemonViewModel3.d;
                us usVar = us.CREATE_TOY;
                ResultScreen resultScreen = pokemonResponse.result_screen;
                CelebrationScreen c = rs.c(gf4Var, usVar, null, resultScreen == null ? null : resultScreen.message_html, false, null, 52, null);
                if (c == null) {
                    toyPokemonViewModel3.q0(new IllegalStateException("Can't show celebration screen!"));
                } else {
                    toyPokemonViewModel3.f.e(new hs(c, usVar));
                }
            }
            return Unit.a;
        }
    }

    static {
        new a(null);
    }

    public ToyPokemonViewModel(gf4 gf4Var, sd5 sd5Var, ti4 ti4Var) {
        w32.h(gf4Var, "resourceResolver");
        w32.h(sd5Var, "toyClient");
        w32.h(ti4Var, "router");
        this.d = gf4Var;
        this.e = sd5Var;
        this.f = ti4Var;
        this.g = new MutableLiveData<>(A0());
        this.h = new MutableLiveData<>();
        MutableLiveData<y95> mutableLiveData = new MutableLiveData<>();
        this.i = mutableLiveData;
        this.j = mutableLiveData;
        this.k = new MutableLiveData<>();
        MutableLiveData<y95> mutableLiveData2 = new MutableLiveData<>();
        this.l = mutableLiveData2;
        this.m = mutableLiveData2;
    }

    private final List<BottomSheetItem> A0() {
        List<BottomSheetItem> m;
        m = hy.m(y0(R.string.toy_pokemon_toy_size_small), y0(R.string.toy_pokemon_toy_size_medium), y0(R.string.toy_pokemon_toy_size_large));
        return m;
    }

    private final boolean J0() {
        boolean z;
        boolean z2;
        String value = this.h.getValue();
        if (value != null) {
            z2 = t55.z(value);
            if (!z2) {
                z = false;
                this.i.setValue(!z ? new y95.b(R.string.toy_pokemon_name_error_empty, new Object[0]) : null);
                boolean z3 = this.k.getValue() != null;
                this.l.setValue(z3 ? new y95.b(R.string.toy_pokemon_toy_size_error_not_selected, new Object[0]) : null);
                return z && !z3;
            }
        }
        z = true;
        this.i.setValue(!z ? new y95.b(R.string.toy_pokemon_name_error_empty, new Object[0]) : null);
        if (this.k.getValue() != null) {
        }
        this.l.setValue(z3 ? new y95.b(R.string.toy_pokemon_toy_size_error_not_selected, new Object[0]) : null);
        if (z) {
        }
    }

    private final BottomSheetItem y0(int i) {
        return new BottomSheetItem(0L, this.d.getString(i), null, null, null, 0, false, false, 253, null);
    }

    private final jd2 z0(String str, String str2) {
        return ah.o0(this, null, new b(str, str2, null), 1, null);
    }

    public final MutableLiveData<String> B0() {
        return this.h;
    }

    public final LiveData<y95> C0() {
        return this.j;
    }

    public final MutableLiveData<List<BottomSheetItem>> D0() {
        return this.g;
    }

    public final MutableLiveData<BottomSheetItem> E0() {
        return this.k;
    }

    public final LiveData<y95> F0() {
        return this.m;
    }

    public final void G0() {
        if (this.v) {
            J0();
        }
    }

    public final void H0() {
        String value;
        this.v = true;
        if (!J0() || (value = this.h.getValue()) == null) {
            return;
        }
        BottomSheetItem value2 = this.k.getValue();
        String h = value2 == null ? null : value2.h();
        if (h == null) {
            return;
        }
        z0(value, h);
    }

    public final void I0(BottomSheetItem bottomSheetItem) {
        w32.h(bottomSheetItem, "toySizeItem");
        this.k.setValue(bottomSheetItem);
        if (this.v) {
            J0();
        }
    }
}