587 lines
33 KiB
Java
587 lines
33 KiB
Java
package com.discord.widgets.chat.list.adapter;
|
|
|
|
import a0.a.a.b;
|
|
import android.content.Context;
|
|
import android.net.Uri;
|
|
import androidx.appcompat.widget.ActivityChooserModel;
|
|
import androidx.core.app.NotificationCompat;
|
|
import androidx.fragment.app.FragmentManager;
|
|
import c.d.b.a.a;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.discord.R;
|
|
import com.discord.analytics.generated.events.TrackWelcomeCtaClicked;
|
|
import com.discord.api.activity.Activity;
|
|
import com.discord.api.application.Application;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.api.message.MessageReference;
|
|
import com.discord.api.message.activity.MessageActivityType;
|
|
import com.discord.api.message.reaction.MessageReaction;
|
|
import com.discord.api.message.reaction.MessageReactionUpdate;
|
|
import com.discord.api.sticker.BaseSticker;
|
|
import com.discord.api.sticker.Sticker;
|
|
import com.discord.api.sticker.StickerType;
|
|
import com.discord.api.user.User;
|
|
import com.discord.app.AppFragment;
|
|
import com.discord.models.domain.ModelAuditLogEntry;
|
|
import com.discord.models.domain.emoji.Emoji;
|
|
import com.discord.models.message.Message;
|
|
import com.discord.models.user.CoreUser;
|
|
import com.discord.restapi.RestAPIParams;
|
|
import com.discord.stores.SelectedChannelAnalyticsLocation;
|
|
import com.discord.stores.StoreChat;
|
|
import com.discord.stores.StoreEmoji;
|
|
import com.discord.stores.StoreMessages;
|
|
import com.discord.stores.StorePendingReplies;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.stores.StoreUser;
|
|
import com.discord.utilities.analytics.AnalyticsTracker;
|
|
import com.discord.utilities.analytics.AnalyticsUtils;
|
|
import com.discord.utilities.analytics.Traits;
|
|
import com.discord.utilities.channel.ChannelSelector;
|
|
import com.discord.utilities.guilds.MemberVerificationUtils;
|
|
import com.discord.utilities.guilds.PublicGuildUtils;
|
|
import com.discord.utilities.rest.RestAPI;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.stickers.StickerUtils;
|
|
import com.discord.widgets.channels.list.WidgetChannelsListItemThreadActions;
|
|
import com.discord.widgets.chat.MessageManager;
|
|
import com.discord.widgets.chat.WidgetUrlActions;
|
|
import com.discord.widgets.chat.input.AppFlexInputViewModel;
|
|
import com.discord.widgets.chat.input.MentionUtilsKt;
|
|
import com.discord.widgets.chat.list.actions.WidgetChatListActions;
|
|
import com.discord.widgets.chat.list.adapter.WidgetChatListAdapter;
|
|
import com.discord.widgets.chat.list.adapter.WidgetChatListAdapterItemCallMessage;
|
|
import com.discord.widgets.chat.list.sheet.WidgetApplicationCommandBottomSheet;
|
|
import com.discord.widgets.chat.pins.WidgetChannelPinnedMessages;
|
|
import com.discord.widgets.guilds.profile.WidgetGuildProfileSheet;
|
|
import com.discord.widgets.guilds.profile.WidgetPublicAnnouncementProfileSheet;
|
|
import com.discord.widgets.user.usersheet.WidgetUserSheet;
|
|
import com.discord.widgets.voice.fullscreen.WidgetCallFullscreen;
|
|
import com.discord.widgets.voice.fullscreen.WidgetStartCallSheet;
|
|
import d0.o;
|
|
import d0.t.h0;
|
|
import d0.z.d.k;
|
|
import d0.z.d.m;
|
|
import j0.l.a.l2;
|
|
import j0.l.a.r;
|
|
import java.lang.ref.WeakReference;
|
|
import java.util.Objects;
|
|
import java.util.concurrent.TimeUnit;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import rx.Observable;
|
|
import rx.subjects.PublishSubject;
|
|
import rx.subjects.Subject;
|
|
/* compiled from: WidgetChatListAdapterEventsHandler.kt */
|
|
public final class WidgetChatListAdapterEventsHandler implements WidgetChatListAdapter.EventHandler {
|
|
private final AnalyticsUtils.Tracker analyticsTracker;
|
|
private final ChannelSelector channelSelector;
|
|
private final AppFlexInputViewModel flexInputViewModel;
|
|
private final AppFragment host;
|
|
private final MessageManager messageManager;
|
|
private final StoreChat storeChat;
|
|
private final StoreEmoji storeEmoji;
|
|
private final StoreMessages storeMessages;
|
|
private final StorePendingReplies storePendingReplies;
|
|
private final StoreUser storeUser;
|
|
private final UserReactionHandler userReactionHandler;
|
|
|
|
/* compiled from: WidgetChatListAdapterEventsHandler.kt */
|
|
public static final class UserReactionHandler {
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final long REQUEST_RATE_LIMIT_MILLIS = 250;
|
|
private final Function1<MessageReactionUpdate, Unit> commitReactionAdd = new WidgetChatListAdapterEventsHandler$UserReactionHandler$commitReactionAdd$1(this);
|
|
private final Function1<MessageReactionUpdate, Unit> commitReactionRemove = new WidgetChatListAdapterEventsHandler$UserReactionHandler$commitReactionRemove$1(this);
|
|
private final AppFragment host;
|
|
private final Subject<UpdateRequest, UpdateRequest> requestStream;
|
|
private final StoreEmoji storeEmoji;
|
|
private final StoreMessages storeMessages;
|
|
|
|
/* compiled from: WidgetChatListAdapterEventsHandler.kt */
|
|
/* renamed from: com.discord.widgets.chat.list.adapter.WidgetChatListAdapterEventsHandler$UserReactionHandler$1 reason: invalid class name */
|
|
public static final /* synthetic */ class AnonymousClass1 extends k implements Function1<UpdateRequest, Unit> {
|
|
public AnonymousClass1(UserReactionHandler userReactionHandler) {
|
|
super(1, userReactionHandler, UserReactionHandler.class, "requestReactionUpdate", "requestReactionUpdate(Lcom/discord/widgets/chat/list/adapter/WidgetChatListAdapterEventsHandler$UserReactionHandler$UpdateRequest;)V", 0);
|
|
}
|
|
|
|
/* 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] */
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public /* bridge */ /* synthetic */ Unit invoke(UpdateRequest updateRequest) {
|
|
invoke(updateRequest);
|
|
return Unit.a;
|
|
}
|
|
|
|
public final void invoke(UpdateRequest updateRequest) {
|
|
m.checkNotNullParameter(updateRequest, "p1");
|
|
UserReactionHandler.access$requestReactionUpdate((UserReactionHandler) this.receiver, updateRequest);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetChatListAdapterEventsHandler.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetChatListAdapterEventsHandler.kt */
|
|
public static final class UpdateRequest {
|
|
private final long channelId;
|
|
private final long messageId;
|
|
private final MessageReaction reaction;
|
|
private final long userId;
|
|
|
|
public UpdateRequest(long j, long j2, long j3, MessageReaction messageReaction) {
|
|
m.checkNotNullParameter(messageReaction, "reaction");
|
|
this.userId = j;
|
|
this.channelId = j2;
|
|
this.messageId = j3;
|
|
this.reaction = messageReaction;
|
|
}
|
|
|
|
public static /* synthetic */ UpdateRequest copy$default(UpdateRequest updateRequest, long j, long j2, long j3, MessageReaction messageReaction, int i, Object obj) {
|
|
return updateRequest.copy((i & 1) != 0 ? updateRequest.userId : j, (i & 2) != 0 ? updateRequest.channelId : j2, (i & 4) != 0 ? updateRequest.messageId : j3, (i & 8) != 0 ? updateRequest.reaction : messageReaction);
|
|
}
|
|
|
|
public final long component1() {
|
|
return this.userId;
|
|
}
|
|
|
|
public final long component2() {
|
|
return this.channelId;
|
|
}
|
|
|
|
public final long component3() {
|
|
return this.messageId;
|
|
}
|
|
|
|
public final MessageReaction component4() {
|
|
return this.reaction;
|
|
}
|
|
|
|
public final UpdateRequest copy(long j, long j2, long j3, MessageReaction messageReaction) {
|
|
m.checkNotNullParameter(messageReaction, "reaction");
|
|
return new UpdateRequest(j, j2, j3, messageReaction);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof UpdateRequest)) {
|
|
return false;
|
|
}
|
|
UpdateRequest updateRequest = (UpdateRequest) obj;
|
|
return this.userId == updateRequest.userId && this.channelId == updateRequest.channelId && this.messageId == updateRequest.messageId && m.areEqual(this.reaction, updateRequest.reaction);
|
|
}
|
|
|
|
public final long getChannelId() {
|
|
return this.channelId;
|
|
}
|
|
|
|
public final long getMessageId() {
|
|
return this.messageId;
|
|
}
|
|
|
|
public final MessageReaction getReaction() {
|
|
return this.reaction;
|
|
}
|
|
|
|
public final long getUserId() {
|
|
return this.userId;
|
|
}
|
|
|
|
public int hashCode() {
|
|
int a = (b.a(this.messageId) + ((b.a(this.channelId) + (b.a(this.userId) * 31)) * 31)) * 31;
|
|
MessageReaction messageReaction = this.reaction;
|
|
return a + (messageReaction != null ? messageReaction.hashCode() : 0);
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder P = a.P("UpdateRequest(userId=");
|
|
P.append(this.userId);
|
|
P.append(", channelId=");
|
|
P.append(this.channelId);
|
|
P.append(", messageId=");
|
|
P.append(this.messageId);
|
|
P.append(", reaction=");
|
|
P.append(this.reaction);
|
|
P.append(")");
|
|
return P.toString();
|
|
}
|
|
}
|
|
|
|
public UserReactionHandler(AppFragment appFragment, StoreMessages storeMessages, StoreEmoji storeEmoji) {
|
|
m.checkNotNullParameter(appFragment, "host");
|
|
m.checkNotNullParameter(storeMessages, "storeMessages");
|
|
m.checkNotNullParameter(storeEmoji, "storeEmoji");
|
|
this.host = appFragment;
|
|
this.storeMessages = storeMessages;
|
|
this.storeEmoji = storeEmoji;
|
|
PublishSubject j02 = PublishSubject.j0();
|
|
m.checkNotNullExpressionValue(j02, "PublishSubject.create()");
|
|
this.requestStream = j02;
|
|
TimeUnit timeUnit = TimeUnit.MILLISECONDS;
|
|
Objects.requireNonNull(j02);
|
|
Observable g02 = Observable.g0(new r(j02.i, new l2(REQUEST_RATE_LIMIT_MILLIS, timeUnit, j0.p.a.a())));
|
|
m.checkNotNullExpressionValue(g02, "requestStream\n …S, TimeUnit.MILLISECONDS)");
|
|
ObservableExtensionsKt.appSubscribe$default(g02, appFragment.getClass(), appFragment.getContext(), (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass1(this), 60, (Object) null);
|
|
}
|
|
|
|
public static final /* synthetic */ StoreEmoji access$getStoreEmoji$p(UserReactionHandler userReactionHandler) {
|
|
return userReactionHandler.storeEmoji;
|
|
}
|
|
|
|
public static final /* synthetic */ StoreMessages access$getStoreMessages$p(UserReactionHandler userReactionHandler) {
|
|
return userReactionHandler.storeMessages;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$requestReactionUpdate(UserReactionHandler userReactionHandler, UpdateRequest updateRequest) {
|
|
userReactionHandler.requestReactionUpdate(updateRequest);
|
|
}
|
|
|
|
private final void requestReactionUpdate(UpdateRequest updateRequest) {
|
|
String str;
|
|
long component1 = updateRequest.component1();
|
|
long component2 = updateRequest.component2();
|
|
long component3 = updateRequest.component3();
|
|
MessageReaction component4 = updateRequest.component4();
|
|
MessageReactionUpdate messageReactionUpdate = new MessageReactionUpdate(component1, component2, component3, component4.b());
|
|
if (component4.b().e()) {
|
|
str = component4.b().d() + MentionUtilsKt.EMOJIS_AND_STICKERS_CHAR + component4.b().b();
|
|
} else {
|
|
str = component4.b().d();
|
|
if (str == null) {
|
|
str = "";
|
|
}
|
|
}
|
|
Observable<Void> removeSelfReaction = component4.c() ? RestAPI.Companion.getApi().removeSelfReaction(component2, component3, str) : RestAPI.Companion.getApi().addReaction(component2, component3, str);
|
|
Function1<MessageReactionUpdate, Unit> function1 = component4.c() ? this.commitReactionRemove : this.commitReactionAdd;
|
|
Function1<MessageReactionUpdate, Unit> function12 = component4.c() ? this.commitReactionAdd : this.commitReactionRemove;
|
|
function1.invoke(messageReactionUpdate);
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(removeSelfReaction, false, 1, null), this.host, null, 2, null), this.host.getClass(), this.host.getContext(), (Function1) null, new WidgetChatListAdapterEventsHandler$UserReactionHandler$requestReactionUpdate$2(function12, messageReactionUpdate), (Function0) null, (Function0) null, new WidgetChatListAdapterEventsHandler$UserReactionHandler$requestReactionUpdate$1(this, component4), 52, (Object) null);
|
|
}
|
|
|
|
public final void addNewReaction(Emoji emoji, long j, long j2) {
|
|
m.checkNotNullParameter(emoji, "emoji");
|
|
RestAPI api = RestAPI.Companion.getApi();
|
|
String reactionKey = emoji.getReactionKey();
|
|
m.checkNotNullExpressionValue(reactionKey, "emoji.reactionKey");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(api.addReaction(j, j2, reactionKey), false, 1, null), this.host, null, 2, null), this.host.getClass(), this.host.getContext(), (Function1) null, (Function1) null, (Function0) null, (Function0) null, WidgetChatListAdapterEventsHandler$UserReactionHandler$addNewReaction$1.INSTANCE, 60, (Object) null);
|
|
}
|
|
|
|
public final void toggleReaction(long j, long j2, long j3, MessageReaction messageReaction) {
|
|
m.checkNotNullParameter(messageReaction, "reaction");
|
|
this.requestStream.onNext(new UpdateRequest(j, j2, j3, messageReaction));
|
|
}
|
|
}
|
|
|
|
public final /* synthetic */ class WhenMappings {
|
|
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
|
|
public static final /* synthetic */ int[] $EnumSwitchMapping$1;
|
|
|
|
static {
|
|
WidgetChatListAdapterItemCallMessage.CallStatus.values();
|
|
int[] iArr = new int[4];
|
|
$EnumSwitchMapping$0 = iArr;
|
|
iArr[WidgetChatListAdapterItemCallMessage.CallStatus.ACTIVE_JOINED.ordinal()] = 1;
|
|
iArr[WidgetChatListAdapterItemCallMessage.CallStatus.ACTIVE_UNJOINED.ordinal()] = 2;
|
|
StickerType.values();
|
|
int[] iArr2 = new int[3];
|
|
$EnumSwitchMapping$1 = iArr2;
|
|
iArr2[StickerType.STANDARD.ordinal()] = 1;
|
|
iArr2[StickerType.GUILD.ordinal()] = 2;
|
|
}
|
|
}
|
|
|
|
public WidgetChatListAdapterEventsHandler(AppFragment appFragment, AppFlexInputViewModel appFlexInputViewModel, StoreChat storeChat, StoreMessages storeMessages, StorePendingReplies storePendingReplies, StoreUser storeUser, StoreEmoji storeEmoji, MessageManager messageManager, ChannelSelector channelSelector, UserReactionHandler userReactionHandler, AnalyticsUtils.Tracker tracker) {
|
|
m.checkNotNullParameter(appFragment, "host");
|
|
m.checkNotNullParameter(appFlexInputViewModel, "flexInputViewModel");
|
|
m.checkNotNullParameter(storeChat, "storeChat");
|
|
m.checkNotNullParameter(storeMessages, "storeMessages");
|
|
m.checkNotNullParameter(storePendingReplies, "storePendingReplies");
|
|
m.checkNotNullParameter(storeUser, "storeUser");
|
|
m.checkNotNullParameter(storeEmoji, "storeEmoji");
|
|
m.checkNotNullParameter(messageManager, "messageManager");
|
|
m.checkNotNullParameter(channelSelector, "channelSelector");
|
|
m.checkNotNullParameter(userReactionHandler, "userReactionHandler");
|
|
m.checkNotNullParameter(tracker, "analyticsTracker");
|
|
this.host = appFragment;
|
|
this.flexInputViewModel = appFlexInputViewModel;
|
|
this.storeChat = storeChat;
|
|
this.storeMessages = storeMessages;
|
|
this.storePendingReplies = storePendingReplies;
|
|
this.storeUser = storeUser;
|
|
this.storeEmoji = storeEmoji;
|
|
this.messageManager = messageManager;
|
|
this.channelSelector = channelSelector;
|
|
this.userReactionHandler = userReactionHandler;
|
|
this.analyticsTracker = tracker;
|
|
}
|
|
|
|
/* JADX WARNING: Illegal instructions before constructor call */
|
|
public /* synthetic */ WidgetChatListAdapterEventsHandler(AppFragment appFragment, AppFlexInputViewModel appFlexInputViewModel, StoreChat storeChat, StoreMessages storeMessages, StorePendingReplies storePendingReplies, StoreUser storeUser, StoreEmoji storeEmoji, MessageManager messageManager, ChannelSelector channelSelector, UserReactionHandler userReactionHandler, AnalyticsUtils.Tracker tracker, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(appFragment, appFlexInputViewModel, r5, r6, r7, r8, r9, (i & 128) != 0 ? new MessageManager(appFragment.requireContext(), null, null, null, null, null, null, null, 254, null) : messageManager, (i & 256) != 0 ? ChannelSelector.Companion.getInstance() : channelSelector, (i & 512) != 0 ? new UserReactionHandler(appFragment, r6, r9) : userReactionHandler, (i & 1024) != 0 ? AnalyticsUtils.Tracker.Companion.getInstance() : tracker);
|
|
StoreChat chat = (i & 4) != 0 ? StoreStream.Companion.getChat() : storeChat;
|
|
StoreMessages messages = (i & 8) != 0 ? StoreStream.Companion.getMessages() : storeMessages;
|
|
StorePendingReplies pendingReplies = (i & 16) != 0 ? StoreStream.Companion.getPendingReplies() : storePendingReplies;
|
|
StoreUser users = (i & 32) != 0 ? StoreStream.Companion.getUsers() : storeUser;
|
|
StoreEmoji emojis = (i & 64) != 0 ? StoreStream.Companion.getEmojis() : storeEmoji;
|
|
}
|
|
|
|
public static final /* synthetic */ Context access$getContext$p(WidgetChatListAdapterEventsHandler widgetChatListAdapterEventsHandler) {
|
|
return widgetChatListAdapterEventsHandler.getContext();
|
|
}
|
|
|
|
public static final /* synthetic */ FragmentManager access$getFragmentManager$p(WidgetChatListAdapterEventsHandler widgetChatListAdapterEventsHandler) {
|
|
return widgetChatListAdapterEventsHandler.getFragmentManager();
|
|
}
|
|
|
|
public static final /* synthetic */ UserReactionHandler access$getUserReactionHandler$p(WidgetChatListAdapterEventsHandler widgetChatListAdapterEventsHandler) {
|
|
return widgetChatListAdapterEventsHandler.userReactionHandler;
|
|
}
|
|
|
|
private final Context getContext() {
|
|
return this.host.requireContext();
|
|
}
|
|
|
|
private final FragmentManager getFragmentManager() {
|
|
FragmentManager parentFragmentManager = this.host.getParentFragmentManager();
|
|
m.checkNotNullExpressionValue(parentFragmentManager, "host.parentFragmentManager");
|
|
return parentFragmentManager;
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onBotUiComponentClicked(long j, Long l, long j2, long j3, Long l2, int i, RestAPIParams.ComponentInteractionData componentInteractionData) {
|
|
m.checkNotNullParameter(componentInteractionData, "componentSendData");
|
|
StoreStream.Companion.getInteractions().sendComponentInteraction(j, l, j2, j3, i, componentInteractionData, l2);
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onCallMessageClicked(long j, WidgetChatListAdapterItemCallMessage.CallStatus callStatus) {
|
|
m.checkNotNullParameter(callStatus, "callStatus");
|
|
int ordinal = callStatus.ordinal();
|
|
if (ordinal == 0) {
|
|
AnimatableValueParser.s2(this.host, null, new WidgetChatListAdapterEventsHandler$onCallMessageClicked$1(this, j), 1, null);
|
|
} else if (ordinal != 1) {
|
|
WidgetStartCallSheet.Companion.show(j, getFragmentManager());
|
|
} else {
|
|
WidgetCallFullscreen.Companion.launch$default(WidgetCallFullscreen.Companion, getContext(), j, false, null, null, 28, null);
|
|
}
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onCommandClicked(long j, Long l, long j2, long j3, long j4, long j5, String str) {
|
|
WidgetApplicationCommandBottomSheet.Companion companion = WidgetApplicationCommandBottomSheet.Companion;
|
|
FragmentManager childFragmentManager = this.host.getChildFragmentManager();
|
|
m.checkNotNullExpressionValue(childFragmentManager, "host.childFragmentManager");
|
|
companion.show(childFragmentManager, j, j3, j2, l, j4, j5, str);
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onDismissClicked(Message message) {
|
|
m.checkNotNullParameter(message, "message");
|
|
this.storeMessages.deleteMessage(message);
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onInteractionStateUpdated(StoreChat.InteractionState interactionState) {
|
|
m.checkNotNullParameter(interactionState, "interactionState");
|
|
this.storeChat.setInteractionState(interactionState);
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onListClicked() {
|
|
AppFragment.hideKeyboard$default(this.host, null, 1, null);
|
|
this.flexInputViewModel.hideExpressionTray();
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onMessageAuthorAvatarClicked(Message message, long j) {
|
|
m.checkNotNullParameter(message, "message");
|
|
if (PublicGuildUtils.INSTANCE.isPublicGuildSystemMessage(message) || message.isCrosspost()) {
|
|
onMessageAuthorNameClicked(message, j);
|
|
return;
|
|
}
|
|
User author = message.getAuthor();
|
|
if (author != null) {
|
|
WidgetUserSheet.Companion.show$default(WidgetUserSheet.Companion, author.i(), Long.valueOf(message.getChannelId()), getFragmentManager(), Long.valueOf(j), null, null, null, 112, null);
|
|
}
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onMessageAuthorLongClicked(Message message, Long l) {
|
|
m.checkNotNullParameter(message, "message");
|
|
if (!message.isWebhook()) {
|
|
User author = message.getAuthor();
|
|
if (author != null) {
|
|
WidgetUserSheet.Companion.show$default(WidgetUserSheet.Companion, author.i(), Long.valueOf(message.getChannelId()), getFragmentManager(), l, null, null, null, 112, null);
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
c.a.d.m.g(getContext(), R.string.user_profile_failure_to_open_message, 0, null, 8);
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onMessageAuthorNameClicked(Message message, long j) {
|
|
m.checkNotNullParameter(message, "message");
|
|
if (PublicGuildUtils.INSTANCE.isPublicGuildSystemMessage(message)) {
|
|
WidgetPublicAnnouncementProfileSheet.Companion.show(getFragmentManager());
|
|
} else if (!message.isCrosspost() || message.getMessageReference() == null) {
|
|
StoreChat storeChat = this.storeChat;
|
|
User author = message.getAuthor();
|
|
m.checkNotNull(author);
|
|
storeChat.appendMention(new CoreUser(author), j);
|
|
} else {
|
|
MessageReference messageReference = message.getMessageReference();
|
|
Long l = null;
|
|
Long a = messageReference != null ? messageReference.a() : null;
|
|
MessageReference messageReference2 = message.getMessageReference();
|
|
if (messageReference2 != null) {
|
|
l = messageReference2.b();
|
|
}
|
|
if (l != null && a != null) {
|
|
WidgetGuildProfileSheet.Companion.show$default(WidgetGuildProfileSheet.Companion, getFragmentManager(), false, l.longValue(), a.longValue(), false, 16, null);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onMessageBlockedGroupClicked(Message message) {
|
|
m.checkNotNullParameter(message, "message");
|
|
this.storeChat.toggleBlockedMessageGroup(message.getId());
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onMessageClicked(Message message, boolean z2) {
|
|
m.checkNotNullParameter(message, "message");
|
|
if (z2) {
|
|
StoreStream.Companion.getMessagesLoader().jumpToMessage(message.getChannelId(), message.getId());
|
|
}
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onMessageLongClicked(Message message, CharSequence charSequence, boolean z2) {
|
|
m.checkNotNullParameter(message, "message");
|
|
m.checkNotNullParameter(charSequence, "formattedMessage");
|
|
if (!z2) {
|
|
WidgetChatListActions.Companion.showForChat(getFragmentManager(), message.getChannelId(), message.getId(), charSequence);
|
|
}
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onOldestMessageId(long j, long j2) {
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onOpenPinsClicked(Message message) {
|
|
m.checkNotNullParameter(message, "message");
|
|
WidgetChannelPinnedMessages.Companion.show(getContext(), message.getChannelId());
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onQuickAddReactionClicked(long j, long j2, long j3, long j4) {
|
|
MemberVerificationUtils.maybeShowVerificationGate$default(MemberVerificationUtils.INSTANCE, getContext(), getFragmentManager(), j, Traits.Location.Section.EMOJI_PICKER_POPOUT, null, null, new WidgetChatListAdapterEventsHandler$onQuickAddReactionClicked$1(this, j3, j4), 32, null);
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public boolean onQuickDownloadClicked(Uri uri, String str) {
|
|
m.checkNotNullParameter(uri, NotificationCompat.MessagingStyle.Message.KEY_DATA_URI);
|
|
m.checkNotNullParameter(str, "fileName");
|
|
this.host.requestMediaDownload(new WidgetChatListAdapterEventsHandler$onQuickDownloadClicked$1(this, uri, str, new WeakReference(getContext())));
|
|
return true;
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onReactionClicked(long j, long j2, long j3, long j4, MessageReaction messageReaction, boolean z2) {
|
|
m.checkNotNullParameter(messageReaction, "reaction");
|
|
if (z2) {
|
|
MemberVerificationUtils.maybeShowVerificationGate$default(MemberVerificationUtils.INSTANCE, getContext(), getFragmentManager(), j, Traits.Location.Section.EMOJI_PICKER_POPOUT, null, null, new WidgetChatListAdapterEventsHandler$onReactionClicked$1(this, j2, j3, j4, messageReaction), 32, null);
|
|
} else {
|
|
c.a.d.m.g(getContext(), R.string.archived_thread_reactions_disabled_toast, 0, null, 8);
|
|
}
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onReactionLongClicked(long j, long j2, long j3, MessageReaction messageReaction) {
|
|
m.checkNotNullParameter(messageReaction, "reaction");
|
|
MemberVerificationUtils.maybeShowVerificationGate$default(MemberVerificationUtils.INSTANCE, getContext(), getFragmentManager(), j, Traits.Location.Section.EMOJI_PICKER_POPOUT, null, null, new WidgetChatListAdapterEventsHandler$onReactionLongClicked$1(this, j2, j3, messageReaction), 32, null);
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onSendGreetMessageClicked(long j, int i, Sticker sticker) {
|
|
m.checkNotNullParameter(sticker, "sticker");
|
|
AnalyticsTracker.INSTANCE.getTracker().track("dm_empty_action", h0.mutableMapOf(o.to(ModelAuditLogEntry.CHANGE_KEY_CHANNEL_ID, Long.valueOf(j)), o.to("channel_type", Integer.valueOf(i)), o.to("source", "Wave"), o.to("type", "Send wave")));
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(RestAPI.Companion.getApi().sendGreetMessage(j, new RestAPIParams.GreetMessage(d0.t.m.listOf(Long.valueOf(sticker.getId())))), false, 1, null), this.host, null, 2, null), this.host.getClass(), this.host.getContext(), (Function1) null, (Function1) null, (Function0) null, (Function0) null, WidgetChatListAdapterEventsHandler$onSendGreetMessageClicked$1.INSTANCE, 60, (Object) null);
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onStickerClicked(Message message, BaseSticker baseSticker) {
|
|
m.checkNotNullParameter(message, "message");
|
|
m.checkNotNullParameter(baseSticker, "sticker");
|
|
WidgetChatListAdapterEventsHandler$onStickerClicked$1 widgetChatListAdapterEventsHandler$onStickerClicked$1 = new WidgetChatListAdapterEventsHandler$onStickerClicked$1(this, baseSticker, message);
|
|
this.flexInputViewModel.hideKeyboard();
|
|
if (baseSticker instanceof Sticker) {
|
|
widgetChatListAdapterEventsHandler$onStickerClicked$1.invoke(baseSticker);
|
|
} else {
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(StickerUtils.INSTANCE.getGuildOrStandardSticker(baseSticker.d(), true), this.host, null, 2, null), WidgetChatListAdapterEventsHandler.class, (Context) null, (Function1) null, new WidgetChatListAdapterEventsHandler$onStickerClicked$2(this, baseSticker), (Function0) null, (Function0) null, new WidgetChatListAdapterEventsHandler$onStickerClicked$3(widgetChatListAdapterEventsHandler$onStickerClicked$1), 54, (Object) null);
|
|
}
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onThreadClicked(Channel channel) {
|
|
m.checkNotNullParameter(channel, "channel");
|
|
this.channelSelector.selectChannel(channel, Long.valueOf(channel.r()), SelectedChannelAnalyticsLocation.EMBED);
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onThreadLongClicked(Channel channel) {
|
|
m.checkNotNullParameter(channel, "channel");
|
|
WidgetChannelsListItemThreadActions.Companion.show(getFragmentManager(), channel.h());
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onUrlLongClicked(String str) {
|
|
m.checkNotNullParameter(str, "url");
|
|
WidgetUrlActions.Companion.launch(getFragmentManager(), str);
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onUserActivityAction(long j, long j2, long j3, MessageActivityType messageActivityType, Activity activity, Application application) {
|
|
m.checkNotNullParameter(messageActivityType, "actionType");
|
|
m.checkNotNullParameter(activity, ActivityChooserModel.ATTRIBUTE_ACTIVITY);
|
|
m.checkNotNullParameter(application, "application");
|
|
Long a = activity.a();
|
|
String k = activity.k();
|
|
if (a != null && k != null && messageActivityType == MessageActivityType.JOIN) {
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(RestAPI.Companion.getApi().userActivityActionJoin(j, a.longValue(), k, Long.valueOf(j2), Long.valueOf(j3)), false, 1, null), this.host, null, 2, null), WidgetChatListAdapterEventsHandler.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetChatListAdapterEventsHandler$onUserActivityAction$1(this, application), 62, (Object) null);
|
|
}
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onUserMentionClicked(long j, long j2, long j3) {
|
|
WidgetUserSheet.Companion.show$default(WidgetUserSheet.Companion, j, Long.valueOf(j2), getFragmentManager(), Long.valueOf(j3), null, null, null, 112, null);
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler
|
|
public void onWelcomeCtaClicked(Message message, Channel channel, BaseSticker baseSticker) {
|
|
m.checkNotNullParameter(message, "message");
|
|
m.checkNotNullParameter(channel, "channel");
|
|
m.checkNotNullParameter(baseSticker, "sticker");
|
|
this.storePendingReplies.onCreatePendingReply(channel, message, true, true);
|
|
MessageManager.sendMessage$default(this.messageManager, null, null, null, null, d0.t.m.listOf(baseSticker), false, null, null, null, 495, null);
|
|
AnalyticsUtils.Tracker tracker = this.analyticsTracker;
|
|
Boolean bool = Boolean.TRUE;
|
|
String valueOf = String.valueOf(baseSticker.d());
|
|
User author = message.getAuthor();
|
|
tracker.track(new TrackWelcomeCtaClicked(bool, valueOf, author != null ? Long.valueOf(author.i()) : null, Long.valueOf(this.storeUser.getMe().getId())));
|
|
}
|
|
}
|