discord-jadx/app/src/main/java/com/discord/utilities/auth/GoogleSmartLockRepo.java

210 lines
9.0 KiB
Java

package com.discord.utilities.auth;
import android.content.Context;
import com.discord.models.domain.ModelAuditLogEntry;
import com.discord.models.experiments.domain.Experiment;
import com.discord.stores.StoreAuthentication;
import com.discord.stores.StoreExperiments;
import com.discord.stores.StoreStream;
import com.discord.utilities.analytics.AnalyticsTracker;
import com.discord.utilities.auth.GoogleSmartLockManager;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.utilities.rx.ObservableExtensionsKt$filterNull$1;
import com.discord.utilities.rx.ObservableExtensionsKt$filterNull$2;
import d0.g;
import d0.z.d.m;
import d0.z.d.o;
import j0.k.b;
import kotlin.Lazy;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import rx.Observable;
import rx.subjects.PublishSubject;
/* compiled from: GoogleSmartLockRepo.kt */
public final class GoogleSmartLockRepo {
public static final Companion Companion = new Companion(null);
private static final Lazy INSTANCE$delegate = g.lazy(GoogleSmartLockRepo$Companion$INSTANCE$2.INSTANCE);
private boolean disableAutoLogin;
private boolean enabled;
private String pendingIdChange;
private PublishSubject<GoogleSmartLockManager.SmartLockCredentials> smartLockLogin;
private SmartLockSignInAttempt smartLockLoginAttempt;
/* compiled from: GoogleSmartLockRepo.kt */
/* renamed from: com.discord.utilities.auth.GoogleSmartLockRepo$1 reason: invalid class name */
public static final class AnonymousClass1<T, R> implements b<Experiment, Boolean> {
public static final AnonymousClass1 INSTANCE = new AnonymousClass1();
public final Boolean call(Experiment experiment) {
boolean z2 = true;
if (experiment == null || experiment.getBucket() != 1) {
z2 = false;
}
return Boolean.valueOf(z2);
}
}
/* compiled from: GoogleSmartLockRepo.kt */
/* renamed from: com.discord.utilities.auth.GoogleSmartLockRepo$2 reason: invalid class name */
public static final class AnonymousClass2 extends o implements Function1<Boolean, Unit> {
public final /* synthetic */ GoogleSmartLockRepo this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public AnonymousClass2(GoogleSmartLockRepo googleSmartLockRepo) {
super(1);
this.this$0 = googleSmartLockRepo;
}
/* 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(Boolean bool) {
invoke(bool);
return Unit.a;
}
public final void invoke(Boolean bool) {
GoogleSmartLockRepo googleSmartLockRepo = this.this$0;
m.checkNotNullExpressionValue(bool, "experimentEnabled");
googleSmartLockRepo.setEnabled(bool.booleanValue());
}
}
/* compiled from: GoogleSmartLockRepo.kt */
/* renamed from: com.discord.utilities.auth.GoogleSmartLockRepo$3 reason: invalid class name */
public static final class AnonymousClass3 extends o implements Function1<Boolean, Unit> {
public final /* synthetic */ GoogleSmartLockRepo this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public AnonymousClass3(GoogleSmartLockRepo googleSmartLockRepo) {
super(1);
this.this$0 = googleSmartLockRepo;
}
/* 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(Boolean bool) {
invoke(bool.booleanValue());
return Unit.a;
}
public final void invoke(boolean z2) {
if (!z2) {
this.this$0.setDisableAutoLogin(true);
}
}
}
/* compiled from: GoogleSmartLockRepo.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final GoogleSmartLockRepo getINSTANCE() {
Lazy access$getINSTANCE$cp = GoogleSmartLockRepo.access$getINSTANCE$cp();
Companion companion = GoogleSmartLockRepo.Companion;
return (GoogleSmartLockRepo) access$getINSTANCE$cp.getValue();
}
}
public GoogleSmartLockRepo() {
this(null, null, 3, null);
}
public GoogleSmartLockRepo(StoreExperiments storeExperiments, StoreAuthentication storeAuthentication) {
m.checkNotNullParameter(storeExperiments, "storeExperiments");
m.checkNotNullParameter(storeAuthentication, "storeAuth");
PublishSubject<GoogleSmartLockManager.SmartLockCredentials> k0 = PublishSubject.k0();
m.checkNotNullExpressionValue(k0, "PublishSubject.create()");
this.smartLockLogin = k0;
this.smartLockLoginAttempt = new SmartLockSignInAttempt(false, false, 3, null);
this.enabled = true;
Observable<R> F = storeExperiments.observeUserExperiment("2021-01_google_smart_lock", true).x(ObservableExtensionsKt$filterNull$1.INSTANCE).F(ObservableExtensionsKt$filterNull$2.INSTANCE);
m.checkNotNullExpressionValue(F, "filter { it != null }.map { it!! }");
Observable F2 = F.F(AnonymousClass1.INSTANCE);
m.checkNotNullExpressionValue(F2, "storeExperiments.observe…experiment?.bucket == 1 }");
ObservableExtensionsKt.appSubscribe$default(F2, GoogleSmartLockRepo.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass2(this), 62, (Object) null);
ObservableExtensionsKt.appSubscribe$default(storeAuthentication.getPreLogoutSignal$app_productionBetaRelease(), GoogleSmartLockRepo.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass3(this), 62, (Object) null);
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ GoogleSmartLockRepo(StoreExperiments storeExperiments, StoreAuthentication storeAuthentication, int i, DefaultConstructorMarker defaultConstructorMarker) {
this((i & 1) != 0 ? StoreStream.Companion.getExperiments() : storeExperiments, (i & 2) != 0 ? StoreStream.Companion.getAuthentication() : storeAuthentication);
}
public static final /* synthetic */ Lazy access$getINSTANCE$cp() {
return INSTANCE$delegate;
}
public final boolean getDisableAutoLogin() {
return this.disableAutoLogin;
}
public final boolean getEnabled() {
return this.enabled;
}
public final String getPendingIdChange() {
return this.pendingIdChange;
}
public final SmartLockSignInAttempt getSmartLockLoginAttempt() {
return this.smartLockLoginAttempt;
}
public final Observable<GoogleSmartLockManager.SmartLockCredentials> getSmartLockLoginObservable() {
return this.smartLockLogin;
}
public final void onLoginWithSmartLockSuccess() {
if (!this.smartLockLoginAttempt.getSignedInWithoutError()) {
return;
}
if (this.smartLockLoginAttempt.getUsedAutomaticCredentials()) {
AnalyticsTracker.INSTANCE.smartLockAutoLogin();
} else {
AnalyticsTracker.INSTANCE.smartLockLogin();
}
}
public final void onSmartLockCredentialsFailed() {
this.smartLockLoginAttempt = SmartLockSignInAttempt.copy$default(this.smartLockLoginAttempt, false, false, 1, null);
AnalyticsTracker.INSTANCE.smartLockLoginCredentialsFailed();
}
public final void setAttemptToSignInWithSmartLock(boolean z2) {
this.smartLockLoginAttempt = new SmartLockSignInAttempt(z2, false, 2, null);
}
public final void setDisableAutoLogin(boolean z2) {
this.disableAutoLogin = z2;
}
public final void setEnabled(boolean z2) {
this.enabled = z2;
}
public final void setPendingIdChange(String str) {
this.pendingIdChange = str;
}
public final void setSmartLockLogin(String str, String str2) {
m.checkNotNullParameter(str, ModelAuditLogEntry.CHANGE_KEY_ID);
m.checkNotNullParameter(str2, "password");
PublishSubject<GoogleSmartLockManager.SmartLockCredentials> publishSubject = this.smartLockLogin;
publishSubject.j.onNext(new GoogleSmartLockManager.SmartLockCredentials(str, str2));
}
public final void setSmartLockLoginAttempt(SmartLockSignInAttempt smartLockSignInAttempt) {
m.checkNotNullParameter(smartLockSignInAttempt, "<set-?>");
this.smartLockLoginAttempt = smartLockSignInAttempt;
}
}