.class public final Lcom/unity3d/ads/gatewayclient/CommonGatewayClient; .super Ljava/lang/Object; .source "SourceFile" # interfaces .implements Lcom/unity3d/ads/gatewayclient/GatewayClient; # annotations .annotation system Ldalvik/annotation/MemberClasses; value = { Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$Companion; } .end annotation .annotation build Lkotlin/jvm/internal/SourceDebugExtension; value = { "SMAP\nCommonGatewayClient.kt\nKotlin\n*S Kotlin\n*F\n+ 1 CommonGatewayClient.kt\ncom/unity3d/ads/gatewayclient/CommonGatewayClient\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 3 UniversalResponseKt.kt\ngatewayprotocol/v1/UniversalResponseKtKt\n+ 4 ErrorKt.kt\ngatewayprotocol/v1/ErrorKtKt\n*L\n1#1,201:1\n1#2:202\n1#2:204\n1#2:206\n8#3:203\n8#4:205\n*S KotlinDebug\n*F\n+ 1 CommonGatewayClient.kt\ncom/unity3d/ads/gatewayclient/CommonGatewayClient\n*L\n178#1:204\n179#1:206\n178#1:203\n179#1:205\n*E\n" } .end annotation # static fields .field public static final CODE_400:I = 0x190 .field public static final CODE_599:I = 0x257 .field public static final Companion:Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$Companion; .field public static final RETRY_ATTEMPT_HEADER:Ljava/lang/String; = "X-RETRY-ATTEMPT" # instance fields .field private final handleGatewayUniversalResponse:Lcom/unity3d/ads/core/domain/HandleGatewayUniversalResponse; .field private final httpClient:Lcom/unity3d/services/core/network/core/HttpClient; .field private final sendDiagnosticEvent:Lcom/unity3d/ads/core/domain/SendDiagnosticEvent; .field private final sessionRepository:Lcom/unity3d/ads/core/data/repository/SessionRepository; # direct methods .method static constructor ()V .locals 2 new-instance v0, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$Companion; const/4 v1, 0x0 invoke-direct {v0, v1}, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$Companion;->(Lkotlin/jvm/internal/DefaultConstructorMarker;)V sput-object v0, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->Companion:Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$Companion; return-void .end method .method public constructor (Lcom/unity3d/services/core/network/core/HttpClient;Lcom/unity3d/ads/core/domain/HandleGatewayUniversalResponse;Lcom/unity3d/ads/core/domain/SendDiagnosticEvent;Lcom/unity3d/ads/core/data/repository/SessionRepository;)V .locals 1 const-string v0, "httpClient" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V const-string v0, "handleGatewayUniversalResponse" invoke-static {p2, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V const-string v0, "sendDiagnosticEvent" invoke-static {p3, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V const-string v0, "sessionRepository" invoke-static {p4, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V .line 38 invoke-direct {p0}, Ljava/lang/Object;->()V iput-object p1, p0, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->httpClient:Lcom/unity3d/services/core/network/core/HttpClient; iput-object p2, p0, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->handleGatewayUniversalResponse:Lcom/unity3d/ads/core/domain/HandleGatewayUniversalResponse; iput-object p3, p0, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->sendDiagnosticEvent:Lcom/unity3d/ads/core/domain/SendDiagnosticEvent; iput-object p4, p0, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->sessionRepository:Lcom/unity3d/ads/core/data/repository/SessionRepository; return-void .end method .method private final calculateDelayTime(Lcom/unity3d/ads/gatewayclient/RequestPolicy;I)J .locals 2 .line 187 invoke-virtual {p1}, Lcom/unity3d/ads/gatewayclient/RequestPolicy;->getRetryWaitBase()I move-result v0 invoke-direct {p0, v0, p2}, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->calculateExponentialBackoff(II)J move-result-wide v0 .line 188 invoke-virtual {p1}, Lcom/unity3d/ads/gatewayclient/RequestPolicy;->getRetryJitterPct()F move-result p1 invoke-direct {p0, v0, v1, p1}, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->calculateJitter(JF)J move-result-wide p1 add-long/2addr v0, p1 return-wide v0 .end method .method private final calculateExponentialBackoff(II)J .locals 4 int-to-long v0, p1 const-wide/high16 v2, 0x4000000000000000L # 2.0 int-to-double p1, p2 .line 194 invoke-static {v2, v3, p1, p2}, Ljava/lang/Math;->pow(DD)D move-result-wide p1 double-to-long p1, p1 mul-long/2addr v0, p1 return-wide v0 .end method .method private final calculateJitter(JF)J .locals 4 long-to-float p1, p1 mul-float/2addr p1, p3 float-to-long p1, p1 .line 199 sget-object p3, Lkotlin/random/Random;->Default:Lkotlin/random/Random$Default; neg-long v0, p1 const-wide/16 v2, 0x1 add-long/2addr p1, v2 invoke-virtual {p3, v0, v1, p1, p2}, Lkotlin/random/Random$Default;->nextLong(JJ)J move-result-wide p1 return-wide p1 .end method .method private final getUniversalResponse(Lcom/unity3d/services/core/network/model/HttpResponse;Lcom/unity3d/ads/core/data/model/OperationType;)Lgatewayprotocol/v1/UniversalResponseOuterClass$UniversalResponse; .locals 10 .line 157 :try_start_0 invoke-virtual {p1}, Lcom/unity3d/services/core/network/model/HttpResponse;->getBody()Ljava/lang/Object; move-result-object v0 .line 158 instance-of v1, v0, [B if-eqz v1, :cond_0 .line 159 check-cast v0, [B invoke-static {v0}, Lgatewayprotocol/v1/UniversalResponseOuterClass$UniversalResponse;->parseFrom([B)Lgatewayprotocol/v1/UniversalResponseOuterClass$UniversalResponse; move-result-object v0 const-string v1, "parseFrom(responseBody)" invoke-static {v0, v1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V return-object v0 :catch_0 move-exception v0 goto :goto_0 .line 161 :cond_0 instance-of v1, v0, Ljava/lang/String; if-eqz v1, :cond_1 .line 163 check-cast v0, Ljava/lang/String; sget-object v1, Lkotlin/text/Charsets;->ISO_8859_1:Ljava/nio/charset/Charset; invoke-virtual {v0, v1}, Ljava/lang/String;->getBytes(Ljava/nio/charset/Charset;)[B move-result-object v0 const-string v1, "this as java.lang.String).getBytes(charset)" invoke-static {v0, v1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V .line 162 invoke-static {v0}, Lgatewayprotocol/v1/UniversalResponseOuterClass$UniversalResponse;->parseFrom([B)Lgatewayprotocol/v1/UniversalResponseOuterClass$UniversalResponse; move-result-object v0 const-string v1, "parseFrom(\n \u20268859_1)\n )" .line 163 invoke-static {v0, v1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V return-object v0 .line 166 :cond_1 new-instance v0, Lcom/google/protobuf/InvalidProtocolBufferException; const-string v1, "Could not parse response from gateway service" invoke-direct {v0, v1}, Lcom/google/protobuf/InvalidProtocolBufferException;->(Ljava/lang/String;)V throw v0 :try_end_0 .catch Lcom/google/protobuf/InvalidProtocolBufferException; {:try_start_0 .. :try_end_0} :catch_0 .line 169 :goto_0 invoke-virtual {v0}, Ljava/lang/Throwable;->getLocalizedMessage()Ljava/lang/String; move-result-object v0 filled-new-array {v0}, [Ljava/lang/Object; move-result-object v0 const-string v1, "Failed to parse response from gateway service with exception: %s" invoke-static {v1, v0}, Lcom/unity3d/services/core/log/DeviceLog;->debug(Ljava/lang/String;[Ljava/lang/Object;)V iget-object v2, p0, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->sendDiagnosticEvent:Lcom/unity3d/ads/core/domain/SendDiagnosticEvent; const-string v3, "native_network_parse_failure" const/4 v4, 0x0 const-string v0, "operation" .line 173 invoke-virtual {p2}, Lcom/unity3d/ads/core/data/model/OperationType;->toString()Ljava/lang/String; move-result-object p2 invoke-static {v0, p2}, Lkotlin/TuplesKt;->to(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair; move-result-object p2 const-string v0, "reason" const-string v1, "protobuf_parsing" .line 174 invoke-static {v0, v1}, Lkotlin/TuplesKt;->to(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair; move-result-object v0 .line 175 invoke-virtual {p1}, Lcom/unity3d/services/core/network/model/HttpResponse;->getBody()Ljava/lang/Object; move-result-object p1 invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String; move-result-object p1 const-string v1, "reason_debug" invoke-static {v1, p1}, Lkotlin/TuplesKt;->to(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair; move-result-object p1 filled-new-array {p2, v0, p1}, [Lkotlin/Pair; move-result-object p1 .line 172 invoke-static {p1}, Lkotlin/collections/MapsKt;->mapOf([Lkotlin/Pair;)Ljava/util/Map; move-result-object v5 const/4 v6, 0x0 const/4 v7, 0x0 const/16 v8, 0x1a const/4 v9, 0x0 .line 170 invoke-static/range {v2 .. v9}, Lcom/unity3d/ads/core/domain/SendDiagnosticEvent$DefaultImpls;->invoke$default(Lcom/unity3d/ads/core/domain/SendDiagnosticEvent;Ljava/lang/String;Ljava/lang/Double;Ljava/util/Map;Ljava/util/Map;Lcom/unity3d/ads/core/data/model/AdObject;ILjava/lang/Object;)V .line 8 sget-object p1, Lgatewayprotocol/v1/UniversalResponseKt$Dsl;->Companion:Lgatewayprotocol/v1/UniversalResponseKt$Dsl$Companion; invoke-static {}, Lgatewayprotocol/v1/UniversalResponseOuterClass$UniversalResponse;->newBuilder()Lgatewayprotocol/v1/UniversalResponseOuterClass$UniversalResponse$Builder; move-result-object p2 const-string v0, "newBuilder()" invoke-static {p2, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V invoke-virtual {p1, p2}, Lgatewayprotocol/v1/UniversalResponseKt$Dsl$Companion;->_create(Lgatewayprotocol/v1/UniversalResponseOuterClass$UniversalResponse$Builder;)Lgatewayprotocol/v1/UniversalResponseKt$Dsl; move-result-object p1 .line 8 sget-object p2, Lgatewayprotocol/v1/ErrorKt$Dsl;->Companion:Lgatewayprotocol/v1/ErrorKt$Dsl$Companion; invoke-static {}, Lgatewayprotocol/v1/ErrorOuterClass$Error;->newBuilder()Lgatewayprotocol/v1/ErrorOuterClass$Error$Builder; move-result-object v1 invoke-static {v1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V invoke-virtual {p2, v1}, Lgatewayprotocol/v1/ErrorKt$Dsl$Companion;->_create(Lgatewayprotocol/v1/ErrorOuterClass$Error$Builder;)Lgatewayprotocol/v1/ErrorKt$Dsl; move-result-object p2 const-string v0, "ERROR: Could not parse response from gateway service" .line 180 invoke-virtual {p2, v0}, Lgatewayprotocol/v1/ErrorKt$Dsl;->setErrorText(Ljava/lang/String;)V .line 8 invoke-virtual {p2}, Lgatewayprotocol/v1/ErrorKt$Dsl;->_build()Lgatewayprotocol/v1/ErrorOuterClass$Error; move-result-object p2 .line 179 invoke-virtual {p1, p2}, Lgatewayprotocol/v1/UniversalResponseKt$Dsl;->setError(Lgatewayprotocol/v1/ErrorOuterClass$Error;)V .line 8 invoke-virtual {p1}, Lgatewayprotocol/v1/UniversalResponseKt$Dsl;->_build()Lgatewayprotocol/v1/UniversalResponseOuterClass$UniversalResponse; move-result-object p1 return-object p1 .end method .method private final sendNetworkErrorDiagnosticEvent(Lcom/unity3d/ads/core/data/model/exception/UnityAdsNetworkException;ILcom/unity3d/ads/core/data/model/OperationType;Lkotlin/time/TimeMark;)V .locals 8 .line 124 sget-object v0, Lcom/unity3d/ads/core/data/model/OperationType;->UNIVERSAL_EVENT:Lcom/unity3d/ads/core/data/model/OperationType; if-ne p3, v0, :cond_0 return-void :cond_0 const-string v0, "operation" .line 127 invoke-virtual {p3}, Lcom/unity3d/ads/core/data/model/OperationType;->toString()Ljava/lang/String; move-result-object p3 invoke-static {v0, p3}, Lkotlin/TuplesKt;->to(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair; move-result-object v1 const-string p3, "retries" .line 128 invoke-static {p2}, Ljava/lang/String;->valueOf(I)Ljava/lang/String; move-result-object p2 invoke-static {p3, p2}, Lkotlin/TuplesKt;->to(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair; move-result-object v2 .line 129 invoke-virtual {p1}, Lcom/unity3d/ads/core/data/model/exception/UnityAdsNetworkException;->getProtocol()Ljava/lang/String; move-result-object p2 invoke-static {p2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String; move-result-object p2 const-string p3, "protocol" invoke-static {p3, p2}, Lkotlin/TuplesKt;->to(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair; move-result-object v3 .line 130 invoke-virtual {p1}, Lcom/unity3d/ads/core/data/model/exception/UnityAdsNetworkException;->getClient()Ljava/lang/String; move-result-object p2 invoke-static {p2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String; move-result-object p2 const-string p3, "network_client" invoke-static {p3, p2}, Lkotlin/TuplesKt;->to(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair; move-result-object v4 .line 131 invoke-virtual {p1}, Lcom/unity3d/ads/core/data/model/exception/UnityAdsNetworkException;->getCode()Ljava/lang/Integer; move-result-object p2 invoke-static {p2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String; move-result-object p2 const-string p3, "reason_code" invoke-static {p3, p2}, Lkotlin/TuplesKt;->to(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair; move-result-object v5 const-string p2, "reason_debug" .line 132 invoke-virtual {p1}, Lcom/unity3d/ads/core/data/model/exception/UnityAdsNetworkException;->getMessage()Ljava/lang/String; move-result-object p1 invoke-static {p2, p1}, Lkotlin/TuplesKt;->to(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair; move-result-object v6 filled-new-array/range {v1 .. v6}, [Lkotlin/Pair; move-result-object p1 .line 126 invoke-static {p1}, Lkotlin/collections/MapsKt;->mutableMapOf([Lkotlin/Pair;)Ljava/util/Map; move-result-object v3 iget-object v0, p0, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->sendDiagnosticEvent:Lcom/unity3d/ads/core/domain/SendDiagnosticEvent; const-string v1, "native_network_failure_time" .line 134 invoke-static {p4}, Lcom/unity3d/ads/core/extensions/TimeExtensionsKt;->elapsedMillis(Lkotlin/time/TimeMark;)D move-result-wide p1 invoke-static {p1, p2}, Ljava/lang/Double;->valueOf(D)Ljava/lang/Double; move-result-object v2 const/4 v4, 0x0 const/4 v5, 0x0 const/16 v6, 0x18 const/4 v7, 0x0 invoke-static/range {v0 .. v7}, Lcom/unity3d/ads/core/domain/SendDiagnosticEvent$DefaultImpls;->invoke$default(Lcom/unity3d/ads/core/domain/SendDiagnosticEvent;Ljava/lang/String;Ljava/lang/Double;Ljava/util/Map;Ljava/util/Map;Lcom/unity3d/ads/core/data/model/AdObject;ILjava/lang/Object;)V return-void .end method .method private final sendNetworkSuccessDiagnosticEvent(Lcom/unity3d/services/core/network/model/HttpResponse;ILcom/unity3d/ads/core/data/model/OperationType;Lkotlin/time/TimeMark;)V .locals 8 .line 143 sget-object v0, Lcom/unity3d/ads/core/data/model/OperationType;->UNIVERSAL_EVENT:Lcom/unity3d/ads/core/data/model/OperationType; if-ne p3, v0, :cond_0 return-void :cond_0 const-string v0, "operation" .line 146 invoke-virtual {p3}, Lcom/unity3d/ads/core/data/model/OperationType;->toString()Ljava/lang/String; move-result-object p3 invoke-static {v0, p3}, Lkotlin/TuplesKt;->to(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair; move-result-object p3 const-string v0, "retries" .line 147 invoke-static {p2}, Ljava/lang/String;->valueOf(I)Ljava/lang/String; move-result-object p2 invoke-static {v0, p2}, Lkotlin/TuplesKt;->to(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair; move-result-object p2 .line 148 invoke-virtual {p1}, Lcom/unity3d/services/core/network/model/HttpResponse;->getProtocol()Ljava/lang/String; move-result-object v0 const-string v1, "protocol" invoke-static {v1, v0}, Lkotlin/TuplesKt;->to(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair; move-result-object v0 const-string v1, "network_client" .line 149 invoke-virtual {p1}, Lcom/unity3d/services/core/network/model/HttpResponse;->getClient()Ljava/lang/String; move-result-object v2 invoke-static {v1, v2}, Lkotlin/TuplesKt;->to(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair; move-result-object v1 .line 150 invoke-virtual {p1}, Lcom/unity3d/services/core/network/model/HttpResponse;->getStatusCode()I move-result p1 invoke-static {p1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String; move-result-object p1 const-string v2, "reason_code" invoke-static {v2, p1}, Lkotlin/TuplesKt;->to(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair; move-result-object p1 filled-new-array {p3, p2, v0, v1, p1}, [Lkotlin/Pair; move-result-object p1 .line 145 invoke-static {p1}, Lkotlin/collections/MapsKt;->mutableMapOf([Lkotlin/Pair;)Ljava/util/Map; move-result-object v3 iget-object v0, p0, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->sendDiagnosticEvent:Lcom/unity3d/ads/core/domain/SendDiagnosticEvent; const-string v1, "native_network_success_time" .line 152 invoke-static {p4}, Lcom/unity3d/ads/core/extensions/TimeExtensionsKt;->elapsedMillis(Lkotlin/time/TimeMark;)D move-result-wide p1 invoke-static {p1, p2}, Ljava/lang/Double;->valueOf(D)Ljava/lang/Double; move-result-object v2 const/4 v4, 0x0 const/4 v5, 0x0 const/16 v6, 0x18 const/4 v7, 0x0 invoke-static/range {v0 .. v7}, Lcom/unity3d/ads/core/domain/SendDiagnosticEvent$DefaultImpls;->invoke$default(Lcom/unity3d/ads/core/domain/SendDiagnosticEvent;Ljava/lang/String;Ljava/lang/Double;Ljava/util/Map;Ljava/util/Map;Lcom/unity3d/ads/core/data/model/AdObject;ILjava/lang/Object;)V return-void .end method .method private final shouldRetry(I)Z .locals 2 const/16 v0, 0x190 const/4 v1, 0x0 if-gt v0, p1, :cond_0 const/16 v0, 0x258 if-ge p1, v0, :cond_0 const/4 v1, 0x1 :cond_0 return v1 .end method # virtual methods .method public request(Ljava/lang/String;Lgatewayprotocol/v1/UniversalRequestOuterClass$UniversalRequest;Lcom/unity3d/ads/gatewayclient/RequestPolicy;Lcom/unity3d/ads/core/data/model/OperationType;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; .locals 39 .annotation system Ldalvik/annotation/Signature; value = { "(", "Ljava/lang/String;", "Lgatewayprotocol/v1/UniversalRequestOuterClass$UniversalRequest;", "Lcom/unity3d/ads/gatewayclient/RequestPolicy;", "Lcom/unity3d/ads/core/data/model/OperationType;", "Lkotlin/coroutines/Continuation;", ")", "Ljava/lang/Object;" } .end annotation move-object/from16 v1, p0 move-object/from16 v0, p5 instance-of v2, v0, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1; if-eqz v2, :cond_0 move-object v2, v0 check-cast v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1; iget v3, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->label:I const/high16 v4, -0x80000000 and-int v5, v3, v4 if-eqz v5, :cond_0 sub-int/2addr v3, v4 iput v3, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->label:I goto :goto_0 :cond_0 new-instance v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1; invoke-direct {v2, v1, v0}, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->(Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;Lkotlin/coroutines/Continuation;)V :goto_0 iget-object v0, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->result:Ljava/lang/Object; invoke-static {}, Lkotlin/coroutines/intrinsics/IntrinsicsKt;->getCOROUTINE_SUSPENDED()Ljava/lang/Object; move-result-object v3 .line 56 iget v4, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->label:I const-string v5, "ms" const-string v6, " retries and duration: " const-string v7, "Gateway request failed after " const/4 v8, 0x3 const/4 v9, 0x2 const/4 v10, 0x1 if-eqz v4, :cond_4 if-eq v4, v10, :cond_3 if-eq v4, v9, :cond_2 if-ne v4, v8, :cond_1 iget-wide v11, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->J$0:J iget-object v4, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$5:Ljava/lang/Object; check-cast v4, Ljava/lang/String; iget-object v13, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$4:Ljava/lang/Object; check-cast v13, Lkotlin/jvm/internal/Ref$IntRef; iget-object v14, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$3:Ljava/lang/Object; check-cast v14, Lcom/unity3d/ads/core/data/model/OperationType; iget-object v15, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$2:Ljava/lang/Object; check-cast v15, Lcom/unity3d/ads/gatewayclient/RequestPolicy; iget-object v8, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$1:Ljava/lang/Object; check-cast v8, Lgatewayprotocol/v1/UniversalRequestOuterClass$UniversalRequest; iget-object v9, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$0:Ljava/lang/Object; check-cast v9, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient; invoke-static {v0}, Lkotlin/ResultKt;->throwOnFailure(Ljava/lang/Object;)V move-object v0, v2 move-object v10, v3 move-object v2, v8 move-object v3, v15 const/4 v15, 0x3 move-object v8, v5 move-wide/from16 v36, v11 move-object v11, v4 move-object v4, v14 move-object v14, v13 move-wide/from16 v12, v36 goto/16 :goto_9 :cond_1 new-instance v0, Ljava/lang/IllegalStateException; const-string v2, "call to \'resume\' before \'invoke\' with coroutine" invoke-direct {v0, v2}, Ljava/lang/IllegalStateException;->(Ljava/lang/String;)V throw v0 :cond_2 iget-object v2, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$0:Ljava/lang/Object; check-cast v2, Lgatewayprotocol/v1/UniversalResponseOuterClass$UniversalResponse; invoke-static {v0}, Lkotlin/ResultKt;->throwOnFailure(Ljava/lang/Object;)V goto/16 :goto_8 :cond_3 iget-wide v8, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->J$1:J iget-wide v11, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->J$0:J iget-object v4, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$5:Ljava/lang/Object; check-cast v4, Ljava/lang/String; iget-object v13, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$4:Ljava/lang/Object; check-cast v13, Lkotlin/jvm/internal/Ref$IntRef; iget-object v14, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$3:Ljava/lang/Object; check-cast v14, Lcom/unity3d/ads/core/data/model/OperationType; iget-object v15, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$2:Ljava/lang/Object; check-cast v15, Lcom/unity3d/ads/gatewayclient/RequestPolicy; iget-object v10, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$1:Ljava/lang/Object; check-cast v10, Lgatewayprotocol/v1/UniversalRequestOuterClass$UniversalRequest; move-object/from16 v16, v3 iget-object v3, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$0:Ljava/lang/Object; check-cast v3, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient; :try_start_0 invoke-static {v0}, Lkotlin/ResultKt;->throwOnFailure(Ljava/lang/Object;)V :try_end_0 .catch Lcom/unity3d/ads/core/data/model/exception/UnityAdsNetworkException; {:try_start_0 .. :try_end_0} :catch_0 move-object v1, v10 move-object/from16 v10, v16 move-object/from16 v16, v6 move-object/from16 v36, v15 move-object v15, v5 move-object/from16 v5, v36 goto/16 :goto_3 :catch_0 move-exception v0 move-object v1, v0 move-object v0, v10 move-object/from16 v10, v16 move-object/from16 v16, v6 move-object/from16 v36, v15 move-object v15, v5 move-object/from16 v5, v36 goto/16 :goto_6 :cond_4 move-object/from16 v16, v3 invoke-static {v0}, Lkotlin/ResultKt;->throwOnFailure(Ljava/lang/Object;)V .line 62 new-instance v0, Lkotlin/jvm/internal/Ref$IntRef; invoke-direct {v0}, Lkotlin/jvm/internal/Ref$IntRef;->()V const-string v3, "https://gateway.unityads.unity3d.com/v1" move-object/from16 v4, p1 .line 65 invoke-static {v4, v3}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z move-result v3 if-nez v3, :cond_5 move-object v3, v4 goto :goto_1 :cond_5 iget-object v3, v1, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->sessionRepository:Lcom/unity3d/ads/core/data/repository/SessionRepository; .line 68 invoke-interface {v3}, Lcom/unity3d/ads/core/data/repository/SessionRepository;->getGatewayUrl()Ljava/lang/String; move-result-object v3 :goto_1 const-wide/16 v8, 0x0 move-object/from16 v4, p4 move-object v14, v0 move-object v11, v3 move-wide v12, v8 move-object/from16 v10, v16 move-object/from16 v3, p3 move-object v9, v1 move-object v8, v2 move-object/from16 v2, p2 .line 72 :goto_2 invoke-static {}, Lkotlin/collections/MapsKt;->createMapBuilder()Ljava/util/Map; move-result-object v0 const-string v15, "application/x-protobuf" .line 73 invoke-static {v15}, Lkotlin/collections/CollectionsKt;->listOf(Ljava/lang/Object;)Ljava/util/List; move-result-object v15 const-string v1, "Content-Type" invoke-interface {v0, v1, v15}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; .line 74 iget v1, v14, Lkotlin/jvm/internal/Ref$IntRef;->element:I if-lez v1, :cond_6 .line 75 invoke-static {v1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String; move-result-object v1 invoke-static {v1}, Lkotlin/collections/CollectionsKt;->listOf(Ljava/lang/Object;)Ljava/util/List; move-result-object v1 const-string v15, "X-RETRY-ATTEMPT" invoke-interface {v0, v15, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; .line 72 :cond_6 invoke-static {v0}, Lkotlin/collections/MapsKt;->build(Ljava/util/Map;)Ljava/util/Map; move-result-object v21 .line 79 new-instance v0, Lcom/unity3d/services/core/network/model/HttpRequest; move-object/from16 v16, v0 const/16 v18, 0x0 .line 81 sget-object v19, Lcom/unity3d/services/core/network/model/RequestType;->POST:Lcom/unity3d/services/core/network/model/RequestType; .line 82 invoke-virtual {v2}, Lcom/google/protobuf/AbstractMessageLite;->toByteArray()[B move-result-object v20 const/16 v22, 0x0 const/16 v23, 0x0 const/16 v24, 0x0 const/16 v25, 0x0 .line 84 invoke-virtual {v3}, Lcom/unity3d/ads/gatewayclient/RequestPolicy;->getConnectTimeout()I move-result v26 .line 85 invoke-virtual {v3}, Lcom/unity3d/ads/gatewayclient/RequestPolicy;->getReadTimeout()I move-result v27 .line 86 invoke-virtual {v3}, Lcom/unity3d/ads/gatewayclient/RequestPolicy;->getWriteTimeout()I move-result v28 const/16 v29, 0x0 const/16 v30, 0x1 const/16 v31, 0x0 const/16 v32, 0x0 const/16 v33, 0x0 const v34, 0x1d1e2 const/16 v35, 0x0 move-object/from16 v17, v11 .line 79 invoke-direct/range {v16 .. v35}, Lcom/unity3d/services/core/network/model/HttpRequest;->(Ljava/lang/String;Ljava/lang/String;Lcom/unity3d/services/core/network/model/RequestType;Ljava/lang/Object;Ljava/util/Map;Ljava/util/Map;Lcom/unity3d/services/core/network/model/BodyType;Ljava/lang/String;Ljava/lang/Integer;IIIIZLcom/unity3d/ads/core/data/model/OperationType;Ljava/io/File;IILkotlin/jvm/internal/DefaultConstructorMarker;)V .line 92 sget-object v1, Lkotlin/time/TimeSource$Monotonic;->INSTANCE:Lkotlin/time/TimeSource$Monotonic; move-object v15, v5 move-object/from16 v16, v6 invoke-virtual {v1}, Lkotlin/time/TimeSource$Monotonic;->markNow-z9LOYto()J move-result-wide v5 .line 94 :try_start_1 iget-object v1, v9, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->httpClient:Lcom/unity3d/services/core/network/core/HttpClient; iput-object v9, v8, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$0:Ljava/lang/Object; iput-object v2, v8, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$1:Ljava/lang/Object; iput-object v3, v8, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$2:Ljava/lang/Object; iput-object v4, v8, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$3:Ljava/lang/Object; iput-object v14, v8, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$4:Ljava/lang/Object; iput-object v11, v8, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$5:Ljava/lang/Object; iput-wide v12, v8, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->J$0:J iput-wide v5, v8, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->J$1:J :try_end_1 .catch Lcom/unity3d/ads/core/data/model/exception/UnityAdsNetworkException; {:try_start_1 .. :try_end_1} :catch_4 move-object/from16 p1, v2 const/4 v2, 0x1 :try_start_2 iput v2, v8, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->label:I invoke-interface {v1, v0, v8}, Lcom/unity3d/services/core/network/core/HttpClient;->execute(Lcom/unity3d/services/core/network/model/HttpRequest;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; move-result-object v0 :try_end_2 .catch Lcom/unity3d/ads/core/data/model/exception/UnityAdsNetworkException; {:try_start_2 .. :try_end_2} :catch_3 if-ne v0, v10, :cond_7 return-object v10 :cond_7 move-object/from16 v1, p1 move-object v2, v8 move-wide/from16 v36, v5 move-object v5, v3 move-object v3, v9 move-wide/from16 v8, v36 move-object/from16 v38, v14 move-object v14, v4 move-object v4, v11 move-wide v11, v12 move-object/from16 v13, v38 .line 56 :goto_3 :try_start_3 check-cast v0, Lcom/unity3d/services/core/network/model/HttpResponse; .line 95 iget v6, v13, Lkotlin/jvm/internal/Ref$IntRef;->element:I :try_end_3 .catch Lcom/unity3d/ads/core/data/model/exception/UnityAdsNetworkException; {:try_start_3 .. :try_end_3} :catch_2 move-object/from16 p1, v1 :try_start_4 invoke-static {v8, v9}, Lkotlin/time/TimeSource$Monotonic$ValueTimeMark;->box-impl(J)Lkotlin/time/TimeSource$Monotonic$ValueTimeMark; move-result-object v1 invoke-direct {v3, v0, v6, v14, v1}, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->sendNetworkSuccessDiagnosticEvent(Lcom/unity3d/services/core/network/model/HttpResponse;ILcom/unity3d/ads/core/data/model/OperationType;Lkotlin/time/TimeMark;)V :try_end_4 .catch Lcom/unity3d/ads/core/data/model/exception/UnityAdsNetworkException; {:try_start_4 .. :try_end_4} :catch_1 move-object/from16 v1, p1 move-object v9, v3 goto :goto_7 :catch_1 move-exception v0 :goto_4 move-object v1, v0 move-object/from16 v0, p1 goto :goto_6 :catch_2 move-exception v0 move-object/from16 p1, v1 goto :goto_4 :catch_3 move-exception v0 :goto_5 move-object v1, v0 move-object v2, v8 move-object/from16 v0, p1 move-wide/from16 v36, v5 move-object v5, v3 move-object v3, v9 move-wide/from16 v8, v36 move-object/from16 v38, v14 move-object v14, v4 move-object v4, v11 move-wide v11, v12 move-object/from16 v13, v38 goto :goto_6 :catch_4 move-exception v0 move-object/from16 p1, v2 goto :goto_5 .line 97 :goto_6 iget v6, v13, Lkotlin/jvm/internal/Ref$IntRef;->element:I invoke-static {v8, v9}, Lkotlin/time/TimeSource$Monotonic$ValueTimeMark;->box-impl(J)Lkotlin/time/TimeSource$Monotonic$ValueTimeMark; move-result-object v8 invoke-direct {v3, v1, v6, v14, v8}, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->sendNetworkErrorDiagnosticEvent(Lcom/unity3d/ads/core/data/model/exception/UnityAdsNetworkException;ILcom/unity3d/ads/core/data/model/OperationType;Lkotlin/time/TimeMark;)V .line 98 invoke-static {v1}, Lcom/unity3d/services/core/network/model/HttpResponseKt;->toHttpResponse(Lcom/unity3d/ads/core/data/model/exception/UnityAdsNetworkException;)Lcom/unity3d/services/core/network/model/HttpResponse; move-result-object v1 move-object v9, v3 move-object/from16 v36, v1 move-object v1, v0 move-object/from16 v0, v36 .line 101 :goto_7 invoke-virtual {v0}, Lcom/unity3d/services/core/network/model/HttpResponse;->getStatusCode()I move-result v3 invoke-direct {v9, v3}, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->shouldRetry(I)Z move-result v3 if-nez v3, :cond_a .line 102 invoke-static {v0}, Lcom/unity3d/services/core/network/model/HttpResponseKt;->isSuccessful(Lcom/unity3d/services/core/network/model/HttpResponse;)Z move-result v1 if-eqz v1, :cond_9 .line 103 invoke-direct {v9, v0, v14}, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->getUniversalResponse(Lcom/unity3d/services/core/network/model/HttpResponse;Lcom/unity3d/ads/core/data/model/OperationType;)Lgatewayprotocol/v1/UniversalResponseOuterClass$UniversalResponse; move-result-object v0 iget-object v1, v9, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->handleGatewayUniversalResponse:Lcom/unity3d/ads/core/domain/HandleGatewayUniversalResponse; iput-object v0, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$0:Ljava/lang/Object; const/4 v3, 0x0 iput-object v3, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$1:Ljava/lang/Object; iput-object v3, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$2:Ljava/lang/Object; iput-object v3, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$3:Ljava/lang/Object; iput-object v3, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$4:Ljava/lang/Object; iput-object v3, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$5:Ljava/lang/Object; const/4 v3, 0x2 iput v3, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->label:I invoke-interface {v1, v0, v2}, Lcom/unity3d/ads/core/domain/HandleGatewayUniversalResponse;->invoke(Lgatewayprotocol/v1/UniversalResponseOuterClass$UniversalResponse;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; move-result-object v1 if-ne v1, v10, :cond_8 return-object v10 :cond_8 move-object v2, v0 :goto_8 return-object v2 .line 105 :cond_9 new-instance v0, Lcom/unity3d/ads/core/data/model/exception/UnityAdsNetworkException; new-instance v1, Ljava/lang/StringBuilder; invoke-direct {v1}, Ljava/lang/StringBuilder;->()V invoke-virtual {v1, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; iget v2, v13, Lkotlin/jvm/internal/Ref$IntRef;->element:I invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-object/from16 v6, v16 invoke-virtual {v1, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; invoke-virtual {v1, v11, v12}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder; move-object v8, v15 invoke-virtual {v1, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v4 const/4 v5, 0x0 const/4 v6, 0x0 const/4 v7, 0x0 const/4 v8, 0x0 const/4 v9, 0x0 const/4 v10, 0x0 const/16 v11, 0x7e const/4 v12, 0x0 move-object v3, v0 invoke-direct/range {v3 .. v12}, Lcom/unity3d/ads/core/data/model/exception/UnityAdsNetworkException;->(Ljava/lang/String;Lcom/unity3d/ads/core/data/model/OperationType;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V throw v0 :cond_a move-object v8, v15 move-object/from16 v6, v16 const/4 v3, 0x2 .line 108 iget v0, v13, Lkotlin/jvm/internal/Ref$IntRef;->element:I move-object v15, v4 invoke-direct {v9, v5, v0}, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient;->calculateDelayTime(Lcom/unity3d/ads/gatewayclient/RequestPolicy;I)J move-result-wide v3 add-long/2addr v11, v3 .line 110 iput-object v9, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$0:Ljava/lang/Object; iput-object v1, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$1:Ljava/lang/Object; iput-object v5, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$2:Ljava/lang/Object; iput-object v14, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$3:Ljava/lang/Object; iput-object v13, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$4:Ljava/lang/Object; move-object v0, v15 iput-object v0, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->L$5:Ljava/lang/Object; iput-wide v11, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->J$0:J const/4 v15, 0x3 iput v15, v2, Lcom/unity3d/ads/gatewayclient/CommonGatewayClient$request$1;->label:I invoke-static {v3, v4, v2}, Lkotlinx/coroutines/DelayKt;->delay(JLkotlin/coroutines/Continuation;)Ljava/lang/Object; move-result-object v3 if-ne v3, v10, :cond_b return-object v10 :cond_b move-object v3, v5 move-object v4, v14 move-object v14, v13 move-wide v12, v11 move-object v11, v0 move-object v0, v2 move-object v2, v1 .line 112 :goto_9 iget v1, v14, Lkotlin/jvm/internal/Ref$IntRef;->element:I const/4 v5, 0x1 add-int/2addr v1, v5 iput v1, v14, Lkotlin/jvm/internal/Ref$IntRef;->element:I .line 113 invoke-virtual {v3}, Lcom/unity3d/ads/gatewayclient/RequestPolicy;->getMaxDuration()I move-result v1 move-object/from16 v16, v6 int-to-long v5, v1 cmp-long v1, v12, v5 if-gtz v1, :cond_c move-object/from16 v1, p0 move-object v5, v8 move-object/from16 v6, v16 move-object v8, v0 goto/16 :goto_2 .line 115 :cond_c new-instance v0, Lcom/unity3d/ads/core/data/model/exception/UnityAdsNetworkException; new-instance v1, Ljava/lang/StringBuilder; invoke-direct {v1}, Ljava/lang/StringBuilder;->()V invoke-virtual {v1, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; iget v2, v14, Lkotlin/jvm/internal/Ref$IntRef;->element:I invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-object/from16 v2, v16 invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; invoke-virtual {v1, v12, v13}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder; invoke-virtual {v1, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v18 const/16 v19, 0x0 const/16 v20, 0x0 const/16 v21, 0x0 const/16 v22, 0x0 const/16 v23, 0x0 const/16 v24, 0x0 const/16 v25, 0x7e const/16 v26, 0x0 move-object/from16 v17, v0 invoke-direct/range {v17 .. v26}, Lcom/unity3d/ads/core/data/model/exception/UnityAdsNetworkException;->(Ljava/lang/String;Lcom/unity3d/ads/core/data/model/OperationType;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V throw v0 .end method