- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
322 lines
15 KiB
Java
322 lines
15 KiB
Java
package com.unity3d.ads.adplayer;
|
|
|
|
import com.unity3d.ads.adplayer.model.WebViewEvent;
|
|
import com.unity3d.ads.core.extensions.JSONArrayExtensionsKt;
|
|
import com.unity3d.services.core.log.DeviceLog;
|
|
import java.util.Iterator;
|
|
import java.util.Set;
|
|
import kotlin.Pair;
|
|
import kotlin.ResultKt;
|
|
import kotlin.Unit;
|
|
import kotlin.collections.SetsKt__SetsKt;
|
|
import kotlin.collections.SetsKt___SetsKt;
|
|
import kotlin.coroutines.Continuation;
|
|
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
|
|
import kotlin.coroutines.jvm.internal.DebugMetadata;
|
|
import kotlin.coroutines.jvm.internal.SuspendLambda;
|
|
import kotlin.jvm.functions.Function2;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.jvm.internal.SourceDebugExtension;
|
|
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
|
|
import kotlinx.coroutines.CompletableDeferred;
|
|
import kotlinx.coroutines.CoroutineDispatcher;
|
|
import kotlinx.coroutines.CoroutineName;
|
|
import kotlinx.coroutines.CoroutineScope;
|
|
import kotlinx.coroutines.CoroutineScopeKt;
|
|
import kotlinx.coroutines.flow.FlowKt;
|
|
import kotlinx.coroutines.flow.MutableSharedFlow;
|
|
import kotlinx.coroutines.flow.MutableStateFlow;
|
|
import kotlinx.coroutines.flow.SharedFlow;
|
|
import kotlinx.coroutines.flow.SharedFlowKt;
|
|
import kotlinx.coroutines.flow.StateFlowKt;
|
|
import org.json.JSONArray;
|
|
|
|
@SourceDebugExtension({"SMAP\nCommonWebViewBridge.kt\nKotlin\n*S Kotlin\n*F\n+ 1 CommonWebViewBridge.kt\ncom/unity3d/ads/adplayer/CommonWebViewBridge\n+ 2 _Arrays.kt\nkotlin/collections/ArraysKt___ArraysKt\n+ 3 StateFlow.kt\nkotlinx/coroutines/flow/StateFlowKt\n+ 4 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,130:1\n13579#2,2:131\n13579#2,2:138\n230#3,5:133\n230#3,5:141\n1#4:140\n*S KotlinDebug\n*F\n+ 1 CommonWebViewBridge.kt\ncom/unity3d/ads/adplayer/CommonWebViewBridge\n*L\n40#1:131,2\n58#1:138,2\n52#1:133,5\n81#1:141,5\n*E\n"})
|
|
/* loaded from: classes4.dex */
|
|
public final class CommonWebViewBridge implements WebViewBridge {
|
|
private final MutableSharedFlow _onInvocation;
|
|
private final MutableStateFlow callbacks;
|
|
private final SharedFlow onInvocation;
|
|
private final CoroutineScope scope;
|
|
private final WebViewContainer webViewContainer;
|
|
|
|
@Override // com.unity3d.ads.adplayer.WebViewBridge
|
|
public SharedFlow getOnInvocation() {
|
|
return this.onInvocation;
|
|
}
|
|
|
|
public final CoroutineScope getScope() {
|
|
return this.scope;
|
|
}
|
|
|
|
public CommonWebViewBridge(CoroutineDispatcher dispatcher, WebViewContainer webViewContainer, CoroutineScope adPlayerScope) {
|
|
Set emptySet;
|
|
Intrinsics.checkNotNullParameter(dispatcher, "dispatcher");
|
|
Intrinsics.checkNotNullParameter(webViewContainer, "webViewContainer");
|
|
Intrinsics.checkNotNullParameter(adPlayerScope, "adPlayerScope");
|
|
this.webViewContainer = webViewContainer;
|
|
CoroutineScope plus = CoroutineScopeKt.plus(CoroutineScopeKt.plus(adPlayerScope, dispatcher), new CoroutineName("CommonWebViewBridge"));
|
|
this.scope = plus;
|
|
emptySet = SetsKt__SetsKt.emptySet();
|
|
this.callbacks = StateFlowKt.MutableStateFlow(emptySet);
|
|
MutableSharedFlow MutableSharedFlow$default = SharedFlowKt.MutableSharedFlow$default(0, 0, null, 7, null);
|
|
this._onInvocation = MutableSharedFlow$default;
|
|
this.onInvocation = FlowKt.asSharedFlow(MutableSharedFlow$default);
|
|
BuildersKt__Builders_commonKt.launch$default(plus, null, null, new AnonymousClass1(null), 3, null);
|
|
}
|
|
|
|
@DebugMetadata(c = "com.unity3d.ads.adplayer.CommonWebViewBridge$1", f = "CommonWebViewBridge.kt", l = {28}, m = "invokeSuspend")
|
|
/* renamed from: com.unity3d.ads.adplayer.CommonWebViewBridge$1, reason: invalid class name */
|
|
public static final class AnonymousClass1 extends SuspendLambda implements Function2 {
|
|
int label;
|
|
|
|
public AnonymousClass1(Continuation continuation) {
|
|
super(2, continuation);
|
|
}
|
|
|
|
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
|
|
public final Continuation create(Object obj, Continuation continuation) {
|
|
return CommonWebViewBridge.this.new AnonymousClass1(continuation);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function2
|
|
public final Object invoke(CoroutineScope coroutineScope, Continuation continuation) {
|
|
return ((AnonymousClass1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
|
|
}
|
|
|
|
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
|
|
public final Object invokeSuspend(Object obj) {
|
|
Object coroutine_suspended;
|
|
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
|
|
int i = this.label;
|
|
if (i == 0) {
|
|
ResultKt.throwOnFailure(obj);
|
|
WebViewContainer webViewContainer = CommonWebViewBridge.this.webViewContainer;
|
|
CommonWebViewBridge commonWebViewBridge = CommonWebViewBridge.this;
|
|
this.label = 1;
|
|
if (webViewContainer.addJavascriptInterface(commonWebViewBridge, "webviewbridge", this) == coroutine_suspended) {
|
|
return coroutine_suspended;
|
|
}
|
|
} else {
|
|
if (i != 1) {
|
|
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
|
|
}
|
|
ResultKt.throwOnFailure(obj);
|
|
}
|
|
return Unit.INSTANCE;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final Object execute(HandlerType handlerType, String str, Continuation continuation) {
|
|
Object coroutine_suspended;
|
|
Object evaluateJavascript = this.webViewContainer.evaluateJavascript("window.nativebridge." + handlerType.getJsPath() + '(' + str + ");", continuation);
|
|
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
|
|
return evaluateJavascript == coroutine_suspended ? evaluateJavascript : Unit.INSTANCE;
|
|
}
|
|
|
|
@Override // com.unity3d.ads.adplayer.WebViewBridge
|
|
public Object sendEvent(WebViewEvent webViewEvent, Continuation continuation) {
|
|
Object coroutine_suspended;
|
|
JSONArray jSONArray = new JSONArray();
|
|
jSONArray.put(webViewEvent.getCategory());
|
|
jSONArray.put(webViewEvent.getName());
|
|
for (Object obj : webViewEvent.getParameters()) {
|
|
jSONArray.put(obj);
|
|
}
|
|
HandlerType handlerType = HandlerType.EVENT;
|
|
String jSONArray2 = jSONArray.toString();
|
|
Intrinsics.checkNotNullExpressionValue(jSONArray2, "arguments.toString()");
|
|
Object execute = execute(handlerType, jSONArray2, continuation);
|
|
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
|
|
return execute == coroutine_suspended ? execute : Unit.INSTANCE;
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:11:0x009f A[PHI: r14
|
|
0x009f: PHI (r14v4 java.lang.Object) = (r14v3 java.lang.Object), (r14v1 java.lang.Object) binds: [B:17:0x009c, B:10:0x0029] A[DONT_GENERATE, DONT_INLINE], RETURN] */
|
|
/* JADX WARN: Removed duplicated region for block: B:18:0x009e A[RETURN] */
|
|
/* JADX WARN: Removed duplicated region for block: B:19:0x003d */
|
|
/* JADX WARN: Removed duplicated region for block: B:8:0x0025 */
|
|
@Override // com.unity3d.ads.adplayer.WebViewBridge
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public java.lang.Object request(java.lang.String r11, java.lang.String r12, java.lang.Object[] r13, kotlin.coroutines.Continuation r14) {
|
|
/*
|
|
r10 = this;
|
|
boolean r0 = r14 instanceof com.unity3d.ads.adplayer.CommonWebViewBridge$request$1
|
|
if (r0 == 0) goto L13
|
|
r0 = r14
|
|
com.unity3d.ads.adplayer.CommonWebViewBridge$request$1 r0 = (com.unity3d.ads.adplayer.CommonWebViewBridge$request$1) r0
|
|
int r1 = r0.label
|
|
r2 = -2147483648(0xffffffff80000000, float:-0.0)
|
|
r3 = r1 & r2
|
|
if (r3 == 0) goto L13
|
|
int r1 = r1 - r2
|
|
r0.label = r1
|
|
goto L18
|
|
L13:
|
|
com.unity3d.ads.adplayer.CommonWebViewBridge$request$1 r0 = new com.unity3d.ads.adplayer.CommonWebViewBridge$request$1
|
|
r0.<init>(r10, r14)
|
|
L18:
|
|
java.lang.Object r14 = r0.result
|
|
java.lang.Object r1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED()
|
|
int r2 = r0.label
|
|
r3 = 2
|
|
r4 = 0
|
|
r5 = 1
|
|
if (r2 == 0) goto L3d
|
|
if (r2 == r5) goto L35
|
|
if (r2 != r3) goto L2d
|
|
kotlin.ResultKt.throwOnFailure(r14)
|
|
goto L9f
|
|
L2d:
|
|
java.lang.IllegalStateException r11 = new java.lang.IllegalStateException
|
|
java.lang.String r12 = "call to 'resume' before 'invoke' with coroutine"
|
|
r11.<init>(r12)
|
|
throw r11
|
|
L35:
|
|
java.lang.Object r11 = r0.L$0
|
|
kotlinx.coroutines.CompletableDeferred r11 = (kotlinx.coroutines.CompletableDeferred) r11
|
|
kotlin.ResultKt.throwOnFailure(r14)
|
|
goto L94
|
|
L3d:
|
|
kotlin.ResultKt.throwOnFailure(r14)
|
|
kotlinx.coroutines.CompletableDeferred r14 = kotlinx.coroutines.CompletableDeferredKt.CompletableDeferred$default(r4, r5, r4)
|
|
int r2 = r14.hashCode()
|
|
java.lang.String r2 = java.lang.String.valueOf(r2)
|
|
kotlinx.coroutines.flow.MutableStateFlow r6 = r10.callbacks
|
|
L4e:
|
|
java.lang.Object r7 = r6.getValue()
|
|
r8 = r7
|
|
java.util.Set r8 = (java.util.Set) r8
|
|
kotlin.Pair r9 = kotlin.TuplesKt.to(r2, r14)
|
|
java.util.Set r8 = kotlin.collections.SetsKt.plus(r8, r9)
|
|
boolean r7 = r6.compareAndSet(r7, r8)
|
|
if (r7 == 0) goto L4e
|
|
org.json.JSONArray r6 = new org.json.JSONArray
|
|
r6.<init>()
|
|
r6.put(r11)
|
|
r6.put(r12)
|
|
r6.put(r2)
|
|
int r11 = r13.length
|
|
r12 = 0
|
|
L73:
|
|
if (r12 >= r11) goto L7d
|
|
r2 = r13[r12]
|
|
r6.put(r2)
|
|
int r12 = r12 + 1
|
|
goto L73
|
|
L7d:
|
|
com.unity3d.ads.adplayer.HandlerType r11 = com.unity3d.ads.adplayer.HandlerType.INVOCATION
|
|
java.lang.String r12 = r6.toString()
|
|
java.lang.String r13 = "arguments.toString()"
|
|
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r12, r13)
|
|
r0.L$0 = r14
|
|
r0.label = r5
|
|
java.lang.Object r11 = r10.execute(r11, r12, r0)
|
|
if (r11 != r1) goto L93
|
|
return r1
|
|
L93:
|
|
r11 = r14
|
|
L94:
|
|
r0.L$0 = r4
|
|
r0.label = r3
|
|
java.lang.Object r14 = r11.await(r0)
|
|
if (r14 != r1) goto L9f
|
|
return r1
|
|
L9f:
|
|
return r14
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.unity3d.ads.adplayer.CommonWebViewBridge.request(java.lang.String, java.lang.String, java.lang.Object[], kotlin.coroutines.Continuation):java.lang.Object");
|
|
}
|
|
|
|
@Override // com.unity3d.ads.adplayer.WebViewBridge
|
|
public void handleCallback(String callbackId, String callbackStatus, String rawParameters) {
|
|
Object obj;
|
|
Object value;
|
|
Set minus;
|
|
Intrinsics.checkNotNullParameter(callbackId, "callbackId");
|
|
Intrinsics.checkNotNullParameter(callbackStatus, "callbackStatus");
|
|
Intrinsics.checkNotNullParameter(rawParameters, "rawParameters");
|
|
Object[] typedArray = JSONArrayExtensionsKt.toTypedArray(new JSONArray(rawParameters));
|
|
Iterator it = ((Iterable) this.callbacks.getValue()).iterator();
|
|
while (true) {
|
|
if (!it.hasNext()) {
|
|
obj = null;
|
|
break;
|
|
} else {
|
|
obj = it.next();
|
|
if (Intrinsics.areEqual((String) ((Pair) obj).component1(), callbackId)) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
Pair pair = (Pair) obj;
|
|
if (pair == null) {
|
|
return;
|
|
}
|
|
CompletableDeferred completableDeferred = (CompletableDeferred) pair.component2();
|
|
if (Intrinsics.areEqual(callbackStatus, "success")) {
|
|
completableDeferred.complete(typedArray);
|
|
} else if (Intrinsics.areEqual(callbackStatus, "error")) {
|
|
Object obj2 = typedArray[0];
|
|
Intrinsics.checkNotNull(obj2, "null cannot be cast to non-null type kotlin.String");
|
|
completableDeferred.completeExceptionally(new Exception((String) obj2));
|
|
}
|
|
MutableStateFlow mutableStateFlow = this.callbacks;
|
|
do {
|
|
value = mutableStateFlow.getValue();
|
|
minus = SetsKt___SetsKt.minus((Set) value, pair);
|
|
} while (!mutableStateFlow.compareAndSet(value, minus));
|
|
}
|
|
|
|
@Override // com.unity3d.ads.adplayer.WebViewBridge
|
|
public void handleInvocation(String message) {
|
|
Intrinsics.checkNotNullParameter(message, "message");
|
|
JSONArray jSONArray = new JSONArray(message);
|
|
int length = jSONArray.length();
|
|
for (int i = 0; i < length; i++) {
|
|
Object obj = jSONArray.get(i);
|
|
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type org.json.JSONArray");
|
|
JSONArray jSONArray2 = (JSONArray) obj;
|
|
Object obj2 = jSONArray2.get(0);
|
|
Intrinsics.checkNotNull(obj2, "null cannot be cast to non-null type kotlin.String");
|
|
String str = (String) obj2;
|
|
Object obj3 = jSONArray2.get(1);
|
|
Intrinsics.checkNotNull(obj3, "null cannot be cast to non-null type kotlin.String");
|
|
String str2 = (String) obj3;
|
|
Object obj4 = jSONArray2.get(2);
|
|
Intrinsics.checkNotNull(obj4, "null cannot be cast to non-null type org.json.JSONArray");
|
|
JSONArray jSONArray3 = (JSONArray) obj4;
|
|
Object obj5 = jSONArray2.get(3);
|
|
Intrinsics.checkNotNull(obj5, "null cannot be cast to non-null type kotlin.String");
|
|
String str3 = (String) obj5;
|
|
DeviceLog.debug("Unity Ads WebView calling for: " + str + '.' + str2 + '(' + jSONArray3 + ')');
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(str);
|
|
sb.append('.');
|
|
sb.append(str2);
|
|
BuildersKt__Builders_commonKt.launch$default(this.scope, null, null, new CommonWebViewBridge$handleInvocation$1(sb.toString(), jSONArray3, this, str3, null), 3, null);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final Object respond(String str, String str2, Object[] objArr, Continuation continuation) {
|
|
Object coroutine_suspended;
|
|
JSONArray jSONArray = new JSONArray();
|
|
jSONArray.put(str);
|
|
jSONArray.put(str2);
|
|
jSONArray.put(new JSONArray(objArr));
|
|
HandlerType handlerType = HandlerType.CALLBACK;
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append('[');
|
|
sb.append(jSONArray);
|
|
sb.append(']');
|
|
Object execute = execute(handlerType, sb.toString(), continuation);
|
|
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
|
|
return execute == coroutine_suspended ? execute : Unit.INSTANCE;
|
|
}
|
|
}
|