discord-jadx/app/src/main/java/com/discord/utilities/auth/GoogleSmartLockManager$save...

99 lines
4.4 KiB
Java

package com.discord.utilities.auth;
import android.net.Uri;
import c.c.a.a0.d;
import c.i.a.f.c.a.a;
import c.i.a.f.e.k.l;
import c.i.a.f.h.c.h;
import c.i.a.f.h.c.i;
import c.i.a.f.n.b0;
import c.i.a.f.n.c;
import c.i.a.f.n.g;
import com.discord.app.AppLog;
import com.discord.models.user.MeUser;
import com.discord.utilities.icon.IconUtils;
import com.discord.utilities.logging.Logger;
import com.discord.utilities.user.UserUtils;
import com.google.android.gms.auth.api.credentials.Credential;
import com.google.android.gms.auth.api.credentials.CredentialsClient;
import com.google.android.gms.common.api.ResolvableApiException;
import com.google.android.gms.tasks.Task;
import d0.z.d.m;
import d0.z.d.o;
import java.util.Objects;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
/* compiled from: GoogleSmartLockManager.kt */
public final class GoogleSmartLockManager$saveCredentials$1 extends o implements Function1<MeUser, Unit> {
public final /* synthetic */ String $id;
public final /* synthetic */ String $password;
public final /* synthetic */ GoogleSmartLockManager this$0;
/* compiled from: GoogleSmartLockManager.kt */
/* renamed from: com.discord.utilities.auth.GoogleSmartLockManager$saveCredentials$1$1 reason: invalid class name */
public static final class AnonymousClass1<TResult> implements c<Void> {
public final /* synthetic */ GoogleSmartLockManager$saveCredentials$1 this$0;
public AnonymousClass1(GoogleSmartLockManager$saveCredentials$1 googleSmartLockManager$saveCredentials$1) {
this.this$0 = googleSmartLockManager$saveCredentials$1;
}
@Override // c.i.a.f.n.c
public final void onComplete(Task<Void> task) {
m.checkNotNullParameter(task, "task");
if (task.p()) {
Logger.i$default(AppLog.g, "Google Smart Lock", "Credentials Saved", null, 4, null);
return;
}
Exception k = task.k();
if (k instanceof ResolvableApiException) {
AppLog.g.w("Google Smart Lock", "Resolving Exception saving credentials", k);
GoogleSmartLockManager$saveCredentials$1 googleSmartLockManager$saveCredentials$1 = this.this$0;
GoogleSmartLockManager.access$resolveResult(googleSmartLockManager$saveCredentials$1.this$0, (ResolvableApiException) k, googleSmartLockManager$saveCredentials$1.$id);
return;
}
AppLog.g.w("Google Smart Lock", "Exception saving credentials", k);
}
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public GoogleSmartLockManager$saveCredentials$1(GoogleSmartLockManager googleSmartLockManager, String str, String str2) {
super(1);
this.this$0 = googleSmartLockManager;
this.$id = str;
this.$password = str2;
}
/* 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(MeUser meUser) {
invoke(meUser);
return Unit.a;
}
public final void invoke(MeUser meUser) {
String forUser$default = IconUtils.getForUser$default(meUser, false, null, 4, null);
Credential.a aVar = new Credential.a(this.$id);
aVar.d = this.$password;
m.checkNotNullExpressionValue(aVar, "Credential.Builder(id)\n … .setPassword(password)");
UserUtils userUtils = UserUtils.INSTANCE;
m.checkNotNullExpressionValue(meUser, "it");
aVar.b = UserUtils.getUserNameWithDiscriminator$default(userUtils, meUser, null, null, 3, null).toString();
aVar.f2380c = Uri.parse(forUser$default);
Credential a = aVar.a();
CredentialsClient access$getCredentialsClient$p = GoogleSmartLockManager.access$getCredentialsClient$p(this.this$0);
Objects.requireNonNull(access$getCredentialsClient$p);
c.i.a.f.c.a.d.c cVar = a.g;
c.i.a.f.e.h.c cVar2 = access$getCredentialsClient$p.g;
Objects.requireNonNull((h) cVar);
d.z(cVar2, "client must not be null");
d.z(a, "credential must not be null");
Task<Void> a2 = l.a(cVar2.b(new i(cVar2, a)));
AnonymousClass1 r0 = new AnonymousClass1(this);
b0 b0Var = (b0) a2;
Objects.requireNonNull(b0Var);
b0Var.c(g.a, r0);
}
}