正在查看: RummyCircle v11000.89 应用的 WebviewPermissionHandler.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: RummyCircle v11000.89 应用的 WebviewPermissionHandler.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.games24x7.dynamicrc.unitymodule.webview.handler;
import android.app.Activity;
import com.games24x7.coregame.KrakenApplication;
import com.games24x7.coregame.common.communication.nativecomm.ComplexLayerCommInterface;
import com.games24x7.coregame.common.communication.nativecomm.unity.webview.WebviewOperation;
import com.games24x7.coregame.common.deeplink.util.NativeUtil;
import com.games24x7.coregame.common.utility.general.RouterUtility;
import com.games24x7.coregame.common.utility.log.Logger;
import com.games24x7.dynamicrc.unitymodule.comm.unitycomm.NativeUnityCommController;
import com.games24x7.dynamicrc.unitymodule.webview.base.BaseWebviewHandler;
import com.games24x7.dynamicrc.unitymodule.webview.base.BaseWebviewUtility;
import com.games24x7.pgeventbus.event.EventInfo;
import com.games24x7.pgeventbus.event.PGEvent;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;
@Metadata
public final class WebviewPermissionHandler implements BaseWebviewHandler {
@NotNull
private final String TAG;
private final ComplexLayerCommInterface eventCommInterface;
private final WebviewOperation webViewOperationHandler;
@NotNull
private final String webviewId;
@Metadata
public static final class ACRReactJsPermissionResponse {
private final int originId;
private final int permission;
private boolean success;
public ACRReactJsPermissionResponse(boolean z, int i, int i2) {
this.success = z;
this.permission = i;
this.originId = i2;
}
public static ACRReactJsPermissionResponse copy$default(ACRReactJsPermissionResponse aCRReactJsPermissionResponse, boolean z, int i, int i2, int i3, Object obj) {
if ((i3 & 1) != 0) {
z = aCRReactJsPermissionResponse.success;
}
if ((i3 & 2) != 0) {
i = aCRReactJsPermissionResponse.permission;
}
if ((i3 & 4) != 0) {
i2 = aCRReactJsPermissionResponse.originId;
}
return aCRReactJsPermissionResponse.copy(z, i, i2);
}
public final boolean component1() {
return this.success;
}
public final int component2() {
return this.permission;
}
public final int component3() {
return this.originId;
}
@NotNull
public final ACRReactJsPermissionResponse copy(boolean z, int i, int i2) {
return new ACRReactJsPermissionResponse(z, i, i2);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof ACRReactJsPermissionResponse)) {
return false;
}
ACRReactJsPermissionResponse aCRReactJsPermissionResponse = (ACRReactJsPermissionResponse) obj;
return this.success == aCRReactJsPermissionResponse.success && this.permission == aCRReactJsPermissionResponse.permission && this.originId == aCRReactJsPermissionResponse.originId;
}
public final int getOriginId() {
return this.originId;
}
public final int getPermission() {
return this.permission;
}
public final boolean getSuccess() {
return this.success;
}
public int hashCode() {
boolean z = this.success;
?? r0 = z;
if (z) {
r0 = 1;
}
return (((r0 * 31) + Integer.hashCode(this.permission)) * 31) + Integer.hashCode(this.originId);
}
public final void setSuccess(boolean z) {
this.success = z;
}
@NotNull
public String toString() {
return "ACRReactJsPermissionResponse(success=" + this.success + ", permission=" + this.permission + ", originId=" + this.originId + ")";
}
}
public WebviewPermissionHandler(@NotNull String str) {
Intrinsics.checkNotNullParameter(str, "webviewId");
this.webviewId = str;
this.TAG = "WebviewPermissionHandle";
BaseWebviewUtility.Companion companion = BaseWebviewUtility.Companion;
BaseWebviewUtility baseWebviewUtility = companion.getUtilityWebviewIdMap().get(str);
this.eventCommInterface = baseWebviewUtility != null ? baseWebviewUtility.getEventCommInterface() : null;
BaseWebviewUtility baseWebviewUtility2 = companion.getUtilityWebviewIdMap().get(str);
this.webViewOperationHandler = baseWebviewUtility2 != null ? baseWebviewUtility2.getWebViewOperationHandler() : null;
}
private final void handleWebviewPermissionResult(PGEvent pGEvent, String str) {
final String optString = new JSONObject(pGEvent.getEventData().getMetaData()).optString("source");
int optInt = new JSONObject(pGEvent.getEventData().getMetaData()).optInt("originId");
int optInt2 = new JSONObject(pGEvent.getEventData().getMetaData()).optInt("permissionType");
if (Intrinsics.a(str, "GRANTED")) {
if (Intrinsics.a(optString, "kyc_flow")) {
BaseWebviewUtility.Companion.sendLegoEventToWebview(102, new ACRReactJsPermissionResponse(true, optInt2, optInt), this.webViewOperationHandler);
return;
}
Activity webviewActivity = KrakenApplication.Companion.getWebviewActivity();
if (webviewActivity != null) {
webviewActivity.runOnUiThread(new Runnable() {
@Override
public final void run() {
WebviewPermissionHandler.handleWebviewPermissionResult$lambda$0(WebviewPermissionHandler.this, optString);
}
});
return;
}
return;
}
if (Intrinsics.a(str, "HARD_DENIED")) {
if (Intrinsics.a(optString, "kyc_flow")) {
BaseWebviewUtility.Companion.sendLegoEventToWebview(102, new ACRReactJsPermissionResponse(false, optInt2, optInt), this.webViewOperationHandler);
return;
}
Activity webviewActivity2 = KrakenApplication.Companion.getWebviewActivity();
if (webviewActivity2 != null) {
webviewActivity2.runOnUiThread(new Runnable() {
@Override
public final void run() {
WebviewPermissionHandler.handleWebviewPermissionResult$lambda$1(WebviewPermissionHandler.this, optString);
}
});
}
}
}
public static final void handleWebviewPermissionResult$lambda$0(WebviewPermissionHandler webviewPermissionHandler, String str) {
Intrinsics.checkNotNullParameter(webviewPermissionHandler, "this$0");
JSONObject jSONObject = new JSONObject();
jSONObject.put("success", true);
WebviewOperation webviewOperation = webviewPermissionHandler.webViewOperationHandler;
if (webviewOperation != null) {
webviewOperation.loadUrlIntoWebview("javascript:WebviewNativeUtils.androidCallback(" + str + ", null, JSON.stringify(" + jSONObject + "));");
}
}
public static final void handleWebviewPermissionResult$lambda$1(WebviewPermissionHandler webviewPermissionHandler, String str) {
Intrinsics.checkNotNullParameter(webviewPermissionHandler, "this$0");
JSONObject jSONObject = new JSONObject();
jSONObject.put("success", false);
WebviewOperation webviewOperation = webviewPermissionHandler.webViewOperationHandler;
if (webviewOperation != null) {
webviewOperation.loadUrlIntoWebview("javascript:WebviewNativeUtils.androidCallback(" + str + ", null, JSON.stringify(" + jSONObject + "));");
}
}
private final void startPermissionRequestFlow(String str) {
JSONObject jSONObject = new JSONObject(str);
JSONObject jSONObject2 = new JSONObject(jSONObject.optString("data"));
String optString = jSONObject.optString("source");
NativeUtil nativeUtil = NativeUtil.INSTANCE;
String obj = nativeUtil.assignPermissionTypeFromItsOrdinal(jSONObject2.optInt("permission")).toString();
int show = nativeUtil.assignRCOriginIdFromItsOrdinal(jSONObject2.optInt("originId")).show();
Logger.e$default(Logger.INSTANCE, this.TAG, "createCheckPermissionEvent :: Permission Name is :: " + obj + " And Origin Id is :: " + show, false, 4, (Object) null);
ComplexLayerCommInterface complexLayerCommInterface = this.eventCommInterface;
if (complexLayerCommInterface != null) {
EventInfo eventInfo = new EventInfo("checkPermission", NativeUnityCommController.TYPE, (String) null, (String) null, 12, (DefaultConstructorMarker) null);
JSONObject jSONObject3 = new JSONObject();
jSONObject3.put("permissionName", obj);
jSONObject3.put("originId", show);
Unit unit = Unit.a;
String jSONObject4 = jSONObject3.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject4, "JSONObject().apply {\n … }.toString()");
JSONObject jSONObject5 = new JSONObject();
jSONObject5.put("webViewId", this.webviewId);
jSONObject5.put("source", optString);
jSONObject5.put("permissionType", jSONObject2.optInt("permission"));
jSONObject5.put("originId", show);
ComplexLayerCommInterface.DefaultImpls.onRouterResponse$default(complexLayerCommInterface, new PGEvent(eventInfo, jSONObject4, new EventInfo("UNITY_FULLSCREEN_CHECK_PERMISSION", NativeUnityCommController.TYPE, jSONObject5.toString(), (String) null, 8, (DefaultConstructorMarker) null)), false, false, 6, (Object) null);
}
}
@Override
public boolean canHandleAction(@NotNull String str) {
Intrinsics.checkNotNullParameter(str, "action");
return Intrinsics.a(str, "START_REQUEST_PERMISSION_FLOW");
}
@Override
public boolean canHandleMid(int i) {
return i == 101;
}
@Override
public void handleMidProcessing(int i, @NotNull String str) {
Intrinsics.checkNotNullParameter(str, "data");
if (i == 101) {
JSONObject jSONObject = new JSONObject();
jSONObject.put("data", str);
jSONObject.put("source", "kyc_flow");
String jSONObject2 = jSONObject.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject2, "JSONObject().apply {\n … }.toString()");
startPermissionRequestFlow(jSONObject2);
}
}
public final void handleResponseFromNative(@NotNull PGEvent pGEvent) {
Intrinsics.checkNotNullParameter(pGEvent, "pgEvent");
Logger logger = Logger.INSTANCE;
Logger.e$default(logger, this.TAG, "handleResponseFromNative :: Got Response from Native :: PgEvent is " + pGEvent, false, 4, (Object) null);
if (Intrinsics.a(pGEvent.getEventData().getName(), "UNITY_FULLSCREEN_CHECK_PERMISSION")) {
if (RouterUtility.INSTANCE.checkPgEventResponse(pGEvent.getPayloadInfo())) {
Logger.e$default(logger, this.TAG, "onResponseFromNative :: UNITY_FULLSCREEN_CHECK_PERMISSION :: Permission Event is Granted...", false, 4, (Object) null);
handleWebviewPermissionResult(pGEvent, "GRANTED");
} else {
Logger.e$default(logger, this.TAG, "onResponseFromNative :: UNITY_FULLSCREEN_CHECK_PERMISSION :: Permission Event is Hard Denied...", false, 4, (Object) null);
handleWebviewPermissionResult(pGEvent, "HARD_DENIED");
}
}
}
@Override
public void processAction(@NotNull String str, @NotNull String str2) {
Intrinsics.checkNotNullParameter(str, "action");
Intrinsics.checkNotNullParameter(str2, "payload");
if (Intrinsics.a(str, "START_REQUEST_PERMISSION_FLOW")) {
startPermissionRequestFlow(str2);
}
}
}