discord-jadx/app/src/main/java/com/discord/widgets/home/WidgetHomeHeaderManager$get...

75 lines
3.7 KiB
Java
Raw Normal View History

2021-06-27 20:44:35 +00:00
package com.discord.widgets.home;
import android.content.Context;
import android.view.MenuItem;
import androidx.fragment.app.FragmentManager;
import com.discord.R;
2021-06-27 20:44:35 +00:00
import com.discord.api.channel.Channel;
2021-10-19 23:48:27 +00:00
import com.discord.api.channel.ChannelUtils;
2021-06-27 20:44:35 +00:00
import com.discord.app.AppFragment;
import com.discord.stores.StoreStream;
import com.discord.utilities.channel.ChannelInviteLaunchUtils;
import com.discord.widgets.friends.WidgetFriendsAdd;
import com.discord.widgets.search.WidgetSearch;
import com.discord.widgets.user.calls.PrivateCallLauncher;
2021-11-08 18:25:28 +00:00
import d0.z.d.m;
2021-06-27 20:44:35 +00:00
import rx.functions.Action2;
/* compiled from: WidgetHomeHeaderManager.kt */
public final class WidgetHomeHeaderManager$getOnSelectedAction$1 implements Action2<MenuItem, Context> {
public final /* synthetic */ AppFragment $appFragment;
public final /* synthetic */ PanelLayout $panelLayout;
public final /* synthetic */ WidgetHomeModel $this_getOnSelectedAction;
public WidgetHomeHeaderManager$getOnSelectedAction$1(WidgetHomeModel widgetHomeModel, AppFragment appFragment, PanelLayout panelLayout) {
this.$this_getOnSelectedAction = widgetHomeModel;
this.$appFragment = appFragment;
this.$panelLayout = panelLayout;
}
private final void launchForSearch(Context context) {
Channel channel = this.$this_getOnSelectedAction.getChannel();
2021-11-03 22:42:40 +00:00
if (channel == null || !ChannelUtils.x(channel)) {
2021-06-27 20:44:35 +00:00
Channel channel2 = this.$this_getOnSelectedAction.getChannel();
2021-11-23 19:35:19 +00:00
if (channel2 != null && ChannelUtils.s(channel2)) {
2021-07-13 20:48:29 +00:00
WidgetSearch.Companion.launchForGuild(this.$this_getOnSelectedAction.getChannel().f(), context);
2021-06-27 20:44:35 +00:00
return;
}
return;
}
WidgetSearch.Companion.launchForChannel(this.$this_getOnSelectedAction.getChannelId(), context);
}
public void call(MenuItem menuItem, Context context) {
m.checkNotNullParameter(menuItem, "menuItem");
m.checkNotNullParameter(context, "context");
AppFragment appFragment = this.$appFragment;
FragmentManager parentFragmentManager = appFragment.getParentFragmentManager();
m.checkNotNullExpressionValue(parentFragmentManager, "appFragment.parentFragmentManager");
PrivateCallLauncher privateCallLauncher = new PrivateCallLauncher(appFragment, appFragment, context, parentFragmentManager);
switch (menuItem.getItemId()) {
2022-01-19 20:19:48 +00:00
case R.id.menu_chat_add_friend /* 2131364298 */:
2021-06-27 20:44:35 +00:00
WidgetFriendsAdd.Companion.show$default(WidgetFriendsAdd.Companion, context, null, "Toolbar", 2, null);
break;
2022-01-19 20:19:48 +00:00
case R.id.menu_chat_search /* 2131364299 */:
2021-06-27 20:44:35 +00:00
launchForSearch(context);
break;
2022-01-19 20:19:48 +00:00
case R.id.menu_chat_side_panel /* 2131364300 */:
2021-06-27 20:44:35 +00:00
this.$panelLayout.openEndPanel();
break;
2022-01-19 20:19:48 +00:00
case R.id.menu_chat_start_call /* 2131364301 */:
2021-06-27 20:44:35 +00:00
privateCallLauncher.launchVoiceCall(this.$this_getOnSelectedAction.getChannelId());
break;
2022-01-19 20:19:48 +00:00
case R.id.menu_chat_start_group /* 2131364302 */:
2021-09-14 19:31:33 +00:00
ChannelInviteLaunchUtils.inviteToChannel$default(ChannelInviteLaunchUtils.INSTANCE, this.$appFragment, this.$this_getOnSelectedAction.getChannel(), "Toolbar", null, null, 24, null);
2021-06-27 20:44:35 +00:00
break;
2022-01-19 20:19:48 +00:00
case R.id.menu_chat_start_video_call /* 2131364303 */:
2021-06-27 20:44:35 +00:00
privateCallLauncher.launchVideoCall(this.$this_getOnSelectedAction.getChannelId());
break;
2022-01-19 20:19:48 +00:00
case R.id.menu_chat_stop_call /* 2131364304 */:
2021-06-27 20:44:35 +00:00
StoreStream.Companion.getVoiceChannelSelected().clear();
break;
}
AppFragment.hideKeyboard$default(this.$appFragment, null, 1, null);
}
}