185 lines
		
	
	
		
			9.7 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			185 lines
		
	
	
		
			9.7 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package androidx.lifecycle;
 | |
| 
 | |
| 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.Function0;
 | |
| import kotlin.jvm.functions.Function2;
 | |
| import kotlinx.coroutines.BuildersKt;
 | |
| import kotlinx.coroutines.BuildersKt__Builders_commonKt;
 | |
| import kotlinx.coroutines.CoroutineScope;
 | |
| import kotlinx.coroutines.Dispatchers;
 | |
| import kotlinx.coroutines.GlobalScope;
 | |
| import kotlinx.coroutines.channels.ProduceKt;
 | |
| import kotlinx.coroutines.channels.ProducerScope;
 | |
| 
 | |
| /* JADX INFO: Add missing generic type declarations: [T] */
 | |
| /* compiled from: FlowLiveData.kt */
 | |
| @Metadata(d1 = {"\u0000\f\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\u0010\u0003\u001a\u00020\u0002\"\u0004\b\u0000\u0010\u0000*\b\u0012\u0004\u0012\u00028\u00000\u0001H\u008a@"}, d2 = {"T", "Lkotlinx/coroutines/channels/ProducerScope;", "", "<anonymous>"}, k = 3, mv = {1, 8, 0})
 | |
| @DebugMetadata(c = "androidx.lifecycle.FlowLiveDataConversions$asFlow$1", f = "FlowLiveData.kt", i = {0, 0}, l = {112, 116}, m = "invokeSuspend", n = {"$this$callbackFlow", "observer"}, s = {"L$0", "L$1"})
 | |
| /* loaded from: classes.dex */
 | |
| final class FlowLiveDataConversions$asFlow$1<T> extends SuspendLambda implements Function2<ProducerScope<? super T>, Continuation<? super Unit>, Object> {
 | |
|     final /* synthetic */ LiveData<T> $this_asFlow;
 | |
|     private /* synthetic */ Object L$0;
 | |
|     Object L$1;
 | |
|     int label;
 | |
| 
 | |
|     /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
 | |
|     FlowLiveDataConversions$asFlow$1(LiveData<T> liveData, Continuation<? super FlowLiveDataConversions$asFlow$1> continuation) {
 | |
|         super(2, continuation);
 | |
|         this.$this_asFlow = liveData;
 | |
|     }
 | |
| 
 | |
|     @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
 | |
|     public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
 | |
|         FlowLiveDataConversions$asFlow$1 flowLiveDataConversions$asFlow$1 = new FlowLiveDataConversions$asFlow$1(this.$this_asFlow, continuation);
 | |
|         flowLiveDataConversions$asFlow$1.L$0 = obj;
 | |
|         return flowLiveDataConversions$asFlow$1;
 | |
|     }
 | |
| 
 | |
|     @Override // kotlin.jvm.functions.Function2
 | |
|     public final Object invoke(ProducerScope<? super T> producerScope, Continuation<? super Unit> continuation) {
 | |
|         return ((FlowLiveDataConversions$asFlow$1) create(producerScope, continuation)).invokeSuspend(Unit.INSTANCE);
 | |
|     }
 | |
| 
 | |
|     @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
 | |
