2021-08-09 22:50:52 +00:00
package com.discord.stores ;
2021-11-29 08:39:39 +00:00
import com.discord.api.channel.Channel ;
import com.discord.api.channel.ChannelUtils ;
import com.discord.stores.StoreChannelsSelected ;
2021-08-09 22:50:52 +00:00
import com.discord.stores.StoreChat ;
import com.discord.stores.StoreMessageAck ;
import com.discord.stores.StoreMessagesLoader ;
2021-11-01 07:19:03 +00:00
import d0.z.d.m ;
import j0.k.b ;
2021-08-09 22:50:52 +00:00
import java.util.Set ;
import java.util.concurrent.TimeUnit ;
import rx.Observable ;
import rx.functions.Func4 ;
/* compiled from: StoreMessageAck.kt */
2021-11-29 08:39:39 +00:00
public final class StoreMessageAck$init$1 < T , R > implements b < StoreChannelsSelected . ResolvedSelectedChannel , Observable < ? extends Long > > {
2021-08-09 22:50:52 +00:00
public final /* synthetic */ StoreMessageAck this $0 ;
/* compiled from: StoreMessageAck.kt */
/* renamed from: com.discord.stores.StoreMessageAck$init$1$1 reason: invalid class name */
public static final class AnonymousClass1 < T , R > implements b < StoreMessagesLoader . ChannelLoadedState , Boolean > {
public static final AnonymousClass1 INSTANCE = new AnonymousClass1 ( ) ;
public final Boolean call ( StoreMessagesLoader . ChannelLoadedState channelLoadedState ) {
return Boolean . valueOf ( channelLoadedState . isInitialMessagesLoaded ( ) & & ! channelLoadedState . isLoadingMessages ( ) ) ;
}
}
/* compiled from: StoreMessageAck.kt */
/* renamed from: com.discord.stores.StoreMessageAck$init$1$2 reason: invalid class name */
public static final class AnonymousClass2 < T , R > implements b < StoreChat . InteractionState , Boolean > {
2021-11-29 08:39:39 +00:00
public final /* synthetic */ StoreChannelsSelected . ResolvedSelectedChannel $selectedChannel ;
2021-08-09 22:50:52 +00:00
2021-11-29 08:39:39 +00:00
public AnonymousClass2 ( StoreChannelsSelected . ResolvedSelectedChannel resolvedSelectedChannel ) {
this . $selectedChannel = resolvedSelectedChannel ;
2021-08-09 22:50:52 +00:00
}
public final Boolean call ( StoreChat . InteractionState interactionState ) {
2021-11-29 08:39:39 +00:00
return Boolean . valueOf ( interactionState . getChannelId ( ) = = this . $selectedChannel . getId ( ) ) ;
2021-08-09 22:50:52 +00:00
}
}
/* compiled from: StoreMessageAck.kt */
/* renamed from: com.discord.stores.StoreMessageAck$init$1$3 reason: invalid class name */
public static final class AnonymousClass3 < T1 , T2 , T3 , T4 , R > implements Func4 < Set < ? extends Long > , Boolean , StoreChat . InteractionState , StoreMessageAck . Ack , Long > {
2021-11-29 08:39:39 +00:00
public final /* synthetic */ StoreChannelsSelected . ResolvedSelectedChannel $selectedChannel ;
public AnonymousClass3 ( StoreChannelsSelected . ResolvedSelectedChannel resolvedSelectedChannel ) {
this . $selectedChannel = resolvedSelectedChannel ;
}
2021-08-09 22:50:52 +00:00
public final Long call ( Set < Long > set , Boolean bool , StoreChat . InteractionState interactionState , StoreMessageAck . Ack ack ) {
long j ;
2021-11-30 08:30:14 +00:00
Channel maybeChannel = this . $selectedChannel . getMaybeChannel ( ) ;
boolean z2 = true ;
if ( maybeChannel = = null | | ! ChannelUtils . o ( maybeChannel ) ) {
z2 = false ;
}
2021-08-09 22:50:52 +00:00
if ( interactionState . isAtBottomIgnoringTouch ( ) ) {
m . checkNotNullExpressionValue ( bool , " isLoadingSettled " ) ;
2021-11-30 08:30:14 +00:00
if ( bool . booleanValue ( ) & & ! set . contains ( Long . valueOf ( interactionState . getChannelId ( ) ) ) & & ! z2 & & ( ack = = null | | ! ack . isLockedAck ( ) ) ) {
2021-08-09 22:50:52 +00:00
j = interactionState . getChannelId ( ) ;
return Long . valueOf ( j ) ;
}
}
j = 0 ;
return Long . valueOf ( j ) ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object] */
@Override // rx.functions.Func4
public /* bridge */ /* synthetic */ Long call ( Set < ? extends Long > set , Boolean bool , StoreChat . InteractionState interactionState , StoreMessageAck . Ack ack ) {
return call ( ( Set < Long > ) set , bool , interactionState , ack ) ;
}
}
public StoreMessageAck$init$1 ( StoreMessageAck storeMessageAck ) {
this . this$0 = storeMessageAck ;
}
2021-11-29 08:39:39 +00:00
public final Observable < ? extends Long > call ( StoreChannelsSelected . ResolvedSelectedChannel resolvedSelectedChannel ) {
return Observable . h ( StoreMessageAck . access$getStream$p ( this . this$0 ) . getMessages$app_productionBetaRelease ( ) . getAllDetached ( ) . o ( 50 , TimeUnit . MILLISECONDS ) , StoreMessageAck . access$getStream$p ( this . this$0 ) . getMessagesLoader$app_productionBetaRelease ( ) . getMessagesLoadedState ( resolvedSelectedChannel . getId ( ) ) . F ( AnonymousClass1 . INSTANCE ) . q ( ) , StoreMessageAck . access$getStream$p ( this . this$0 ) . getChat$app_productionBetaRelease ( ) . observeInteractionState ( ) . x ( new AnonymousClass2 ( resolvedSelectedChannel ) ) , StoreMessageAck . access$getStream$p ( this . this$0 ) . getMessageAck$app_productionBetaRelease ( ) . observeForChannel ( resolvedSelectedChannel . getId ( ) ) , new AnonymousClass3 ( resolvedSelectedChannel ) ) ;
2021-08-09 22:50:52 +00:00
}
}