- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
67 lines
2.1 KiB
Java
67 lines
2.1 KiB
Java
package com.google.firebase.messaging;
|
|
|
|
import android.text.TextUtils;
|
|
import android.util.Log;
|
|
import com.google.android.gms.common.internal.Objects;
|
|
import java.util.regex.Pattern;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public final class TopicOperation {
|
|
public static final Pattern TOPIC_NAME_REGEXP = Pattern.compile("[a-zA-Z0-9-_.~%]{1,900}");
|
|
public final String operation;
|
|
public final String serializedString;
|
|
public final String topic;
|
|
|
|
public String getOperation() {
|
|
return this.operation;
|
|
}
|
|
|
|
public String getTopic() {
|
|
return this.topic;
|
|
}
|
|
|
|
public String serialize() {
|
|
return this.serializedString;
|
|
}
|
|
|
|
public TopicOperation(String str, String str2) {
|
|
this.topic = normalizeTopicOrThrow(str2, str);
|
|
this.operation = str;
|
|
this.serializedString = str + "!" + str2;
|
|
}
|
|
|
|
public static String normalizeTopicOrThrow(String str, String str2) {
|
|
if (str != null && str.startsWith("/topics/")) {
|
|
Log.w("FirebaseMessaging", String.format("Format /topics/topic-name is deprecated. Only 'topic-name' should be used in %s.", str2));
|
|
str = str.substring(8);
|
|
}
|
|
if (str == null || !TOPIC_NAME_REGEXP.matcher(str).matches()) {
|
|
throw new IllegalArgumentException(String.format("Invalid topic name: %s does not match the allowed format %s.", str, "[a-zA-Z0-9-_.~%]{1,900}"));
|
|
}
|
|
return str;
|
|
}
|
|
|
|
public static TopicOperation from(String str) {
|
|
if (TextUtils.isEmpty(str)) {
|
|
return null;
|
|
}
|
|
String[] split = str.split("!", -1);
|
|
if (split.length != 2) {
|
|
return null;
|
|
}
|
|
return new TopicOperation(split[0], split[1]);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (!(obj instanceof TopicOperation)) {
|
|
return false;
|
|
}
|
|
TopicOperation topicOperation = (TopicOperation) obj;
|
|
return this.topic.equals(topicOperation.topic) && this.operation.equals(topicOperation.operation);
|
|
}
|
|
|
|
public int hashCode() {
|
|
return Objects.hashCode(this.operation, this.topic);
|
|
}
|
|
}
|