2021-11-30 23:47:08 +00:00
package com.discord.widgets.voice.fullscreen ;
import com.discord.api.channel.Channel ;
2022-01-27 00:50:41 +00:00
import com.discord.api.user.NsfwAllowance ;
import com.discord.models.user.MeUser ;
2021-11-30 23:47:08 +00:00
import com.discord.stores.StoreChannelsSelected ;
import com.discord.stores.StoreMentions ;
2022-01-27 00:50:41 +00:00
import com.discord.stores.StoreStream ;
import com.discord.stores.StoreUser ;
2021-11-30 23:47:08 +00:00
import com.discord.widgets.chat.list.TextInVoiceFeatureFlag ;
import com.discord.widgets.voice.fullscreen.WidgetCallPreviewFullscreenViewModel ;
import com.discord.widgets.voice.model.CallModel ;
import d0.z.d.m ;
import j0.k.b ;
import rx.Observable ;
2022-01-27 00:50:41 +00:00
import rx.functions.Func5 ;
2021-11-30 23:47:08 +00:00
/* compiled from: WidgetCallPreviewFullscreenViewModel.kt */
2022-03-02 20:59:20 +00:00
/* loaded from: classes2.dex */
2021-11-30 23:47:08 +00:00
public final class WidgetCallPreviewFullscreenViewModel$Companion$observeStoreState$1 < T , R > implements b < Channel , Observable < ? extends WidgetCallPreviewFullscreenViewModel . StoreState > > {
public final /* synthetic */ StoreChannelsSelected $storeChannelsSelected ;
2022-01-27 00:50:41 +00:00
public final /* synthetic */ StoreMentions $storeMentions ;
public final /* synthetic */ StoreUser $storeUser ;
2021-11-30 23:47:08 +00:00
public final /* synthetic */ long $voiceChannelId ;
/* compiled from: WidgetCallPreviewFullscreenViewModel.kt */
/* renamed from: com.discord.widgets.voice.fullscreen.WidgetCallPreviewFullscreenViewModel$Companion$observeStoreState$1$1 reason: invalid class name */
2022-03-02 20:59:20 +00:00
/* loaded from: classes2.dex */
2022-01-27 00:50:41 +00:00
public static final class AnonymousClass1 < T1 , T2 , T3 , T4 , T5 , R > implements Func5 < MeUser , Channel , Boolean , Integer , CallModel , WidgetCallPreviewFullscreenViewModel . StoreState > {
2021-11-30 23:47:08 +00:00
public final /* synthetic */ Channel $voiceChannel ;
public AnonymousClass1 ( Channel channel ) {
this . $voiceChannel = channel ;
}
2022-01-27 00:50:41 +00:00
public final WidgetCallPreviewFullscreenViewModel . StoreState call ( MeUser meUser , Channel channel , Boolean bool , Integer num , CallModel callModel ) {
if ( callModel = = null | | this . $voiceChannel = = null | | channel = = null ) {
2021-11-30 23:47:08 +00:00
return WidgetCallPreviewFullscreenViewModel . StoreState . Invalid . INSTANCE ;
}
2022-01-27 00:50:41 +00:00
boolean z2 = ! StoreStream . Companion . getGuildsNsfw ( ) . isGuildNsfwGateAgreed ( this . $voiceChannel . f ( ) ) ;
boolean o = this . $voiceChannel . o ( ) ;
NsfwAllowance nsfwAllowance = meUser ! = null ? meUser . getNsfwAllowance ( ) : null ;
Channel channel2 = this . $voiceChannel ;
2021-11-30 23:47:08 +00:00
m . checkNotNullExpressionValue ( bool , " isTextInVoiceEnabled " ) ;
boolean booleanValue = bool . booleanValue ( ) ;
m . checkNotNullExpressionValue ( num , " totalMentionsCount " ) ;
2022-01-27 00:50:41 +00:00
return new WidgetCallPreviewFullscreenViewModel . StoreState . Valid ( channel2 , channel , booleanValue , num . intValue ( ) , z2 , o , nsfwAllowance , callModel ) ;
2021-11-30 23:47:08 +00:00
}
}
2022-01-27 00:50:41 +00:00
public WidgetCallPreviewFullscreenViewModel$Companion$observeStoreState$1 ( StoreUser storeUser , StoreChannelsSelected storeChannelsSelected , StoreMentions storeMentions , long j ) {
this . $storeUser = storeUser ;
2021-11-30 23:47:08 +00:00
this . $storeChannelsSelected = storeChannelsSelected ;
2022-01-27 00:50:41 +00:00
this . $storeMentions = storeMentions ;
2021-11-30 23:47:08 +00:00
this . $voiceChannelId = j ;
}
public final Observable < ? extends WidgetCallPreviewFullscreenViewModel . StoreState > call ( Channel channel ) {
2022-01-27 00:50:41 +00:00
Long l = null ;
Observable observeMe$default = StoreUser . observeMe$default ( this . $storeUser , false , 1 , null ) ;
Observable < Channel > observeSelectedChannel = this . $storeChannelsSelected . observeSelectedChannel ( ) ;
TextInVoiceFeatureFlag instance = TextInVoiceFeatureFlag . Companion . getINSTANCE ( ) ;
if ( channel ! = null ) {
l = Long . valueOf ( channel . f ( ) ) ;
}
return Observable . g ( observeMe$default , observeSelectedChannel , instance . observeEnabled ( l ) , this . $storeMentions . observeTotalMentions ( ) , CallModel . Companion . get ( this . $voiceChannelId ) , new AnonymousClass1 ( channel ) ) ;
2021-11-30 23:47:08 +00:00
}
}