137 lines
5.3 KiB
Java
137 lines
5.3 KiB
Java
package com.airbnb.deeplinkdispatch;
|
|
|
|
import com.airbnb.deeplinkdispatch.DeepLinkEntry;
|
|
import com.airbnb.deeplinkdispatch.base.MatchIndex;
|
|
import com.airbnb.deeplinkdispatch.base.Utils;
|
|
import java.io.OutputStream;
|
|
import java.nio.charset.Charset;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import kotlin.NoWhenBranchMatchedException;
|
|
import o.C14953gcr;
|
|
import o.C14957gcv;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class Root extends TreeNode {
|
|
private final String id;
|
|
|
|
public /* synthetic */ Root(String str, int i, C14953gcr c14953gcr) {
|
|
this((i & 1) != 0 ? MatchIndex.ROOT_VALUE : str);
|
|
}
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
public Root(String str) {
|
|
super(MatchIndex.ROOT_VALUE, new NodeMetadata((byte) 1, str));
|
|
C14957gcv.e(str, "");
|
|
this.id = str;
|
|
}
|
|
|
|
public final void writeToOutoutStream(OutputStream outputStream) {
|
|
C14957gcv.e(outputStream, "");
|
|
byte[] m16toUByteArrayTcUX1vc = m16toUByteArrayTcUX1vc();
|
|
byte[] copyOf = Arrays.copyOf(m16toUByteArrayTcUX1vc, m16toUByteArrayTcUX1vc.length);
|
|
C14957gcv.c(copyOf, "");
|
|
outputStream.write(copyOf);
|
|
}
|
|
|
|
public final List<CharSequence> getStrings() {
|
|
byte[] m16toUByteArrayTcUX1vc = m16toUByteArrayTcUX1vc();
|
|
byte[] copyOf = Arrays.copyOf(m16toUByteArrayTcUX1vc, m16toUByteArrayTcUX1vc.length);
|
|
C14957gcv.c(copyOf, "");
|
|
Charset forName = Charset.forName(MatchIndex.MATCH_INDEX_ENCODING);
|
|
C14957gcv.c(forName, "");
|
|
return com.airbnb.deeplinkdispatch.base.UtilsKt.chunkOnModifiedUtf8ByteSize(new String(copyOf, forName), 65535);
|
|
}
|
|
|
|
public final void addToTrie(DeepLinkEntry deepLinkEntry) {
|
|
C14957gcv.e(deepLinkEntry, "");
|
|
DeepLinkUri parseTemplate = DeepLinkUri.parseTemplate(deepLinkEntry.getUriTemplate());
|
|
String scheme = parseTemplate.scheme();
|
|
C14957gcv.c((Object) scheme, "");
|
|
String orderPlaceholderValues = UrlTreeKt.orderPlaceholderValues(scheme);
|
|
Utils.INSTANCE.validateIfComponentParam(orderPlaceholderValues);
|
|
TreeNode addNode = addNode(new Scheme(orderPlaceholderValues));
|
|
String host = parseTemplate.host();
|
|
if (host != null && host.length() != 0) {
|
|
String host2 = parseTemplate.host();
|
|
C14957gcv.c((Object) host2, "");
|
|
String orderPlaceholderValues2 = UrlTreeKt.orderPlaceholderValues(host2);
|
|
Utils.INSTANCE.validateIfComponentParam(orderPlaceholderValues2);
|
|
addNode = addNode.addNode(new Host(orderPlaceholderValues2));
|
|
List<String> pathSegments = parseTemplate.pathSegments();
|
|
if (pathSegments == null || pathSegments.isEmpty()) {
|
|
addNode.setMatch(uriMatch(deepLinkEntry));
|
|
}
|
|
}
|
|
List<String> pathSegments2 = parseTemplate.pathSegments();
|
|
if (pathSegments2 == null || pathSegments2.isEmpty()) {
|
|
return;
|
|
}
|
|
for (String str : parseTemplate.pathSegments()) {
|
|
C14957gcv.c((Object) str, "");
|
|
String orderPlaceholderValues3 = UrlTreeKt.orderPlaceholderValues(str);
|
|
Utils.INSTANCE.validateIfComponentParam(orderPlaceholderValues3);
|
|
Utils.INSTANCE.validateIfConfigurablePathSegment(orderPlaceholderValues3);
|
|
addNode = addNode.addNode(new PathSegment(orderPlaceholderValues3));
|
|
}
|
|
addNode.setMatch(uriMatch(deepLinkEntry));
|
|
}
|
|
|
|
private final UriMatch uriMatch(DeepLinkEntry deepLinkEntry) {
|
|
if (deepLinkEntry instanceof DeepLinkEntry.ActivityDeeplinkEntry) {
|
|
return new UriMatch(MatchType.Activity, deepLinkEntry.getUriTemplate(), deepLinkEntry.getClassName(), null);
|
|
}
|
|
if (deepLinkEntry instanceof DeepLinkEntry.MethodDeeplinkEntry) {
|
|
return new UriMatch(MatchType.Method, deepLinkEntry.getUriTemplate(), deepLinkEntry.getClassName(), ((DeepLinkEntry.MethodDeeplinkEntry) deepLinkEntry).getMethod());
|
|
}
|
|
if (deepLinkEntry instanceof DeepLinkEntry.HandlerDeepLinkEntry) {
|
|
return new UriMatch(MatchType.Handler, deepLinkEntry.getUriTemplate(), deepLinkEntry.getClassName(), null);
|
|
}
|
|
throw new NoWhenBranchMatchedException();
|
|
}
|
|
|
|
public final String toString() {
|
|
StringBuilder sb = new StringBuilder("Root(id=");
|
|
sb.append(getId());
|
|
sb.append(')');
|
|
return sb.toString();
|
|
}
|
|
|
|
public final int hashCode() {
|
|
return getId().hashCode();
|
|
}
|
|
|
|
@Override // com.airbnb.deeplinkdispatch.TreeNode
|
|
public final String getId() {
|
|
return this.id;
|
|
}
|
|
|
|
public final boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
return (obj instanceof Root) && C14957gcv.b((Object) getId(), (Object) ((Root) obj).getId());
|
|
}
|
|
|
|
public final Root copy(String str) {
|
|
C14957gcv.e(str, "");
|
|
return new Root(str);
|
|
}
|
|
|
|
public final String component1() {
|
|
return getId();
|
|
}
|
|
|
|
public static /* synthetic */ Root copy$default(Root root, String str, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
str = root.getId();
|
|
}
|
|
return root.copy(str);
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public Root() {
|
|
this(null, 1, 0 == true ? 1 : 0);
|
|
}
|
|
}
|