|     public final Object invokeSuspend(Object obj) {
 | |
|         final Observer observer;
 | |
|         ProducerScope producerScope;
 | |
|         Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
 | |
|         int i = this.label;
 | |
|         if (i == 0) {
 | |
|             ResultKt.throwOnFailure(obj);
 | |
|             final ProducerScope producerScope2 = (ProducerScope) this.L$0;
 | |
|             observer = new Observer() { // from class: androidx.lifecycle.FlowLiveDataConversions$asFlow$1$$ExternalSyntheticLambda0
 | |
|                 @Override // androidx.lifecycle.Observer
 | |
|                 public final void onChanged(Object obj2) {
 | |
|                     ProducerScope.this.mo1852trySendJP2dKIU(obj2);
 | |
|                 }
 | |
|             };
 | |
|             this.L$0 = producerScope2;
 | |
|             this.L$1 = observer;
 | |
|             this.label = 1;
 | |
|             if (BuildersKt.withContext(Dispatchers.getMain().getImmediate(), new AnonymousClass1(this.$this_asFlow, observer, null), this) == coroutine_suspended) {
 | |
|                 return coroutine_suspended;
 | |
|             }
 | |
|             producerScope = producerScope2;
 | |
|         } else {
 | |
|             if (i != 1) {
 | |
|                 if (i != 2) {
 | |
|                     throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
 | |
|                 }
 | |
|                 ResultKt.throwOnFailure(obj);
 | |
|                 return Unit.INSTANCE;
 | |
|             }
 | |
|             observer = (Observer) this.L$1;
 | |
|             producerScope = (ProducerScope) this.L$0;
 | |
|             ResultKt.throwOnFailure(obj);
 | |
|         }
 | |
|         final LiveData<T> liveData = this.$this_asFlow;
 | |
|         this.L$0 = null;
 | |
|         this.L$1 = null;
 | |
|         this.label = 2;
 | |
|         if (ProduceKt.awaitClose(producerScope, new Function0<Unit>() { // from class: androidx.lifecycle.FlowLiveDataConversions$asFlow$1.2
 | |
|             /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
 | |
|             {
 | |
|                 super(0);
 | |
|             }
 | |
| 
 | |
|             /* compiled from: FlowLiveData.kt */
 | |
|             @Metadata(d1 = {"\u0000\f\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\u0010\u0003\u001a\u00020\u0002\"\u0004\b\u0000\u0010\u0000*\u00020\u0001H\u008a@"}, d2 = {"T", "Lkotlinx/coroutines/CoroutineScope;", "", "<anonymous>"}, k = 3, mv = {1, 8, 0})
 | |
|             @DebugMetadata(c = "androidx.lifecycle.FlowLiveDataConversions$asFlow$1$2$1", f = "FlowLiveData.kt", i = {}, l = {}, m = "invokeSuspend", n = {}, s = {})
 | |
|             /* renamed from: androidx.lifecycle.FlowLiveDataConversions$asFlow$1$2$1, reason: invalid class name */
 | |
|             static final class AnonymousClass1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
 | |
|                 final /* synthetic */ Observer<T> $observer;
 | |
|                 final /* synthetic */ LiveData<T> $this_asFlow;
 | |
|                 int label;
 | |
| 
 | |
|                 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
 | |
|                 AnonymousClass1(LiveData<T> liveData, Observer<T> observer, Continuation<? super AnonymousClass1> continuation) {
 | |
|                     super(2, continuation);
 | |
|                     this.$this_asFlow = liveData;
 | |
|                     this.$observer = observer;
 | |
|                 }
 | |
| 
 | |
|                 @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
 | |
|                 public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
 | |
|                     return new AnonymousClass1(this.$this_asFlow, this.$observer, 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) {
 | |
|                     IntrinsicsKt.getCOROUTINE_SUSPENDED();
 | |
|                     if (this.label == 0) {
 | |
|                         ResultKt.throwOnFailure(obj);
 | |
|                         this.$this_asFlow.removeObserver(this.$observer);
 | |
|                         return Unit.INSTANCE;
 | |
|                     }
 | |
|                     throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
 | |
|                 }
 | |
|             }
 | |
| 
 | |
|             @Override // kotlin.jvm.functions.Function0
 | |
|             public /* bridge */ /* synthetic */ Unit invoke() {
 | |
|                 invoke2();
 | |
|                 return Unit.INSTANCE;
 | |
|             }
 | |
| 
 | |
|             /* renamed from: invoke, reason: avoid collision after fix types in other method */
 | |
|             public final void invoke2() {
 | |
|                 BuildersKt__Builders_commonKt.launch$default(GlobalScope.INSTANCE, Dispatchers.getMain().getImmediate(), null, new AnonymousClass1(liveData, observer, null), 2, null);
 | |
|             }
 | |
|         }, this) == coroutine_suspended) {
 | |
|             return coroutine_suspended;
 | |
|         }
 | |
|         return Unit.INSTANCE;
 | |
|     }
 | |
| 
 | |
|     /* compiled from: FlowLiveData.kt */
 | |
|     @Metadata(d1 = {"\u0000\f\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\u0010\u0003\u001a\u00020\u0002\"\u0004\b\u0000\u0010\u0000*\u00020\u0001H\u008a@"}, d2 = {"T", "Lkotlinx/coroutines/CoroutineScope;", "", "<anonymous>"}, k = 3, mv = {1, 8, 0})
 | |
|     @DebugMetadata(c = "androidx.lifecycle.FlowLiveDataConversions$asFlow$1$1", f = "FlowLiveData.kt", i = {}, l = {}, m = "invokeSuspend", n = {}, s = {})
 | |
|     /* renamed from: androidx.lifecycle.FlowLiveDataConversions$asFlow$1$1, reason: invalid class name */
 | |
|     static final class AnonymousClass1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
 | |
|         final /* synthetic */ Observer<T> $observer;
 | |
|         final /* synthetic */ LiveData<T> $this_asFlow;
 | |
|         int label;
 | |
| 
 | |
|         /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
 | |
|         AnonymousClass1(LiveData<T> liveData, Observer<T> observer, Continuation<? super AnonymousClass1> continuation) {
 | |
|             super(2, continuation);
 | |
|             this.$this_asFlow = liveData;
 | |
|             this.$observer = observer;
 | |
|         }
 | |
| 
 | |
|         @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
 | |
|         public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
 | |
|             return new AnonymousClass1(this.$this_asFlow, this.$observer, 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) {
 | |
|             IntrinsicsKt.getCOROUTINE_SUSPENDED();
 | |
|             if (this.label == 0) {
 | |
|                 ResultKt.throwOnFailure(obj);
 | |
|                 this.$this_asFlow.observeForever(this.$observer);
 | |
|                 return Unit.INSTANCE;
 | |
|             }
 | |
|             throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
 | |
|         }
 | |
|     }
 | |
| }
 |