discord-jadx/app/src/main/java/com/discord/stores/StoreAuthentication$registe...

154 lines
8.5 KiB
Java

package com.discord.stores;
import com.discord.analytics.generated.events.network_action.TrackNetworkActionUserRegister;
import com.discord.analytics.generated.traits.TrackNetworkMetadataReceiver;
import com.discord.api.auth.RegisterResponse;
import com.discord.restapi.RestAPIParams;
import com.discord.stores.StoreAuthentication;
import com.discord.stores.StoreInviteSettings;
import com.discord.stores.StoreStream;
import com.discord.stores.utilities.RestCallStateKt;
import com.discord.utilities.analytics.AnalyticsTracker;
import com.discord.utilities.captcha.CaptchaHelper;
import com.discord.utilities.rest.RestAPI;
import com.discord.utilities.rx.ObservableExtensionsKt;
import d0.z.d.k;
import d0.z.d.m;
import d0.z.d.o;
import j0.k.b;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import rx.Observable;
import rx.functions.Action1;
import rx.functions.Func2;
/* compiled from: StoreAuthentication.kt */
public final class StoreAuthentication$register$1<T, R> implements b<String, Observable<? extends RegisterResponse>> {
public final /* synthetic */ CaptchaHelper.CaptchaPayload $captchaPayload;
public final /* synthetic */ boolean $consent;
public final /* synthetic */ String $dateOfBirth;
public final /* synthetic */ String $email;
public final /* synthetic */ String $password;
public final /* synthetic */ String $phoneToken;
public final /* synthetic */ String $username;
public final /* synthetic */ StoreAuthentication this$0;
/* compiled from: StoreAuthentication.kt */
/* renamed from: com.discord.stores.StoreAuthentication$register$1$1 reason: invalid class name */
public static final /* synthetic */ class AnonymousClass1 extends k implements Function2<StoreInviteSettings.InviteCode, String, StoreAuthentication.AuthRequestParams> {
public static final AnonymousClass1 INSTANCE = new AnonymousClass1();
public AnonymousClass1() {
super(2, StoreAuthentication.AuthRequestParams.class, "<init>", "<init>(Lcom/discord/stores/StoreInviteSettings$InviteCode;Ljava/lang/String;)V", 0);
}
public final StoreAuthentication.AuthRequestParams invoke(StoreInviteSettings.InviteCode inviteCode, String str) {
return new StoreAuthentication.AuthRequestParams(inviteCode, str);
}
}
/* compiled from: StoreAuthentication.kt */
/* renamed from: com.discord.stores.StoreAuthentication$register$1$2 reason: invalid class name */
public static final class AnonymousClass2<T, R> implements b<StoreAuthentication.AuthRequestParams, Observable<? extends RegisterResponse>> {
public final /* synthetic */ String $fingerprint;
public final /* synthetic */ StoreAuthentication$register$1 this$0;
/* compiled from: StoreAuthentication.kt */
/* renamed from: com.discord.stores.StoreAuthentication$register$1$2$1 reason: invalid class name */
public static final class AnonymousClass1 extends o implements Function1<RegisterResponse, TrackNetworkMetadataReceiver> {
public final /* synthetic */ String $inviteCode;
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, String str) {
super(1);
this.this$0 = r1;
this.$inviteCode = str;
}
public final TrackNetworkMetadataReceiver invoke(RegisterResponse registerResponse) {
return new TrackNetworkActionUserRegister(this.$inviteCode, Boolean.valueOf(this.this$0.this$0.$consent), Boolean.FALSE);
}
}
public AnonymousClass2(StoreAuthentication$register$1 storeAuthentication$register$1, String str) {
this.this$0 = storeAuthentication$register$1;
this.$fingerprint = str;
}
public final Observable<? extends RegisterResponse> call(StoreAuthentication.AuthRequestParams authRequestParams) {
StoreInviteSettings.InviteCode inviteCode = authRequestParams.getInviteCode();
String str = null;
String inviteCode2 = inviteCode != null ? inviteCode.getInviteCode() : null;
if (inviteCode2 == null || inviteCode2.length() == 0) {
StoreStream.Companion.getNux().setPostRegister(true);
} else {
StoreStream.Companion.getNux().setPostRegisterWithInvite(true);
}
RestAPI api = RestAPI.Companion.getApi();
String str2 = this.$fingerprint;
StoreAuthentication$register$1 storeAuthentication$register$1 = this.this$0;
String str3 = storeAuthentication$register$1.$username;
String str4 = storeAuthentication$register$1.$email;
String str5 = storeAuthentication$register$1.$phoneToken;
String str6 = storeAuthentication$register$1.$password;
CaptchaHelper.CaptchaPayload captchaPayload = storeAuthentication$register$1.$captchaPayload;
String captchaKey = captchaPayload != null ? captchaPayload.getCaptchaKey() : null;
CaptchaHelper.CaptchaPayload captchaPayload2 = this.this$0.$captchaPayload;
if (captchaPayload2 != null) {
str = captchaPayload2.getCaptchaRqtoken();
}
String guildTemplateCode = authRequestParams.getGuildTemplateCode();
StoreAuthentication$register$1 storeAuthentication$register$12 = this.this$0;
return RestCallStateKt.logNetworkAction(api.postAuthRegister(new RestAPIParams.AuthRegister(str2, str3, str4, str5, str6, captchaKey, str, inviteCode2, guildTemplateCode, storeAuthentication$register$12.$consent, storeAuthentication$register$12.$dateOfBirth)), new AnonymousClass1(this, inviteCode2));
}
}
/* compiled from: StoreAuthentication.kt */
/* renamed from: com.discord.stores.StoreAuthentication$register$1$3 reason: invalid class name */
public static final class AnonymousClass3<T> implements Action1<RegisterResponse> {
public final /* synthetic */ StoreAuthentication$register$1 this$0;
public AnonymousClass3(StoreAuthentication$register$1 storeAuthentication$register$1) {
this.this$0 = storeAuthentication$register$1;
}
public final void call(RegisterResponse registerResponse) {
StoreStream.Companion companion = StoreStream.Companion;
companion.getUserSettingsSystem().setIsSyncThemeEnabled(false);
this.this$0.this$0.setFingerprint(null, true);
this.this$0.this$0.setAuthed(registerResponse.a());
AnalyticsTracker.INSTANCE.appFirstLogin();
companion.getNotifications().setEnabledInApp(true, false);
companion.getNux().setFirstOpen(true);
}
}
public StoreAuthentication$register$1(StoreAuthentication storeAuthentication, String str, String str2, String str3, String str4, CaptchaHelper.CaptchaPayload captchaPayload, boolean z2, String str5) {
this.this$0 = storeAuthentication;
this.$username = str;
this.$email = str2;
this.$phoneToken = str3;
this.$password = str4;
this.$captchaPayload = captchaPayload;
this.$consent = z2;
this.$dateOfBirth = str5;
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARNING: Unknown variable types count: 1 */
public final Observable<? extends RegisterResponse> call(String str) {
StoreStream.Companion companion = StoreStream.Companion;
Observable<StoreInviteSettings.InviteCode> inviteCode = companion.getInviteSettings().getInviteCode();
Observable<String> observeDynamicLinkGuildTemplateCode = companion.getGuildTemplates().observeDynamicLinkGuildTemplateCode();
AnonymousClass1 r2 = AnonymousClass1.INSTANCE;
if (r2 != null) {
r2 = new StoreAuthentication$sam$rx_functions_Func2$0(r2);
}
Observable j = Observable.j(inviteCode, observeDynamicLinkGuildTemplateCode, (Func2) r2);
m.checkNotNullExpressionValue(j, "Observable.combineLatest…RequestParams\n )");
Observable<R> z2 = ObservableExtensionsKt.takeSingleUntilTimeout$default(j, 500, false, 2, null).z(new AnonymousClass2(this, str));
m.checkNotNullExpressionValue(z2, "Observable.combineLatest… }\n }");
return ObservableExtensionsKt.takeSingleUntilTimeout$default(ObservableExtensionsKt.restSubscribeOn$default(z2, false, 1, null), 0, false, 3, null).t(new AnonymousClass3(this));
}
}