98 lines
6.0 KiB
Java
98 lines
6.0 KiB
Java
package com.discord.widgets.guilds.invite;
|
|
|
|
import android.content.Context;
|
|
import androidx.core.view.PointerIconCompat;
|
|
import androidx.fragment.app.FragmentManager;
|
|
import androidx.lifecycle.LifecycleOwner;
|
|
import androidx.lifecycle.LifecycleOwnerKt;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.api.channel.ChannelUtils;
|
|
import com.discord.api.guild.Guild;
|
|
import com.discord.api.guildscheduledevent.GuildScheduledEvent;
|
|
import com.discord.app.AppFragment;
|
|
import com.discord.models.domain.ModelAuditLogEntry;
|
|
import com.discord.models.domain.ModelInvite;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.utilities.channel.ChannelSelector;
|
|
import com.discord.utilities.coroutines.AppCoroutineScopeKt;
|
|
import com.discord.utilities.error.Error;
|
|
import com.discord.widgets.chat.list.TextInVoiceFeatureFlag;
|
|
import com.discord.widgets.guildscheduledevent.WidgetGuildScheduledEventDetailsBottomSheet;
|
|
import com.discord.widgets.stage.StageChannelJoinHelper;
|
|
import com.discord.widgets.voice.fullscreen.WidgetCallPreviewFullscreen;
|
|
import com.discord.widgets.voice.sheet.WidgetVoiceBottomSheet;
|
|
import d0.z.d.m;
|
|
import kotlin.Unit;
|
|
import kotlin.coroutines.Continuation;
|
|
import kotlin.coroutines.CoroutineContext;
|
|
import kotlin.jvm.functions.Function2;
|
|
import kotlinx.coroutines.CoroutineStart;
|
|
import kotlinx.coroutines.Job;
|
|
/* compiled from: InviteJoinHelper.kt */
|
|
public final class InviteJoinHelper {
|
|
public static final InviteJoinHelper INSTANCE = new InviteJoinHelper();
|
|
|
|
private InviteJoinHelper() {
|
|
}
|
|
|
|
public static final /* synthetic */ void access$navigateToChannel(InviteJoinHelper inviteJoinHelper, Context context, AppFragment appFragment, ModelInvite modelInvite) {
|
|
inviteJoinHelper.navigateToChannel(context, appFragment, modelInvite);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$navigateToGuild(InviteJoinHelper inviteJoinHelper, ModelInvite modelInvite) {
|
|
inviteJoinHelper.navigateToGuild(modelInvite);
|
|
}
|
|
|
|
public static /* synthetic */ Job joinViaInvite$default(InviteJoinHelper inviteJoinHelper, ModelInvite modelInvite, Class cls, AppFragment appFragment, String str, Function2 function2, Function2 function22, Function2 function23, String str2, int i, Object obj) {
|
|
return inviteJoinHelper.joinViaInvite(modelInvite, cls, appFragment, str, (i & 16) != 0 ? new InviteJoinHelper$joinViaInvite$1(null) : function2, (i & 32) != 0 ? new InviteJoinHelper$joinViaInvite$2(null) : function22, (i & 64) != 0 ? new InviteJoinHelper$joinViaInvite$3(null) : function23, (i & 128) != 0 ? null : str2);
|
|
}
|
|
|
|
private final void navigateToChannel(Context context, AppFragment appFragment, ModelInvite modelInvite) {
|
|
Channel channel = modelInvite.getChannel();
|
|
if (channel != null) {
|
|
ChannelSelector.Companion.getInstance().findAndSet(context, channel.h());
|
|
m.checkNotNullExpressionValue(channel, "channel");
|
|
if (ChannelUtils.E(channel)) {
|
|
if (TextInVoiceFeatureFlag.Companion.getINSTANCE().isEnabled(Long.valueOf(channel.f()))) {
|
|
WidgetCallPreviewFullscreen.Companion.launch(context, channel.h());
|
|
return;
|
|
}
|
|
WidgetVoiceBottomSheet.Companion companion = WidgetVoiceBottomSheet.Companion;
|
|
FragmentManager parentFragmentManager = appFragment.getParentFragmentManager();
|
|
m.checkNotNullExpressionValue(parentFragmentManager, "appFragment.parentFragmentManager");
|
|
companion.show(parentFragmentManager, channel.h(), true, WidgetVoiceBottomSheet.FeatureContext.HOME);
|
|
} else if (ChannelUtils.z(channel)) {
|
|
StageChannelJoinHelper stageChannelJoinHelper = StageChannelJoinHelper.INSTANCE;
|
|
Context requireContext = appFragment.requireContext();
|
|
FragmentManager parentFragmentManager2 = appFragment.getParentFragmentManager();
|
|
m.checkNotNullExpressionValue(parentFragmentManager2, "appFragment.parentFragmentManager");
|
|
StageChannelJoinHelper.connectToStage$default(stageChannelJoinHelper, requireContext, parentFragmentManager2, channel.h(), false, false, null, null, null, null, null, PointerIconCompat.TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW, null);
|
|
}
|
|
}
|
|
}
|
|
|
|
private final void navigateToGuild(ModelInvite modelInvite) {
|
|
Guild guild = modelInvite.guild;
|
|
if (guild != null) {
|
|
StoreStream.Companion.getGuildSelected().set(guild.r());
|
|
}
|
|
GuildScheduledEvent guildScheduledEvent = modelInvite.getGuildScheduledEvent();
|
|
if (guildScheduledEvent != null) {
|
|
WidgetGuildScheduledEventDetailsBottomSheet.Companion.enqueue(guildScheduledEvent.i());
|
|
}
|
|
}
|
|
|
|
public final Job joinViaInvite(ModelInvite modelInvite, Class<?> cls, AppFragment appFragment, String str, Function2<? super Error, ? super Continuation<? super Unit>, ? extends Object> function2, Function2<? super ModelInvite, ? super Continuation<? super Unit>, ? extends Object> function22, Function2<? super ModelInvite, ? super Continuation<? super Unit>, ? extends Object> function23, String str2) {
|
|
m.checkNotNullParameter(modelInvite, "invite");
|
|
m.checkNotNullParameter(cls, "javaClass");
|
|
m.checkNotNullParameter(appFragment, "fragment");
|
|
m.checkNotNullParameter(str, ModelAuditLogEntry.CHANGE_KEY_LOCATION);
|
|
m.checkNotNullParameter(function2, "onInvitePostError");
|
|
m.checkNotNullParameter(function22, "onInvitePostSuccess");
|
|
m.checkNotNullParameter(function23, "onInviteFlowFinished");
|
|
LifecycleOwner viewLifecycleOwner = appFragment.getViewLifecycleOwner();
|
|
m.checkNotNullExpressionValue(viewLifecycleOwner, "fragment.viewLifecycleOwner");
|
|
return AppCoroutineScopeKt.appLaunch$default(LifecycleOwnerKt.getLifecycleScope(viewLifecycleOwner), cls, (CoroutineContext) null, (CoroutineStart) null, new InviteJoinHelper$joinViaInvite$4(appFragment, modelInvite, str, function22, str2, cls, function2, function23, null), 6, (Object) null);
|
|
}
|
|
}
|