2022-03-28 08:10:50 +00:00
package com.discord.widgets.status ;
import a0.a.a.b ;
import android.content.Context ;
import b.a.d.d0 ;
import b.d.b.a.a ;
import com.discord.R ;
import com.discord.api.channel.Channel ;
import com.discord.api.channel.ChannelUtils ;
import com.discord.api.message.reaction.MessageReaction ;
import com.discord.app.AppFragment ;
import com.discord.models.message.Message ;
import com.discord.restapi.RestAPIParams ;
import com.discord.stores.StoreChannels ;
import com.discord.stores.StoreChannelsSelected ;
import com.discord.stores.StoreEmoji ;
import com.discord.stores.StoreForumPostMessages ;
import com.discord.stores.StoreMessages ;
import com.discord.stores.StorePermissions ;
import com.discord.stores.StoreStream ;
import com.discord.stores.StoreThreadMessages ;
import com.discord.stores.StoreThreadsJoined ;
import com.discord.stores.StoreUser ;
import com.discord.utilities.permissions.PermissionUtils ;
import com.discord.utilities.rest.RestAPI ;
import com.discord.utilities.rx.ObservableExtensionsKt ;
import com.discord.widgets.chat.list.adapter.WidgetChatListAdapterEventsHandler ;
import com.discord.widgets.forums.ForumUtils ;
import d0.z.d.m ;
import d0.z.d.o ;
import kotlin.Unit ;
import kotlin.jvm.functions.Function0 ;
import kotlin.jvm.functions.Function1 ;
import kotlin.jvm.internal.DefaultConstructorMarker ;
import org.objectweb.asm.Opcodes ;
import rx.Observable ;
/* compiled from: WidgetForumPostStatusViewModel.kt */
/* loaded from: classes2.dex */
public final class WidgetForumPostStatusViewModel extends d0 < ViewState > {
public static final Companion Companion = new Companion ( null ) ;
private final AppFragment appFragment ;
private boolean followRequestInProgress ;
private final StoreChannels storeChannels ;
private final StoreChannelsSelected storeChannelsSelected ;
private final StoreEmoji storeEmoji ;
private final StoreForumPostMessages storeForumPostMessages ;
private final StoreMessages storeMessages ;
private final StorePermissions storePermissions ;
private final StoreThreadMessages storeThreadMessages ;
private final StoreThreadsJoined storeThreadsJoined ;
private final StoreUser storeUser ;
private final WidgetChatListAdapterEventsHandler . UserReactionHandler userReactionHandler ;
/* compiled from: WidgetForumPostStatusViewModel.kt */
/* renamed from: com.discord.widgets.status.WidgetForumPostStatusViewModel$1 reason: invalid class name */
/* loaded from: classes2.dex */
public static final class AnonymousClass1 extends o implements Function1 < StoreState , Unit > {
public AnonymousClass1 ( ) {
super ( 1 ) ;
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke ( StoreState storeState ) {
invoke2 ( storeState ) ;
return Unit . a ;
}
/* renamed from: invoke reason: avoid collision after fix types in other method */
public final void invoke2 ( StoreState storeState ) {
m . checkNotNullParameter ( storeState , " storeState " ) ;
WidgetForumPostStatusViewModel . this . handleStoreState ( storeState ) ;
}
}
/* compiled from: WidgetForumPostStatusViewModel.kt */
/* loaded from: classes2.dex */
public static final class Companion {
private Companion ( ) {
}
public /* synthetic */ Companion ( DefaultConstructorMarker defaultConstructorMarker ) {
this ( ) ;
}
public final Observable < StoreState > observeStoreState ( StoreUser storeUser , StoreChannels storeChannels , StoreChannelsSelected storeChannelsSelected , StoreThreadsJoined storeThreadsJoined , StoreForumPostMessages storeForumPostMessages , StoreThreadMessages storeThreadMessages , StorePermissions storePermissions ) {
m . checkNotNullParameter ( storeUser , " storeUser " ) ;
m . checkNotNullParameter ( storeChannels , " storeChannels " ) ;
m . checkNotNullParameter ( storeChannelsSelected , " storeChannelsSelected " ) ;
m . checkNotNullParameter ( storeThreadsJoined , " storeThreadsJoined " ) ;
m . checkNotNullParameter ( storeForumPostMessages , " storeForumPostMessages " ) ;
m . checkNotNullParameter ( storeThreadMessages , " storeThreadMessages " ) ;
m . checkNotNullParameter ( storePermissions , " storePermissions " ) ;
2022-04-01 08:17:34 +00:00
Observable < StoreState > Y = ForumUtils . observeSelectedPostChannel$default ( ForumUtils . INSTANCE , storeChannels , storeChannelsSelected , null , null , 12 , null ) . Y ( new WidgetForumPostStatusViewModel$Companion$observeStoreState$1 ( storeUser , storeThreadsJoined , storeForumPostMessages , storeThreadMessages , storePermissions ) ) ;
2022-03-28 08:10:50 +00:00
m . checkNotNullExpressionValue ( Y , " ForumUtils.observeSelect… } \ n } \ n } " ) ;
return Y ;
}
}
/* compiled from: WidgetForumPostStatusViewModel.kt */
/* loaded from: classes2.dex */
public static abstract class StoreState {
/* compiled from: WidgetForumPostStatusViewModel.kt */
/* loaded from: classes2.dex */
public static final class Invalid extends StoreState {
public static final Invalid INSTANCE = new Invalid ( ) ;
private Invalid ( ) {
super ( null ) ;
}
}
/* compiled from: WidgetForumPostStatusViewModel.kt */
/* loaded from: classes2.dex */
public static final class Loaded extends StoreState {
private final Channel channel ;
private final Long channelPermissions ;
private final Message forumPostFirstMessage ;
private final StoreThreadsJoined . JoinedThread joinedThread ;
private final Integer messageCount ;
private final long myUserId ;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public Loaded ( long j , Channel channel , StoreThreadsJoined . JoinedThread joinedThread , Message message , Integer num , Long l ) {
super ( null ) ;
m . checkNotNullParameter ( channel , " channel " ) ;
this . myUserId = j ;
this . channel = channel ;
this . joinedThread = joinedThread ;
this . forumPostFirstMessage = message ;
this . messageCount = num ;
this . channelPermissions = l ;
}
public static /* synthetic */ Loaded copy$default ( Loaded loaded , long j , Channel channel , StoreThreadsJoined . JoinedThread joinedThread , Message message , Integer num , Long l , int i , Object obj ) {
return loaded . copy ( ( i & 1 ) ! = 0 ? loaded . myUserId : j , ( i & 2 ) ! = 0 ? loaded . channel : channel , ( i & 4 ) ! = 0 ? loaded . joinedThread : joinedThread , ( i & 8 ) ! = 0 ? loaded . forumPostFirstMessage : message , ( i & 16 ) ! = 0 ? loaded . messageCount : num , ( i & 32 ) ! = 0 ? loaded . channelPermissions : l ) ;
}
public final long component1 ( ) {
return this . myUserId ;
}
public final Channel component2 ( ) {
return this . channel ;
}
public final StoreThreadsJoined . JoinedThread component3 ( ) {
return this . joinedThread ;
}
public final Message component4 ( ) {
return this . forumPostFirstMessage ;
}
public final Integer component5 ( ) {
return this . messageCount ;
}
public final Long component6 ( ) {
return this . channelPermissions ;
}
public final Loaded copy ( long j , Channel channel , StoreThreadsJoined . JoinedThread joinedThread , Message message , Integer num , Long l ) {
m . checkNotNullParameter ( channel , " channel " ) ;
return new Loaded ( j , channel , joinedThread , message , num , l ) ;
}
public boolean equals ( Object obj ) {
if ( this = = obj ) {
return true ;
}
if ( ! ( obj instanceof Loaded ) ) {
return false ;
}
Loaded loaded = ( Loaded ) obj ;
return this . myUserId = = loaded . myUserId & & m . areEqual ( this . channel , loaded . channel ) & & m . areEqual ( this . joinedThread , loaded . joinedThread ) & & m . areEqual ( this . forumPostFirstMessage , loaded . forumPostFirstMessage ) & & m . areEqual ( this . messageCount , loaded . messageCount ) & & m . areEqual ( this . channelPermissions , loaded . channelPermissions ) ;
}
public final Channel getChannel ( ) {
return this . channel ;
}
public final Long getChannelPermissions ( ) {
return this . channelPermissions ;
}
public final Message getForumPostFirstMessage ( ) {
return this . forumPostFirstMessage ;
}
public final StoreThreadsJoined . JoinedThread getJoinedThread ( ) {
return this . joinedThread ;
}
public final Integer getMessageCount ( ) {
return this . messageCount ;
}
public final long getMyUserId ( ) {
return this . myUserId ;
}
public int hashCode ( ) {
int a = b . a ( this . myUserId ) * 31 ;
Channel channel = this . channel ;
int i = 0 ;
int hashCode = ( a + ( channel ! = null ? channel . hashCode ( ) : 0 ) ) * 31 ;
StoreThreadsJoined . JoinedThread joinedThread = this . joinedThread ;
int hashCode2 = ( hashCode + ( joinedThread ! = null ? joinedThread . hashCode ( ) : 0 ) ) * 31 ;
Message message = this . forumPostFirstMessage ;
int hashCode3 = ( hashCode2 + ( message ! = null ? message . hashCode ( ) : 0 ) ) * 31 ;
Integer num = this . messageCount ;
int hashCode4 = ( hashCode3 + ( num ! = null ? num . hashCode ( ) : 0 ) ) * 31 ;
Long l = this . channelPermissions ;
if ( l ! = null ) {
i = l . hashCode ( ) ;
}
return hashCode4 + i ;
}
public String toString ( ) {
StringBuilder R = a . R ( " Loaded(myUserId= " ) ;
R . append ( this . myUserId ) ;
R . append ( " , channel= " ) ;
R . append ( this . channel ) ;
R . append ( " , joinedThread= " ) ;
R . append ( this . joinedThread ) ;
R . append ( " , forumPostFirstMessage= " ) ;
R . append ( this . forumPostFirstMessage ) ;
R . append ( " , messageCount= " ) ;
R . append ( this . messageCount ) ;
R . append ( " , channelPermissions= " ) ;
return a . F ( R , this . channelPermissions , " ) " ) ;
}
}
private StoreState ( ) {
}
public /* synthetic */ StoreState ( DefaultConstructorMarker defaultConstructorMarker ) {
this ( ) ;
}
}
/* compiled from: WidgetForumPostStatusViewModel.kt */
/* loaded from: classes2.dex */
public static abstract class ViewState {
/* compiled from: WidgetForumPostStatusViewModel.kt */
/* loaded from: classes2.dex */
public static final class Invalid extends ViewState {
public static final Invalid INSTANCE = new Invalid ( ) ;
private Invalid ( ) {
super ( null ) ;
}
}
/* compiled from: WidgetForumPostStatusViewModel.kt */
/* loaded from: classes2.dex */
public static final class Valid extends ViewState {
private final Channel channel ;
private final boolean followRequestInProgress ;
private final boolean hasAddReactionPermission ;
private final boolean hasJoinedThread ;
private final int messageCount ;
private final Long messageId ;
private final long myUserId ;
private final MessageReaction reaction ;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public Valid ( long j , Channel channel , Long l , MessageReaction messageReaction , boolean z2 , int i , boolean z3 , boolean z4 ) {
super ( null ) ;
m . checkNotNullParameter ( channel , " channel " ) ;
this . myUserId = j ;
this . channel = channel ;
this . messageId = l ;
this . reaction = messageReaction ;
this . hasJoinedThread = z2 ;
this . messageCount = i ;
this . hasAddReactionPermission = z3 ;
this . followRequestInProgress = z4 ;
}
public static /* synthetic */ Valid copy$default ( Valid valid , long j , Channel channel , Long l , MessageReaction messageReaction , boolean z2 , int i , boolean z3 , boolean z4 , int i2 , Object obj ) {
return valid . copy ( ( i2 & 1 ) ! = 0 ? valid . myUserId : j , ( i2 & 2 ) ! = 0 ? valid . channel : channel , ( i2 & 4 ) ! = 0 ? valid . messageId : l , ( i2 & 8 ) ! = 0 ? valid . reaction : messageReaction , ( i2 & 16 ) ! = 0 ? valid . hasJoinedThread : z2 , ( i2 & 32 ) ! = 0 ? valid . messageCount : i , ( i2 & 64 ) ! = 0 ? valid . hasAddReactionPermission : z3 , ( i2 & 128 ) ! = 0 ? valid . followRequestInProgress : z4 ) ;
}
public final long component1 ( ) {
return this . myUserId ;
}
public final Channel component2 ( ) {
return this . channel ;
}
public final Long component3 ( ) {
return this . messageId ;
}
public final MessageReaction component4 ( ) {
return this . reaction ;
}
public final boolean component5 ( ) {
return this . hasJoinedThread ;
}
public final int component6 ( ) {
return this . messageCount ;
}
public final boolean component7 ( ) {
return this . hasAddReactionPermission ;
}
public final boolean component8 ( ) {
return this . followRequestInProgress ;
}
public final Valid copy ( long j , Channel channel , Long l , MessageReaction messageReaction , boolean z2 , int i , boolean z3 , boolean z4 ) {
m . checkNotNullParameter ( channel , " channel " ) ;
return new Valid ( j , channel , l , messageReaction , z2 , i , z3 , z4 ) ;
}
public boolean equals ( Object obj ) {
if ( this = = obj ) {
return true ;
}
if ( ! ( obj instanceof Valid ) ) {
return false ;
}
Valid valid = ( Valid ) obj ;
return this . myUserId = = valid . myUserId & & m . areEqual ( this . channel , valid . channel ) & & m . areEqual ( this . messageId , valid . messageId ) & & m . areEqual ( this . reaction , valid . reaction ) & & this . hasJoinedThread = = valid . hasJoinedThread & & this . messageCount = = valid . messageCount & & this . hasAddReactionPermission = = valid . hasAddReactionPermission & & this . followRequestInProgress = = valid . followRequestInProgress ;
}
public final Channel getChannel ( ) {
return this . channel ;
}
public final boolean getFollowRequestInProgress ( ) {
return this . followRequestInProgress ;
}
public final boolean getHasAddReactionPermission ( ) {
return this . hasAddReactionPermission ;
}
public final boolean getHasJoinedThread ( ) {
return this . hasJoinedThread ;
}
public final int getMessageCount ( ) {
return this . messageCount ;
}
public final Long getMessageId ( ) {
return this . messageId ;
}
public final long getMyUserId ( ) {
return this . myUserId ;
}
public final MessageReaction getReaction ( ) {
return this . reaction ;
}
public int hashCode ( ) {
int a = b . a ( this . myUserId ) * 31 ;
Channel channel = this . channel ;
int i = 0 ;
int hashCode = ( a + ( channel ! = null ? channel . hashCode ( ) : 0 ) ) * 31 ;
Long l = this . messageId ;
int hashCode2 = ( hashCode + ( l ! = null ? l . hashCode ( ) : 0 ) ) * 31 ;
MessageReaction messageReaction = this . reaction ;
if ( messageReaction ! = null ) {
i = messageReaction . hashCode ( ) ;
}
int i2 = ( hashCode2 + i ) * 31 ;
boolean z2 = this . hasJoinedThread ;
int i3 = 1 ;
if ( z2 ) {
z2 = true ;
}
int i4 = z2 ? 1 : 0 ;
int i5 = z2 ? 1 : 0 ;
int i6 = z2 ? 1 : 0 ;
int i7 = ( ( ( i2 + i4 ) * 31 ) + this . messageCount ) * 31 ;
boolean z3 = this . hasAddReactionPermission ;
if ( z3 ) {
z3 = true ;
}
int i8 = z3 ? 1 : 0 ;
int i9 = z3 ? 1 : 0 ;
int i10 = z3 ? 1 : 0 ;
int i11 = ( i7 + i8 ) * 31 ;
boolean z4 = this . followRequestInProgress ;
if ( ! z4 ) {
i3 = z4 ? 1 : 0 ;
}
return i11 + i3 ;
}
public String toString ( ) {
StringBuilder R = a . R ( " Valid(myUserId= " ) ;
R . append ( this . myUserId ) ;
R . append ( " , channel= " ) ;
R . append ( this . channel ) ;
R . append ( " , messageId= " ) ;
R . append ( this . messageId ) ;
R . append ( " , reaction= " ) ;
R . append ( this . reaction ) ;
R . append ( " , hasJoinedThread= " ) ;
R . append ( this . hasJoinedThread ) ;
R . append ( " , messageCount= " ) ;
R . append ( this . messageCount ) ;
R . append ( " , hasAddReactionPermission= " ) ;
R . append ( this . hasAddReactionPermission ) ;
R . append ( " , followRequestInProgress= " ) ;
return a . M ( R , this . followRequestInProgress , " ) " ) ;
}
}
private ViewState ( ) {
}
public /* synthetic */ ViewState ( DefaultConstructorMarker defaultConstructorMarker ) {
this ( ) ;
}
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public WidgetForumPostStatusViewModel ( AppFragment appFragment , StoreUser storeUser , StoreChannels storeChannels , StoreChannelsSelected storeChannelsSelected , StoreThreadsJoined storeThreadsJoined , StoreForumPostMessages storeForumPostMessages , StoreThreadMessages storeThreadMessages , StoreMessages storeMessages , StoreEmoji storeEmoji , StorePermissions storePermissions , WidgetChatListAdapterEventsHandler . UserReactionHandler userReactionHandler , Observable < StoreState > observable ) {
super ( null , 1 , null ) ;
m . checkNotNullParameter ( appFragment , " appFragment " ) ;
m . checkNotNullParameter ( storeUser , " storeUser " ) ;
m . checkNotNullParameter ( storeChannels , " storeChannels " ) ;
m . checkNotNullParameter ( storeChannelsSelected , " storeChannelsSelected " ) ;
m . checkNotNullParameter ( storeThreadsJoined , " storeThreadsJoined " ) ;
m . checkNotNullParameter ( storeForumPostMessages , " storeForumPostMessages " ) ;
m . checkNotNullParameter ( storeThreadMessages , " storeThreadMessages " ) ;
m . checkNotNullParameter ( storeMessages , " storeMessages " ) ;
m . checkNotNullParameter ( storeEmoji , " storeEmoji " ) ;
m . checkNotNullParameter ( storePermissions , " storePermissions " ) ;
m . checkNotNullParameter ( userReactionHandler , " userReactionHandler " ) ;
m . checkNotNullParameter ( observable , " storeStateObservable " ) ;
this . appFragment = appFragment ;
this . storeUser = storeUser ;
this . storeChannels = storeChannels ;
this . storeChannelsSelected = storeChannelsSelected ;
this . storeThreadsJoined = storeThreadsJoined ;
this . storeForumPostMessages = storeForumPostMessages ;
this . storeThreadMessages = storeThreadMessages ;
this . storeMessages = storeMessages ;
this . storeEmoji = storeEmoji ;
this . storePermissions = storePermissions ;
this . userReactionHandler = userReactionHandler ;
ObservableExtensionsKt . appSubscribe$default ( ObservableExtensionsKt . ui$default ( ObservableExtensionsKt . computationLatest ( observable ) , this , null , 2 , null ) , WidgetForumPostStatusViewModel . class , ( Context ) null , ( Function1 ) null , ( Function1 ) null , ( Function0 ) null , ( Function0 ) null , new AnonymousClass1 ( ) , 62 , ( Object ) null ) ;
}
/* JADX WARN: Illegal instructions before constructor call */
/ *
Code decompiled incorrectly , please refer to instructions dump .
* /
public /* synthetic */ WidgetForumPostStatusViewModel ( AppFragment appFragment , StoreUser storeUser , StoreChannels storeChannels , StoreChannelsSelected storeChannelsSelected , StoreThreadsJoined storeThreadsJoined , StoreForumPostMessages storeForumPostMessages , StoreThreadMessages storeThreadMessages , StoreMessages storeMessages , StoreEmoji storeEmoji , StorePermissions storePermissions , WidgetChatListAdapterEventsHandler . UserReactionHandler userReactionHandler , Observable observable , int i , DefaultConstructorMarker defaultConstructorMarker ) {
this ( appFragment , r1 , r2 , r3 , r4 , r5 , r6 , r7 , r8 , r9 , ( i & 1024 ) ! = 0 ? new WidgetChatListAdapterEventsHandler . UserReactionHandler ( appFragment , r7 , r8 ) : userReactionHandler , ( i & 2048 ) ! = 0 ? Companion . observeStoreState ( r1 , r2 , r3 , r4 , r5 , r6 , r9 ) : observable ) ;
StoreUser users = ( i & 2 ) ! = 0 ? StoreStream . Companion . getUsers ( ) : storeUser ;
StoreChannels channels = ( i & 4 ) ! = 0 ? StoreStream . Companion . getChannels ( ) : storeChannels ;
StoreChannelsSelected channelsSelected = ( i & 8 ) ! = 0 ? StoreStream . Companion . getChannelsSelected ( ) : storeChannelsSelected ;
StoreThreadsJoined threadsJoined = ( i & 16 ) ! = 0 ? StoreStream . Companion . getThreadsJoined ( ) : storeThreadsJoined ;
StoreForumPostMessages forumPostMessages = ( i & 32 ) ! = 0 ? StoreStream . Companion . getForumPostMessages ( ) : storeForumPostMessages ;
StoreThreadMessages threadMessages = ( i & 64 ) ! = 0 ? StoreStream . Companion . getThreadMessages ( ) : storeThreadMessages ;
StoreMessages messages = ( i & 128 ) ! = 0 ? StoreStream . Companion . getMessages ( ) : storeMessages ;
StoreEmoji emojis = ( i & 256 ) ! = 0 ? StoreStream . Companion . getEmojis ( ) : storeEmoji ;
StorePermissions permissions = ( i & 512 ) ! = 0 ? StoreStream . Companion . getPermissions ( ) : storePermissions ;
}
public static final /* synthetic */ boolean access$getFollowRequestInProgress$p ( WidgetForumPostStatusViewModel widgetForumPostStatusViewModel ) {
return widgetForumPostStatusViewModel . followRequestInProgress ;
}
public static final /* synthetic */ void access$setFollowRequestInProgress$p ( WidgetForumPostStatusViewModel widgetForumPostStatusViewModel , boolean z2 ) {
widgetForumPostStatusViewModel . followRequestInProgress = z2 ;
}
public static final /* synthetic */ void access$updateViewState ( WidgetForumPostStatusViewModel widgetForumPostStatusViewModel , ViewState viewState ) {
widgetForumPostStatusViewModel . updateViewState ( viewState ) ;
}
private final void showArchivedThreadToast ( Context context ) {
b . a . d . m . g ( context , R . string . thread_archived , 0 , null , 12 ) ;
}
public final void handleStoreState ( StoreState storeState ) {
m . checkNotNullParameter ( storeState , " storeState " ) ;
if ( storeState instanceof StoreState . Loaded ) {
StoreState . Loaded loaded = ( StoreState . Loaded ) storeState ;
Message forumPostFirstMessage = loaded . getForumPostFirstMessage ( ) ;
boolean can = PermissionUtils . can ( 64L , loaded . getChannelPermissions ( ) ) ;
ForumUtils forumUtils = ForumUtils . INSTANCE ;
MessageReaction messageReaction = forumUtils . getPlaceholderMessageReaction ( this . storeEmoji ) ;
ViewState . Valid valid = null ;
MessageReaction mostCommonReaction = forumPostFirstMessage ! = null ? forumUtils . mostCommonReaction ( forumPostFirstMessage , this . storeEmoji ) : null ;
long myUserId = loaded . getMyUserId ( ) ;
Channel channel = loaded . getChannel ( ) ;
Long valueOf = forumPostFirstMessage ! = null ? Long . valueOf ( forumPostFirstMessage . getId ( ) ) : null ;
if ( mostCommonReaction ! = null ) {
messageReaction = mostCommonReaction ;
}
boolean z2 = loaded . getJoinedThread ( ) ! = null ;
Integer messageCount = loaded . getMessageCount ( ) ;
int intValue = messageCount ! = null ? messageCount . intValue ( ) : 0 ;
ViewState viewState = getViewState ( ) ;
if ( viewState instanceof ViewState . Valid ) {
valid = viewState ;
}
ViewState . Valid valid2 = valid ;
updateViewState ( new ViewState . Valid ( myUserId , channel , valueOf , messageReaction , z2 , intValue , can , valid2 ! = null ? valid2 . getFollowRequestInProgress ( ) : false ) ) ;
return ;
}
updateViewState ( ViewState . Invalid . INSTANCE ) ;
}
public final void toggleFollowPost ( Context context , Channel channel ) {
m . checkNotNullParameter ( channel , " channel " ) ;
if ( ChannelUtils . j ( channel ) ) {
showArchivedThreadToast ( context ) ;
return ;
}
ViewState viewState = getViewState ( ) ;
if ( ! ( viewState instanceof ViewState . Valid ) ) {
viewState = null ;
}
ViewState . Valid valid = ( ViewState . Valid ) viewState ;
if ( valid ! = null & & ! this . followRequestInProgress ) {
this . followRequestInProgress = true ;
updateViewState ( ViewState . Valid . copy$default ( valid , 0L , null , null , null , false , 0 , false , true , Opcodes . LAND , null ) ) ;
ObservableExtensionsKt . appSubscribe$default ( ObservableExtensionsKt . ui$default ( ObservableExtensionsKt . restSubscribeOn$default ( valid . getHasJoinedThread ( ) ? RestAPI . Companion . getApi ( ) . leaveThread ( channel . k ( ) , " Thread Member List " ) : RestAPI . Companion . getApi ( ) . joinThread ( channel . k ( ) , " Thread Member List " , new RestAPIParams . EmptyBody ( ) ) , false , 1 , null ) , this , null , 2 , null ) , WidgetForumPostStatusViewModel . class , context , ( Function1 ) null , ( Function1 ) null , ( Function0 ) null , new WidgetForumPostStatusViewModel$toggleFollowPost$1 ( this , valid ) , WidgetForumPostStatusViewModel$toggleFollowPost$2 . INSTANCE , 28 , ( Object ) null ) ;
}
}
public final void toggleReaction ( Context context , long j , long j2 , Channel channel , MessageReaction messageReaction , boolean z2 ) {
m . checkNotNullParameter ( channel , " channel " ) ;
m . checkNotNullParameter ( messageReaction , " reaction " ) ;
if ( ChannelUtils . j ( channel ) ) {
showArchivedThreadToast ( context ) ;
} else if ( z2 ) {
this . userReactionHandler . toggleReaction ( j , channel . k ( ) , j2 , messageReaction ) ;
}
}
}