granularity level: instruction
.class final Lcom/google/firebase/messaging/TopicOperation;
.super Ljava/lang/Object;
.source "TopicOperation.java"
.field private static final OLD_TOPIC_PREFIX:Ljava/lang/String; = "/topics/"
.field static final OPERATION_PAIR_DIVIDER:Ljava/lang/String; = "!"
.field private static final TOPIC_NAME_PATTERN:Ljava/lang/String; = "[a-zA-Z0-9-_.~%]{1,900}"
.field private static final TOPIC_NAME_REGEXP:Ljava/util/regex/Pattern;
.field private final operation:Ljava/lang/String;
.field private final serializedString:Ljava/lang/String;
.field private final topic:Ljava/lang/String;
.method static constructor <clinit>()V
.locals 1
const-string v0, "[a-zA-Z0-9-_.~%]{1,900}"
invoke-static {v0}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;
move-result-object v0
sput-object v0, Lcom/google/firebase/messaging/TopicOperation;->TOPIC_NAME_REGEXP:Ljava/util/regex/Pattern;
return-void
.end method
.method private constructor <init>(Ljava/lang/String;Ljava/lang/String;)V
.locals 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
invoke-static {p2, p1}, Lcom/google/firebase/messaging/TopicOperation;->normalizeTopicOrThrow(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
iput-object v0, p0, Lcom/google/firebase/messaging/TopicOperation;->topic:Ljava/lang/String;
iput-object p1, p0, Lcom/google/firebase/messaging/TopicOperation;->operation:Ljava/lang/String;
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string p1, "!"
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
iput-object p1, p0, Lcom/google/firebase/messaging/TopicOperation;->serializedString:Ljava/lang/String;
return-void
.end method
.method static from(Ljava/lang/String;)Lcom/google/firebase/messaging/TopicOperation;
.locals 3
invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v0
const/4 v1, 0x0
if-eqz v0, :cond_0
return-object v1
:cond_0
const/4 v0, -0x1
const-string v2, "!"
invoke-virtual {p0, v2, v0}, Ljava/lang/String;->split(Ljava/lang/String;I)[Ljava/lang/String;
move-result-object p0
array-length v0, p0
const/4 v2, 0x2
if-eq v0, v2, :cond_1
return-object v1
:cond_1
new-instance v0, Lcom/google/firebase/messaging/TopicOperation;
const/4 v1, 0x0
aget-object v1, p0, v1
const/4 v2, 0x1
aget-object p0, p0, v2
invoke-direct {v0, v1, p0}, Lcom/google/firebase/messaging/TopicOperation;-><init>(Ljava/lang/String;Ljava/lang/String;)V
return-object v0
.end method
.method private static normalizeTopicOrThrow(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
.locals 3
const/4 v0, 0x1
const/4 v1, 0x0
if-eqz p0, :cond_0
const-string v2, "/topics/"
invoke-virtual {p0, v2}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
move-result v2
if-eqz v2, :cond_0
new-array v2, v0, [Ljava/lang/Object;
aput-object p1, v2, v1
const-string p1, "Format /topics/topic-name is deprecated. Only \'topic-name\' should be used in %s."
invoke-static {p1, v2}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object p1
const-string v2, "FirebaseMessaging"
invoke-static {v2, p1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
const/16 p1, 0x8
invoke-virtual {p0, p1}, Ljava/lang/String;->substring(I)Ljava/lang/String;
move-result-object p0
:cond_0
if-eqz p0, :cond_1
sget-object p1, Lcom/google/firebase/messaging/TopicOperation;->TOPIC_NAME_REGEXP:Ljava/util/regex/Pattern;
invoke-virtual {p1, p0}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
move-result-object p1
invoke-virtual {p1}, Ljava/util/regex/Matcher;->matches()Z
move-result p1
if-eqz p1, :cond_1
return-object p0
:cond_1
new-instance p1, Ljava/lang/IllegalArgumentException;
const/4 v2, 0x2
new-array v2, v2, [Ljava/lang/Object;
aput-object p0, v2, v1
const-string p0, "[a-zA-Z0-9-_.~%]{1,900}"
aput-object p0, v2, v0
const-string p0, "Invalid topic name: %s does not match the allowed format %s."
invoke-static {p0, v2}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object p0
invoke-direct {p1, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p1
.end method
.method public static subscribe(Ljava/lang/String;)Lcom/google/firebase/messaging/TopicOperation;
.locals 2
new-instance v0, Lcom/google/firebase/messaging/TopicOperation;
const-string v1, "S"
invoke-direct {v0, v1, p0}, Lcom/google/firebase/messaging/TopicOperation;-><init>(Ljava/lang/String;Ljava/lang/String;)V
return-object v0
.end method
.method public static unsubscribe(Ljava/lang/String;)Lcom/google/firebase/messaging/TopicOperation;
.locals 2
new-instance v0, Lcom/google/firebase/messaging/TopicOperation;
const-string v1, "U"
invoke-direct {v0, v1, p0}, Lcom/google/firebase/messaging/TopicOperation;-><init>(Ljava/lang/String;Ljava/lang/String;)V
return-object v0
.end method
.method public equals(Ljava/lang/Object;)Z
.locals 3
instance-of v0, p1, Lcom/google/firebase/messaging/TopicOperation;
const/4 v1, 0x0
if-nez v0, :cond_0
return v1
:cond_0
check-cast p1, Lcom/google/firebase/messaging/TopicOperation;
iget-object v0, p0, Lcom/google/firebase/messaging/TopicOperation;->topic:Ljava/lang/String;
iget-object v2, p1, Lcom/google/firebase/messaging/TopicOperation;->topic:Ljava/lang/String;
invoke-virtual {v0, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_1
iget-object v0, p0, Lcom/google/firebase/messaging/TopicOperation;->operation:Ljava/lang/String;
iget-object p1, p1, Lcom/google/firebase/messaging/TopicOperation;->operation:Ljava/lang/String;
invoke-virtual {v0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result p1
if-eqz p1, :cond_1
const/4 v1, 0x1
:cond_1
return v1
.end method
.method public getOperation()Ljava/lang/String;
.locals 1
iget-object v0, p0, Lcom/google/firebase/messaging/TopicOperation;->operation:Ljava/lang/String;
return-object v0
.end method
.method public getTopic()Ljava/lang/String;
.locals 1
iget-object v0, p0, Lcom/google/firebase/messaging/TopicOperation;->topic:Ljava/lang/String;
return-object v0
.end method
.method public hashCode()I
.locals 3
const/4 v0, 0x2
new-array v0, v0, [Ljava/lang/Object;
iget-object v1, p0, Lcom/google/firebase/messaging/TopicOperation;->operation:Ljava/lang/String;
const/4 v2, 0x0
aput-object v1, v0, v2
iget-object v1, p0, Lcom/google/firebase/messaging/TopicOperation;->topic:Ljava/lang/String;
const/4 v2, 0x1
aput-object v1, v0, v2
invoke-static {v0}, Lcom/google/android/gms/common/internal/Objects;->hashCode([Ljava/lang/Object;)I
move-result v0
return v0
.end method
.method public serialize()Ljava/lang/String;
.locals 1
iget-object v0, p0, Lcom/google/firebase/messaging/TopicOperation;->serializedString:Ljava/lang/String;
return-object v0
.end method