227 lines
13 KiB
Java
227 lines
13 KiB
Java
package com.discord.stores;
|
|
|
|
import android.content.Context;
|
|
import com.discord.analytics.generated.events.network_action.TrackNetworkActionInviteResolve;
|
|
import com.discord.analytics.generated.traits.TrackNetworkMetadataReceiver;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.api.guild.Guild;
|
|
import com.discord.api.guildscheduledevent.GuildScheduledEvent;
|
|
import com.discord.api.user.User;
|
|
import com.discord.models.domain.ModelInvite;
|
|
import com.discord.restapi.RestAPIAbortCodes;
|
|
import com.discord.stores.StoreInstantInvites;
|
|
import com.discord.stores.utilities.RestCallStateKt;
|
|
import com.discord.utilities.analytics.AnalyticsTracker;
|
|
import com.discord.utilities.error.Error;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
/* compiled from: StoreInstantInvites.kt */
|
|
public final class StoreInstantInvites$fetchInviteIfNotLoaded$1 extends o implements Function0<Unit> {
|
|
public final /* synthetic */ Long $eventId;
|
|
public final /* synthetic */ String $inviteCode;
|
|
public final /* synthetic */ String $inviteKey;
|
|
public final /* synthetic */ Boolean $inviteResolved;
|
|
public final /* synthetic */ String $location;
|
|
public final /* synthetic */ Function0 $onError;
|
|
public final /* synthetic */ StoreInstantInvites this$0;
|
|
|
|
/* compiled from: StoreInstantInvites.kt */
|
|
/* renamed from: com.discord.stores.StoreInstantInvites$fetchInviteIfNotLoaded$1$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 extends o implements Function1<ModelInvite, TrackNetworkMetadataReceiver> {
|
|
public final /* synthetic */ StoreInstantInvites$fetchInviteIfNotLoaded$1 this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass1(StoreInstantInvites$fetchInviteIfNotLoaded$1 storeInstantInvites$fetchInviteIfNotLoaded$1) {
|
|
super(1);
|
|
this.this$0 = storeInstantInvites$fetchInviteIfNotLoaded$1;
|
|
}
|
|
|
|
public final TrackNetworkMetadataReceiver invoke(ModelInvite modelInvite) {
|
|
User inviter;
|
|
Channel channel;
|
|
Channel channel2;
|
|
Guild guild;
|
|
StoreInstantInvites$fetchInviteIfNotLoaded$1 storeInstantInvites$fetchInviteIfNotLoaded$1 = this.this$0;
|
|
return new TrackNetworkActionInviteResolve(storeInstantInvites$fetchInviteIfNotLoaded$1.$inviteResolved, storeInstantInvites$fetchInviteIfNotLoaded$1.$inviteCode, Boolean.valueOf(StoreStream.Companion.getAuthentication().isAuthed()), (modelInvite == null || (guild = modelInvite.guild) == null) ? null : Long.valueOf(guild.r()), (modelInvite == null || (channel2 = modelInvite.getChannel()) == null) ? null : Long.valueOf(channel2.h()), (modelInvite == null || (channel = modelInvite.getChannel()) == null) ? null : Long.valueOf((long) channel.A()), (modelInvite == null || (inviter = modelInvite.getInviter()) == null) ? null : Long.valueOf(inviter.i()), modelInvite != null ? Long.valueOf((long) modelInvite.getApproximateMemberCount()) : null, modelInvite != null ? Long.valueOf((long) modelInvite.getApproximatePresenceCount()) : null, modelInvite != null ? modelInvite.getInviteType() : null, null, modelInvite != null ? Boolean.valueOf(m.areEqual(modelInvite.code, String.valueOf((int) RestAPIAbortCodes.USER_BANNED))) : null, null);
|
|
}
|
|
}
|
|
|
|
/* compiled from: StoreInstantInvites.kt */
|
|
/* renamed from: com.discord.stores.StoreInstantInvites$fetchInviteIfNotLoaded$1$2 reason: invalid class name */
|
|
public static final class AnonymousClass2 extends o implements Function1<ModelInvite, Unit> {
|
|
public final /* synthetic */ StoreInstantInvites$fetchInviteIfNotLoaded$1 this$0;
|
|
|
|
/* compiled from: StoreInstantInvites.kt */
|
|
/* renamed from: com.discord.stores.StoreInstantInvites$fetchInviteIfNotLoaded$1$2$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 extends o implements Function0<Unit> {
|
|
public final /* synthetic */ ModelInvite $it;
|
|
public final /* synthetic */ AnonymousClass2 this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass1(AnonymousClass2 r1, ModelInvite modelInvite) {
|
|
super(0);
|
|
this.this$0 = r1;
|
|
this.$it = modelInvite;
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
/* renamed from: invoke */
|
|
public final void mo1invoke() {
|
|
StoreInstantInvites$fetchInviteIfNotLoaded$1 storeInstantInvites$fetchInviteIfNotLoaded$1 = this.this$0.this$0;
|
|
StoreInstantInvites storeInstantInvites = storeInstantInvites$fetchInviteIfNotLoaded$1.this$0;
|
|
String str = storeInstantInvites$fetchInviteIfNotLoaded$1.$inviteKey;
|
|
m.checkNotNullExpressionValue(str, "inviteKey");
|
|
StoreInstantInvites.access$setChatInvites(storeInstantInvites, str, new StoreInstantInvites.InviteState.Resolved(this.$it));
|
|
GuildScheduledEvent guildScheduledEvent = this.$it.getGuildScheduledEvent();
|
|
if (guildScheduledEvent != null) {
|
|
StoreGuildScheduledEvents guildScheduledEvents = StoreStream.Companion.getGuildScheduledEvents();
|
|
m.checkNotNullExpressionValue(guildScheduledEvent, "event");
|
|
guildScheduledEvents.addGuildScheduledEventFromInvite(guildScheduledEvent);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass2(StoreInstantInvites$fetchInviteIfNotLoaded$1 storeInstantInvites$fetchInviteIfNotLoaded$1) {
|
|
super(1);
|
|
this.this$0 = storeInstantInvites$fetchInviteIfNotLoaded$1;
|
|
}
|
|
|
|
/* 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(ModelInvite modelInvite) {
|
|
invoke(modelInvite);
|
|
return Unit.a;
|
|
}
|
|
|
|
public final void invoke(ModelInvite modelInvite) {
|
|
m.checkNotNullParameter(modelInvite, "it");
|
|
StoreInstantInvites.access$getDispatcher$p(this.this$0.this$0).schedule(new AnonymousClass1(this, modelInvite));
|
|
String str = this.this$0.$location;
|
|
if (str != null) {
|
|
AnalyticsTracker.INSTANCE.inviteResolved(modelInvite, str);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: StoreInstantInvites.kt */
|
|
/* renamed from: com.discord.stores.StoreInstantInvites$fetchInviteIfNotLoaded$1$3 reason: invalid class name */
|
|
public static final class AnonymousClass3 extends o implements Function1<Error, Unit> {
|
|
public final /* synthetic */ StoreInstantInvites$fetchInviteIfNotLoaded$1 this$0;
|
|
|
|
/* compiled from: StoreInstantInvites.kt */
|
|
/* renamed from: com.discord.stores.StoreInstantInvites$fetchInviteIfNotLoaded$1$3$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 extends o implements Function0<Unit> {
|
|
public final /* synthetic */ AnonymousClass3 this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass1(AnonymousClass3 r1) {
|
|
super(0);
|
|
this.this$0 = r1;
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
/* renamed from: invoke */
|
|
public final void mo1invoke() {
|
|
StoreInstantInvites$fetchInviteIfNotLoaded$1 storeInstantInvites$fetchInviteIfNotLoaded$1 = this.this$0.this$0;
|
|
StoreInstantInvites storeInstantInvites = storeInstantInvites$fetchInviteIfNotLoaded$1.this$0;
|
|
String str = storeInstantInvites$fetchInviteIfNotLoaded$1.$inviteKey;
|
|
m.checkNotNullExpressionValue(str, "inviteKey");
|
|
StoreInstantInvites.access$setChatInvites(storeInstantInvites, str, StoreInstantInvites.InviteState.Invalid.INSTANCE);
|
|
}
|
|
}
|
|
|
|
/* compiled from: StoreInstantInvites.kt */
|
|
/* renamed from: com.discord.stores.StoreInstantInvites$fetchInviteIfNotLoaded$1$3$2 reason: invalid class name */
|
|
public static final class AnonymousClass2 extends o implements Function0<Unit> {
|
|
public final /* synthetic */ AnonymousClass3 this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass2(AnonymousClass3 r1) {
|
|
super(0);
|
|
this.this$0 = r1;
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
/* renamed from: invoke */
|
|
public final void mo1invoke() {
|
|
StoreInstantInvites$fetchInviteIfNotLoaded$1 storeInstantInvites$fetchInviteIfNotLoaded$1 = this.this$0.this$0;
|
|
StoreInstantInvites storeInstantInvites = storeInstantInvites$fetchInviteIfNotLoaded$1.this$0;
|
|
String str = storeInstantInvites$fetchInviteIfNotLoaded$1.$inviteKey;
|
|
m.checkNotNullExpressionValue(str, "inviteKey");
|
|
StoreInstantInvites.access$setChatInvites(storeInstantInvites, str, StoreInstantInvites.InviteState.LoadFailed.INSTANCE);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass3(StoreInstantInvites$fetchInviteIfNotLoaded$1 storeInstantInvites$fetchInviteIfNotLoaded$1) {
|
|
super(1);
|
|
this.this$0 = storeInstantInvites$fetchInviteIfNotLoaded$1;
|
|
}
|
|
|
|
/* 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(Error error) {
|
|
invoke(error);
|
|
return Unit.a;
|
|
}
|
|
|
|
public final void invoke(Error error) {
|
|
m.checkNotNullParameter(error, "error");
|
|
Function0 function0 = this.this$0.$onError;
|
|
if (function0 != null) {
|
|
Unit unit = (Unit) function0.mo1invoke();
|
|
}
|
|
int ordinal = error.getType().ordinal();
|
|
if (ordinal == 3) {
|
|
error.setShowErrorToasts(false);
|
|
StoreInstantInvites.access$getDispatcher$p(this.this$0.this$0).schedule(new AnonymousClass1(this));
|
|
StoreInstantInvites$fetchInviteIfNotLoaded$1 storeInstantInvites$fetchInviteIfNotLoaded$1 = this.this$0;
|
|
String str = storeInstantInvites$fetchInviteIfNotLoaded$1.$location;
|
|
if (str != null) {
|
|
String str2 = storeInstantInvites$fetchInviteIfNotLoaded$1.$inviteCode;
|
|
Error.Response response = error.getResponse();
|
|
m.checkNotNullExpressionValue(response, "error.response");
|
|
String message = response.getMessage();
|
|
Error.Response response2 = error.getResponse();
|
|
m.checkNotNullExpressionValue(response2, "error.response");
|
|
AnalyticsTracker.inviteResolveFailed(str2, str, message, Integer.valueOf(response2.getCode()));
|
|
}
|
|
} else if (ordinal == 11) {
|
|
StoreInstantInvites.access$getDispatcher$p(this.this$0.this$0).schedule(new AnonymousClass2(this));
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public StoreInstantInvites$fetchInviteIfNotLoaded$1(StoreInstantInvites storeInstantInvites, String str, String str2, Long l, Boolean bool, String str3, Function0 function0) {
|
|
super(0);
|
|
this.this$0 = storeInstantInvites;
|
|
this.$inviteKey = str;
|
|
this.$inviteCode = str2;
|
|
this.$eventId = l;
|
|
this.$inviteResolved = bool;
|
|
this.$location = str3;
|
|
this.$onError = function0;
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
/* renamed from: invoke */
|
|
public final void mo1invoke() {
|
|
if (!StoreInstantInvites.access$getKnownInvites$p(this.this$0).containsKey(this.$inviteKey) || (StoreInstantInvites.access$getKnownInvites$p(this.this$0).get(this.$inviteKey) instanceof StoreInstantInvites.InviteState.LoadFailed)) {
|
|
AnalyticsTracker.inviteOpened(this.$inviteCode);
|
|
StoreInstantInvites storeInstantInvites = this.this$0;
|
|
String str = this.$inviteKey;
|
|
m.checkNotNullExpressionValue(str, "inviteKey");
|
|
StoreInstantInvites.access$setChatInvites(storeInstantInvites, str, StoreInstantInvites.InviteState.Loading.INSTANCE);
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.restSubscribeOn$default(RestCallStateKt.logNetworkAction(StoreInstantInvites.access$getRestAPI$p(this.this$0).getInviteCode(this.$inviteCode, true, this.$eventId), new AnonymousClass1(this)), false, 1, null), this.this$0.getClass(), (Context) null, (Function1) null, new AnonymousClass3(this), (Function0) null, (Function0) null, new AnonymousClass2(this), 54, (Object) null);
|
|
}
|
|
}
|
|
}
|