2021-08-03 07:33:18 +00:00
|
|
|
package com.discord.widgets.home;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
import androidx.fragment.app.FragmentManager;
|
2021-08-09 22:51:56 +00:00
|
|
|
import com.discord.R;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.api.channel.Channel;
|
2021-10-08 22:11:56 +00:00
|
|
|
import com.discord.api.channel.ChannelUtils;
|
2021-08-03 07:33:18 +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-02 06:38:17 +00:00
|
|
|
import d0.z.d.m;
|
2021-08-03 07:33:18 +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-10-20 06:51:20 +00:00
|
|
|
if (channel == null || !ChannelUtils.x(channel)) {
|
2021-08-03 07:33:18 +00:00
|
|
|
Channel channel2 = this.$this_getOnSelectedAction.getChannel();
|
2021-11-10 07:31:25 +00:00
|
|
|
if (channel2 != null && ChannelUtils.s(channel2)) {
|
2021-08-03 07:33:18 +00:00
|
|
|
WidgetSearch.Companion.launchForGuild(this.$this_getOnSelectedAction.getChannel().f(), context);
|
|
|
|
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()) {
|
2021-12-27 07:18:26 +00:00
|
|
|
case R.id.menu_chat_add_friend /* 2131364297 */:
|
2021-08-03 07:33:18 +00:00
|
|
|
WidgetFriendsAdd.Companion.show$default(WidgetFriendsAdd.Companion, context, null, "Toolbar", 2, null);
|
|
|
|
break;
|
2021-12-27 07:18:26 +00:00
|
|
|
case R.id.menu_chat_search /* 2131364298 */:
|
2021-08-03 07:33:18 +00:00
|
|
|
launchForSearch(context);
|
|
|
|
break;
|
2021-12-27 07:18:26 +00:00
|
|
|
case R.id.menu_chat_side_panel /* 2131364299 */:
|
2021-08-03 07:33:18 +00:00
|
|
|
this.$panelLayout.openEndPanel();
|
|
|
|
break;
|
2021-12-27 07:18:26 +00:00
|
|
|
case R.id.menu_chat_start_call /* 2131364300 */:
|
2021-08-03 07:33:18 +00:00
|
|
|
privateCallLauncher.launchVoiceCall(this.$this_getOnSelectedAction.getChannelId());
|
|
|
|
break;
|
2021-12-27 07:18:26 +00:00
|
|
|
case R.id.menu_chat_start_group /* 2131364301 */:
|
2021-08-31 06:34:54 +00:00
|
|
|
ChannelInviteLaunchUtils.inviteToChannel$default(ChannelInviteLaunchUtils.INSTANCE, this.$appFragment, this.$this_getOnSelectedAction.getChannel(), "Toolbar", null, null, 24, null);
|
2021-08-03 07:33:18 +00:00
|
|
|
break;
|
2021-12-27 07:18:26 +00:00
|
|
|
case R.id.menu_chat_start_video_call /* 2131364302 */:
|
2021-08-03 07:33:18 +00:00
|
|
|
privateCallLauncher.launchVideoCall(this.$this_getOnSelectedAction.getChannelId());
|
|
|
|
break;
|
2021-12-27 07:18:26 +00:00
|
|
|
case R.id.menu_chat_stop_call /* 2131364303 */:
|
2021-08-03 07:33:18 +00:00
|
|
|
StoreStream.Companion.getVoiceChannelSelected().clear();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
AppFragment.hideKeyboard$default(this.$appFragment, null, 1, null);
|
|
|
|
}
|
|
|
|
}
|