144 lines
7.4 KiB
Java
144 lines
7.4 KiB
Java
|
package com.discord.widgets.channels;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.view.View;
|
||
|
import androidx.fragment.app.FragmentManager;
|
||
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
||
|
import com.discord.api.channel.Channel;
|
||
|
import com.discord.app.AppActivity;
|
||
|
import com.discord.models.user.User;
|
||
|
import com.discord.stores.StoreCalls;
|
||
|
import com.discord.stores.StoreNavigation;
|
||
|
import com.discord.stores.StoreStream;
|
||
|
import com.discord.stores.StoreTabsNavigation;
|
||
|
import com.discord.utilities.channel.ChannelSelector;
|
||
|
import com.discord.utilities.rest.RestAPI;
|
||
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
||
|
import com.discord.widgets.channels.WidgetGroupInviteFriends;
|
||
|
import d0.o;
|
||
|
import d0.t.u;
|
||
|
import d0.z.d.m;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.Collection;
|
||
|
import kotlin.Pair;
|
||
|
import kotlin.Unit;
|
||
|
import kotlin.jvm.functions.Function0;
|
||
|
import kotlin.jvm.functions.Function1;
|
||
|
import rx.Observable;
|
||
|
import rx.functions.Func2;
|
||
|
/* compiled from: WidgetGroupInviteFriends.kt */
|
||
|
public final class WidgetGroupInviteFriends$setupFAB$2 implements View.OnClickListener {
|
||
|
public final /* synthetic */ WidgetGroupInviteFriends.Model $data;
|
||
|
public final /* synthetic */ WidgetGroupInviteFriends this$0;
|
||
|
|
||
|
/* compiled from: WidgetGroupInviteFriends.kt */
|
||
|
/* renamed from: com.discord.widgets.channels.WidgetGroupInviteFriends$setupFAB$2$2 reason: invalid class name */
|
||
|
public static final class AnonymousClass2<T1, T2, R> implements Func2<Channel, Long, Pair<? extends Channel, ? extends Long>> {
|
||
|
public static final AnonymousClass2 INSTANCE = new AnonymousClass2();
|
||
|
|
||
|
public final Pair<Channel, Long> call(Channel channel, Long l) {
|
||
|
return o.to(channel, l);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* compiled from: WidgetGroupInviteFriends.kt */
|
||
|
/* renamed from: com.discord.widgets.channels.WidgetGroupInviteFriends$setupFAB$2$3 reason: invalid class name */
|
||
|
public static final class AnonymousClass3 extends d0.z.d.o implements Function1<Pair<? extends Channel, ? extends Long>, Unit> {
|
||
|
public final /* synthetic */ WidgetGroupInviteFriends$setupFAB$2 this$0;
|
||
|
|
||
|
/* compiled from: WidgetGroupInviteFriends.kt */
|
||
|
/* renamed from: com.discord.widgets.channels.WidgetGroupInviteFriends$setupFAB$2$3$2 reason: invalid class name */
|
||
|
public static final class AnonymousClass2 extends d0.z.d.o implements Function0<Unit> {
|
||
|
public static final AnonymousClass2 INSTANCE = new AnonymousClass2();
|
||
|
|
||
|
public AnonymousClass2() {
|
||
|
super(0);
|
||
|
}
|
||
|
|
||
|
@Override // kotlin.jvm.functions.Function0
|
||
|
/* renamed from: invoke */
|
||
|
public final void mo1invoke() {
|
||
|
StoreStream.Companion.getMediaEngine().selectVideoInputDevice(null);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
||
|
public AnonymousClass3(WidgetGroupInviteFriends$setupFAB$2 widgetGroupInviteFriends$setupFAB$2) {
|
||
|
super(1);
|
||
|
this.this$0 = widgetGroupInviteFriends$setupFAB$2;
|
||
|
}
|
||
|
|
||
|
/* 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(Pair<? extends Channel, ? extends Long> pair) {
|
||
|
invoke((Pair<Channel, Long>) pair);
|
||
|
return Unit.a;
|
||
|
}
|
||
|
|
||
|
public final void invoke(Pair<Channel, Long> pair) {
|
||
|
Channel component1 = pair.component1();
|
||
|
Long component2 = pair.component2();
|
||
|
ChannelSelector.selectChannel$default(ChannelSelector.Companion.getInstance(), 0, component1.h(), null, null, 12, null);
|
||
|
StoreStream.Companion companion = StoreStream.Companion;
|
||
|
Long l = null;
|
||
|
StoreTabsNavigation.selectHomeTab$default(companion.getTabsNavigation(), StoreNavigation.PanelAction.CLOSE, false, 2, null);
|
||
|
Channel channel = this.this$0.$data.getChannel();
|
||
|
if (channel != null) {
|
||
|
l = Long.valueOf(channel.h());
|
||
|
}
|
||
|
if (m.areEqual(component2, l)) {
|
||
|
Channel channel2 = this.this$0.$data.getChannel();
|
||
|
if (channel2 == null || !AnimatableValueParser.r1(channel2)) {
|
||
|
companion.getVoiceChannelSelected().clear();
|
||
|
StoreCalls calls = companion.getCalls();
|
||
|
WidgetGroupInviteFriends widgetGroupInviteFriends = this.this$0.this$0;
|
||
|
Context requireContext = widgetGroupInviteFriends.requireContext();
|
||
|
FragmentManager parentFragmentManager = this.this$0.this$0.getParentFragmentManager();
|
||
|
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
|
||
|
calls.call(widgetGroupInviteFriends, requireContext, parentFragmentManager, component1.h(), AnonymousClass2.INSTANCE);
|
||
|
} else {
|
||
|
StoreCalls calls2 = companion.getCalls();
|
||
|
long h = component1.h();
|
||
|
Collection<User> selectedUsers = this.this$0.$data.getSelectedUsers();
|
||
|
ArrayList arrayList = new ArrayList(d0.t.o.collectionSizeOrDefault(selectedUsers, 10));
|
||
|
for (User user : selectedUsers) {
|
||
|
arrayList.add(Long.valueOf(user.getId()));
|
||
|
}
|
||
|
calls2.ring(h, arrayList);
|
||
|
}
|
||
|
}
|
||
|
AppActivity appActivity = this.this$0.this$0.getAppActivity();
|
||
|
if (appActivity != null) {
|
||
|
appActivity.onBackPressed();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public WidgetGroupInviteFriends$setupFAB$2(WidgetGroupInviteFriends widgetGroupInviteFriends, WidgetGroupInviteFriends.Model model) {
|
||
|
this.this$0 = widgetGroupInviteFriends;
|
||
|
this.$data = model;
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View.OnClickListener
|
||
|
public final void onClick(View view) {
|
||
|
Observable<Channel> observable;
|
||
|
if (this.$data.getChannel() != null) {
|
||
|
observable = RestAPI.Companion.getApi().addGroupRecipients(this.$data.getChannel().h(), u.toList(this.$data.getSelectedUsers()));
|
||
|
} else if (this.$data.getSelectedUsers().size() == 1) {
|
||
|
observable = RestAPI.Companion.getApi().createOrFetchDM(((User) u.first(this.$data.getSelectedUsers())).getId());
|
||
|
} else {
|
||
|
RestAPI api = RestAPI.Companion.getApi();
|
||
|
Collection<User> selectedUsers = this.$data.getSelectedUsers();
|
||
|
ArrayList arrayList = new ArrayList(d0.t.o.collectionSizeOrDefault(selectedUsers, 10));
|
||
|
for (User user : selectedUsers) {
|
||
|
arrayList.add(Long.valueOf(user.getId()));
|
||
|
}
|
||
|
observable = api.createGroupDM(arrayList);
|
||
|
}
|
||
|
Observable j = Observable.j(observable, ObservableExtensionsKt.takeSingleUntilTimeout$default(StoreStream.Companion.getVoiceChannelSelected().observeSelectedVoiceChannelId(), 0, false, 3, null), AnonymousClass2.INSTANCE);
|
||
|
m.checkNotNullExpressionValue(j, "Observable.combineLatest…dVoiceChannelId\n }");
|
||
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(j, this.this$0, null, 2, null), this.this$0.getClass(), this.this$0.requireContext(), (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass3(this), 60, (Object) null);
|
||
|
}
|
||
|
}
|