176 lines
12 KiB
Java
176 lines
12 KiB
Java
package com.sistemasolton.itranvias.home.presentation.freetransfer;
|
|
|
|
import androidx.compose.runtime.MutableState;
|
|
import androidx.compose.runtime.SnapshotStateKt__SnapshotStateKt;
|
|
import androidx.lifecycle.ViewModel;
|
|
import androidx.lifecycle.ViewModelKt;
|
|
import com.sistemasolton.itranvias.home.data.remote.dto.infodto.InfoDto;
|
|
import com.sistemasolton.itranvias.home.domain.usecase.GetInfoLocalUseCase;
|
|
import kotlin.Metadata;
|
|
import kotlin.ResultKt;
|
|
import kotlin.Unit;
|
|
import kotlin.coroutines.Continuation;
|
|
import kotlin.coroutines.intrinsics.IntrinsicsKt;
|
|
import kotlin.coroutines.jvm.internal.DebugMetadata;
|
|
import kotlin.coroutines.jvm.internal.SuspendLambda;
|
|
import kotlin.jvm.functions.Function2;
|
|
import kotlin.jvm.functions.Function3;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
|
|
import kotlinx.coroutines.CoroutineScope;
|
|
import kotlinx.coroutines.flow.FlowCollector;
|
|
import kotlinx.coroutines.flow.FlowKt;
|
|
|
|
/* JADX INFO: compiled from: FreeTransferViewmodel.kt */
|
|
/* JADX INFO: loaded from: classes2.dex */
|
|
@Metadata(d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0010\u0002\n\u0000\b\u0007\u0018\u00002\u00020\u0001B\u000f\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0004\b\u0004\u0010\u0005J\u0006\u0010\u000f\u001a\u00020\u0010R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R+\u0010\b\u001a\u00020\u00072\u0006\u0010\u0006\u001a\u00020\u00078F@BX\u0086\u008e\u0002¢\u0006\u0012\n\u0004\b\r\u0010\u000e\u001a\u0004\b\t\u0010\n\"\u0004\b\u000b\u0010\f¨\u0006\u0011"}, d2 = {"Lcom/sistemasolton/itranvias/home/presentation/freetransfer/FreeTransferViewmodel;", "Landroidx/lifecycle/ViewModel;", "getLocalInfoUseCase", "Lcom/sistemasolton/itranvias/home/domain/usecase/GetInfoLocalUseCase;", "<init>", "(Lcom/sistemasolton/itranvias/home/domain/usecase/GetInfoLocalUseCase;)V", "<set-?>", "Lcom/sistemasolton/itranvias/home/presentation/freetransfer/FreeTransferState;", "state", "getState", "()Lcom/sistemasolton/itranvias/home/presentation/freetransfer/FreeTransferState;", "setState", "(Lcom/sistemasolton/itranvias/home/presentation/freetransfer/FreeTransferState;)V", "state$delegate", "Landroidx/compose/runtime/MutableState;", "loadInfo", "", "composeApp_release"}, k = 1, mv = {2, 1, 0}, xi = 48)
|
|
public final class FreeTransferViewmodel extends ViewModel {
|
|
public static final int $stable = 8;
|
|
private final GetInfoLocalUseCase getLocalInfoUseCase;
|
|
|
|
/* JADX INFO: renamed from: state$delegate, reason: from kotlin metadata */
|
|
private final MutableState state;
|
|
|
|
public FreeTransferViewmodel(GetInfoLocalUseCase getLocalInfoUseCase) {
|
|
Intrinsics.checkNotNullParameter(getLocalInfoUseCase, "getLocalInfoUseCase");
|
|
this.getLocalInfoUseCase = getLocalInfoUseCase;
|
|
this.state = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(new FreeTransferState(false, false, null, null, 15, null), null, 2, null);
|
|
loadInfo();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final void setState(FreeTransferState freeTransferState) {
|
|
this.state.setValue(freeTransferState);
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public final FreeTransferState getState() {
|
|
return (FreeTransferState) this.state.getValue();
|
|
}
|
|
|
|
/* JADX INFO: renamed from: com.sistemasolton.itranvias.home.presentation.freetransfer.FreeTransferViewmodel$loadInfo$1, reason: invalid class name */
|
|
/* JADX INFO: compiled from: FreeTransferViewmodel.kt */
|
|
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\n"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {2, 1, 0}, xi = 48)
|
|
@DebugMetadata(c = "com.sistemasolton.itranvias.home.presentation.freetransfer.FreeTransferViewmodel$loadInfo$1", f = "FreeTransferViewmodel.kt", i = {}, l = {36}, m = "invokeSuspend", n = {}, s = {})
|
|
static final class AnonymousClass1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
|
|
int label;
|
|
|
|
AnonymousClass1(Continuation<? super AnonymousClass1> continuation) {
|
|
super(2, continuation);
|
|
}
|
|
|
|
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
|
|
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
|
|
return FreeTransferViewmodel.this.new AnonymousClass1(continuation);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function2
|
|
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
|
|
return ((AnonymousClass1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
|
|
}
|
|
|
|
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
|
|
public final Object invokeSuspend(Object obj) throws Throwable {
|
|
Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
|
|
int i = this.label;
|
|
if (i == 0) {
|
|
ResultKt.throwOnFailure(obj);
|
|
FreeTransferViewmodel freeTransferViewmodel = FreeTransferViewmodel.this;
|
|
freeTransferViewmodel.setState(FreeTransferState.copy$default(freeTransferViewmodel.getState(), true, false, null, null, 8, null));
|
|
this.label = 1;
|
|
if (FlowKt.collectLatest(FlowKt.m9919catch(FreeTransferViewmodel.this.getLocalInfoUseCase.invoke(), new C01141(FreeTransferViewmodel.this, null)), new AnonymousClass2(FreeTransferViewmodel.this, null), this) == coroutine_suspended) {
|
|
return coroutine_suspended;
|
|
}
|
|
} else {
|
|
if (i != 1) {
|
|
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
|
|
}
|
|
ResultKt.throwOnFailure(obj);
|
|
}
|
|
return Unit.INSTANCE;
|
|
}
|
|
|
|
/* JADX INFO: renamed from: com.sistemasolton.itranvias.home.presentation.freetransfer.FreeTransferViewmodel$loadInfo$1$1, reason: invalid class name and collision with other inner class name */
|
|
/* JADX INFO: compiled from: FreeTransferViewmodel.kt */
|
|
@Metadata(d1 = {"\u0000\u0014\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0003\u0010\u0000\u001a\u00020\u0001*\n\u0012\u0006\u0012\u0004\u0018\u00010\u00030\u00022\u0006\u0010\u0004\u001a\u00020\u0005H\n"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/flow/FlowCollector;", "Lcom/sistemasolton/itranvias/home/data/remote/dto/infodto/InfoDto;", "e", ""}, k = 3, mv = {2, 1, 0}, xi = 48)
|
|
@DebugMetadata(c = "com.sistemasolton.itranvias.home.presentation.freetransfer.FreeTransferViewmodel$loadInfo$1$1", f = "FreeTransferViewmodel.kt", i = {}, l = {}, m = "invokeSuspend", n = {}, s = {})
|
|
static final class C01141 extends SuspendLambda implements Function3<FlowCollector<? super InfoDto>, Throwable, Continuation<? super Unit>, Object> {
|
|
/* synthetic */ Object L$0;
|
|
int label;
|
|
final /* synthetic */ FreeTransferViewmodel this$0;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
C01141(FreeTransferViewmodel freeTransferViewmodel, Continuation<? super C01141> continuation) {
|
|
super(3, continuation);
|
|
this.this$0 = freeTransferViewmodel;
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function3
|
|
public final Object invoke(FlowCollector<? super InfoDto> flowCollector, Throwable th, Continuation<? super Unit> continuation) {
|
|
C01141 c01141 = new C01141(this.this$0, continuation);
|
|
c01141.L$0 = th;
|
|
return c01141.invokeSuspend(Unit.INSTANCE);
|
|
}
|
|
|
|
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
|
|
public final Object invokeSuspend(Object obj) throws Throwable {
|
|
IntrinsicsKt.getCOROUTINE_SUSPENDED();
|
|
if (this.label != 0) {
|
|
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
|
|
}
|
|
ResultKt.throwOnFailure(obj);
|
|
Throwable th = (Throwable) this.L$0;
|
|
System.out.println((Object) ("❌ Error al cargar info: " + th.getMessage()));
|
|
th.printStackTrace();
|
|
FreeTransferViewmodel freeTransferViewmodel = this.this$0;
|
|
freeTransferViewmodel.setState(FreeTransferState.copy$default(freeTransferViewmodel.getState(), false, true, th.getMessage(), null, 8, null));
|
|
return Unit.INSTANCE;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: renamed from: com.sistemasolton.itranvias.home.presentation.freetransfer.FreeTransferViewmodel$loadInfo$1$2, reason: invalid class name */
|
|
/* JADX INFO: compiled from: FreeTransferViewmodel.kt */
|
|
@Metadata(d1 = {"\u0000\f\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u00012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003H\n"}, d2 = {"<anonymous>", "", "infoDto", "Lcom/sistemasolton/itranvias/home/data/remote/dto/infodto/InfoDto;"}, k = 3, mv = {2, 1, 0}, xi = 48)
|
|
@DebugMetadata(c = "com.sistemasolton.itranvias.home.presentation.freetransfer.FreeTransferViewmodel$loadInfo$1$2", f = "FreeTransferViewmodel.kt", i = {}, l = {}, m = "invokeSuspend", n = {}, s = {})
|
|
static final class AnonymousClass2 extends SuspendLambda implements Function2<InfoDto, Continuation<? super Unit>, Object> {
|
|
/* synthetic */ Object L$0;
|
|
int label;
|
|
final /* synthetic */ FreeTransferViewmodel this$0;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
AnonymousClass2(FreeTransferViewmodel freeTransferViewmodel, Continuation<? super AnonymousClass2> continuation) {
|
|
super(2, continuation);
|
|
this.this$0 = freeTransferViewmodel;
|
|
}
|
|
|
|
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
|
|
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
|
|
AnonymousClass2 anonymousClass2 = new AnonymousClass2(this.this$0, continuation);
|
|
anonymousClass2.L$0 = obj;
|
|
return anonymousClass2;
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function2
|
|
public final Object invoke(InfoDto infoDto, Continuation<? super Unit> continuation) {
|
|
return ((AnonymousClass2) create(infoDto, continuation)).invokeSuspend(Unit.INSTANCE);
|
|
}
|
|
|
|
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
|
|
public final Object invokeSuspend(Object obj) throws Throwable {
|
|
IntrinsicsKt.getCOROUTINE_SUSPENDED();
|
|
if (this.label != 0) {
|
|
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
|
|
}
|
|
ResultKt.throwOnFailure(obj);
|
|
InfoDto infoDto = (InfoDto) this.L$0;
|
|
FreeTransferViewmodel freeTransferViewmodel = this.this$0;
|
|
freeTransferViewmodel.setState(FreeTransferState.copy$default(freeTransferViewmodel.getState(), false, false, null, infoDto, 4, null));
|
|
return Unit.INSTANCE;
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void loadInfo() {
|
|
BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), null, null, new AnonymousClass1(null), 3, null);
|
|
}
|
|
} |