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

124 lines
6.7 KiB
Java

package com.discord.stores;
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.utilities.analytics.AnalyticsTracker;
import com.discord.utilities.rest.RestAPI;
import com.discord.utilities.rx.ObservableExtensionsKt;
import d0.z.d.k;
import d0.z.d.m;
import j0.k.b;
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 */ String $captchaKey;
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;
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 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 str = this.$fingerprint;
StoreAuthentication$register$1 storeAuthentication$register$1 = this.this$0;
String str2 = storeAuthentication$register$1.$username;
String str3 = storeAuthentication$register$1.$email;
String str4 = storeAuthentication$register$1.$phoneToken;
String str5 = storeAuthentication$register$1.$password;
String str6 = storeAuthentication$register$1.$captchaKey;
String guildTemplateCode = authRequestParams.getGuildTemplateCode();
StoreAuthentication$register$1 storeAuthentication$register$12 = this.this$0;
return api.postAuthRegister(new RestAPIParams.AuthRegister(str, str2, str3, str4, str5, str6, inviteCode2, guildTemplateCode, storeAuthentication$register$12.$consent, storeAuthentication$register$12.$dateOfBirth));
}
}
/* 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, String str5, boolean z2, String str6) {
this.this$0 = storeAuthentication;
this.$username = str;
this.$email = str2;
this.$phoneToken = str3;
this.$password = str4;
this.$captchaKey = str5;
this.$consent = z2;
this.$dateOfBirth = str6;
}
/* 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> A = ObservableExtensionsKt.takeSingleUntilTimeout$default(j, 500, false, 2, null).A(new AnonymousClass2(this, str));
m.checkNotNullExpressionValue(A, "Observable.combineLatest… )\n }");
return ObservableExtensionsKt.takeSingleUntilTimeout$default(ObservableExtensionsKt.restSubscribeOn$default(A, false, 1, null), 0, false, 3, null).u(new AnonymousClass3(this));
}
}