319 lines
6.7 KiB
Smali
319 lines
6.7 KiB
Smali
.class public final Lcom/discord/utilities/view/validators/ValidationManager;
|
|
.super Ljava/lang/Object;
|
|
.source "ValidationManager.kt"
|
|
|
|
|
|
# instance fields
|
|
.field public final inputs:[Lcom/discord/utilities/view/validators/Input;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"[",
|
|
"Lcom/discord/utilities/view/validators/Input<",
|
|
"+",
|
|
"Landroid/view/View;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# direct methods
|
|
.method public varargs constructor <init>([Lcom/discord/utilities/view/validators/Input;)V
|
|
.locals 0
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"([",
|
|
"Lcom/discord/utilities/view/validators/Input<",
|
|
"+",
|
|
"Landroid/view/View;",
|
|
">;)V"
|
|
}
|
|
.end annotation
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
iput-object p1, p0, Lcom/discord/utilities/view/validators/ValidationManager;->inputs:[Lcom/discord/utilities/view/validators/Input;
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
const-string p1, "inputs"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method public static synthetic validate$default(Lcom/discord/utilities/view/validators/ValidationManager;ZILjava/lang/Object;)Z
|
|
.locals 0
|
|
|
|
const/4 p3, 0x1
|
|
|
|
and-int/2addr p2, p3
|
|
|
|
if-eqz p2, :cond_0
|
|
|
|
const/4 p1, 0x1
|
|
|
|
:cond_0
|
|
invoke-virtual {p0, p1}, Lcom/discord/utilities/view/validators/ValidationManager;->validate(Z)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final setErrors(Ljava/util/Map;)Ljava/util/Collection;
|
|
.locals 5
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/Map<",
|
|
"Ljava/lang/String;",
|
|
"+",
|
|
"Ljava/util/List<",
|
|
"Ljava/lang/String;",
|
|
">;>;)",
|
|
"Ljava/util/Collection<",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p1, :cond_b
|
|
|
|
new-instance v1, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
iget-object v2, p0, Lcom/discord/utilities/view/validators/ValidationManager;->inputs:[Lcom/discord/utilities/view/validators/Input;
|
|
|
|
if-eqz v2, :cond_a
|
|
|
|
array-length v3, v2
|
|
|
|
if-nez v3, :cond_0
|
|
|
|
const/4 v3, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v3, 0x0
|
|
|
|
:goto_0
|
|
if-eqz v3, :cond_1
|
|
|
|
sget-object v2, Lj0/i/n;->d:Lj0/i/n;
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
invoke-static {v2}, Lf/n/a/k/a;->toMutableList([Ljava/lang/Object;)Ljava/util/List;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-static {v2}, Ljava/util/Collections;->reverse(Ljava/util/List;)V
|
|
|
|
:goto_1
|
|
invoke-interface {v2}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object v2
|
|
|
|
:cond_2
|
|
:goto_2
|
|
invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v3
|
|
|
|
if-eqz v3, :cond_4
|
|
|
|
invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v3
|
|
|
|
check-cast v3, Lcom/discord/utilities/view/validators/Input;
|
|
|
|
invoke-virtual {v3}, Lcom/discord/utilities/view/validators/Input;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-interface {p1, v4}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v4
|
|
|
|
check-cast v4, Ljava/util/List;
|
|
|
|
if-eqz v4, :cond_3
|
|
|
|
invoke-static {v4}, Lj0/i/l;->firstOrNull(Ljava/util/List;)Ljava/lang/Object;
|
|
|
|
move-result-object v4
|
|
|
|
check-cast v4, Ljava/lang/String;
|
|
|
|
goto :goto_3
|
|
|
|
:cond_3
|
|
move-object v4, v0
|
|
|
|
:goto_3
|
|
invoke-virtual {v3, v4}, Lcom/discord/utilities/view/validators/Input;->setErrorMessage(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v4
|
|
|
|
if-eqz v4, :cond_2
|
|
|
|
invoke-virtual {v3}, Lcom/discord/utilities/view/validators/Input;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-interface {v1, v3}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_2
|
|
|
|
:cond_4
|
|
invoke-interface {p1}, Ljava/util/Map;->keySet()Ljava/util/Set;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_9
|
|
|
|
invoke-static {v1, p1}, Lf/n/a/k/a;->convertToSetForSetOperationWith(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Collection;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-interface {v0}, Ljava/util/Collection;->isEmpty()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_5
|
|
|
|
invoke-static {p1}, Lj0/i/l;->toSet(Ljava/lang/Iterable;)Ljava/util/Set;
|
|
|
|
move-result-object p1
|
|
|
|
goto :goto_5
|
|
|
|
:cond_5
|
|
instance-of v1, v0, Ljava/util/Set;
|
|
|
|
if-eqz v1, :cond_7
|
|
|
|
new-instance v1, Ljava/util/LinkedHashSet;
|
|
|
|
invoke-direct {v1}, Ljava/util/LinkedHashSet;-><init>()V
|
|
|
|
invoke-interface {p1}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object p1
|
|
|
|
:cond_6
|
|
:goto_4
|
|
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v2
|
|
|
|
if-eqz v2, :cond_8
|
|
|
|
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-interface {v0, v2}, Ljava/util/Collection;->contains(Ljava/lang/Object;)Z
|
|
|
|
move-result v3
|
|
|
|
if-nez v3, :cond_6
|
|
|
|
invoke-virtual {v1, v2}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_4
|
|
|
|
:cond_7
|
|
new-instance v1, Ljava/util/LinkedHashSet;
|
|
|
|
invoke-direct {v1, p1}, Ljava/util/LinkedHashSet;-><init>(Ljava/util/Collection;)V
|
|
|
|
invoke-virtual {v1, v0}, Ljava/util/LinkedHashSet;->removeAll(Ljava/util/Collection;)Z
|
|
|
|
:cond_8
|
|
move-object p1, v1
|
|
|
|
:goto_5
|
|
return-object p1
|
|
|
|
:cond_9
|
|
const-string p1, "$this$minus"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_a
|
|
const-string p1, "$this$reversed"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_b
|
|
const-string p1, "errorMap"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public final validate(Z)Z
|
|
.locals 7
|
|
|
|
iget-object v0, p0, Lcom/discord/utilities/view/validators/ValidationManager;->inputs:[Lcom/discord/utilities/view/validators/Input;
|
|
|
|
array-length v1, v0
|
|
|
|
const/4 v2, 0x0
|
|
|
|
const/4 v3, 0x1
|
|
|
|
const/4 v4, 0x0
|
|
|
|
const/4 v5, 0x1
|
|
|
|
:goto_0
|
|
if-ge v4, v1, :cond_1
|
|
|
|
aget-object v6, v0, v4
|
|
|
|
invoke-virtual {v6, p1}, Lcom/discord/utilities/view/validators/Input;->validate(Z)Z
|
|
|
|
move-result v6
|
|
|
|
if-eqz v6, :cond_0
|
|
|
|
if-eqz v5, :cond_0
|
|
|
|
const/4 v5, 0x1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_0
|
|
const/4 v5, 0x0
|
|
|
|
:goto_1
|
|
add-int/lit8 v4, v4, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
return v5
|
|
.end method
|