导航菜单

页面标题

页面副标题

Rilo v2.0.21 - DeviceTestingActivity.java 源代码

正在查看: Rilo v2.0.21 应用的 DeviceTestingActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package app.callpe.ui.misc;

import android.app.Application;
import android.content.Context;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
import app.callpe.common.utils.ZEGOSDKConstants;
import app.callpe.databinding.ActivityDeviceTestingBinding;
import app.callpe.rtc.RtcManagerFactory;
import app.callpe.rtc.components.LocalRtcVideoView;
import app.callpe.ui.login.LoginActivity;
import app.module.common.interfaces.SDKInitialise;
import app.module.common.model.rtc.RtcRoomDetails;
import app.module.common.rtcmanager.RtcManager;
import app.module.common.rtcmanager.handlers.RtcEventHandler;
import com.facebook.internal.NativeProtocol;
import com.permissionx.guolindev.PermissionX;
import com.permissionx.guolindev.callback.ExplainReasonCallback;
import com.permissionx.guolindev.callback.ForwardToSettingsCallback;
import com.permissionx.guolindev.callback.RequestCallback;
import com.permissionx.guolindev.request.ExplainScope;
import com.permissionx.guolindev.request.ForwardScope;
import com.zegocloud.zegosdk.ZegoSdkManager;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;

@Metadata(d1 = {"\u0000H\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010 \n\u0000\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u000e\u001a\u00020\u000fH\u0002J\b\u0010\u0010\u001a\u00020\u000fH\u0002J\u0012\u0010\u0011\u001a\u00020\u000f2\b\u0010\u0012\u001a\u0004\u0018\u00010\u0013H\u0014J\b\u0010\u0014\u001a\u00020\u000fH\u0014J\b\u0010\u0015\u001a\u00020\u000fH\u0014J\b\u0010\u0016\u001a\u00020\u000fH\u0014J \u0010\u0017\u001a\u00020\u000f2\f\u0010\u0018\u001a\b\u0012\u0004\u0012\u00020\b0\u00192\b\u0010\u001a\u001a\u0004\u0018\u00010\u001bH\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082.¢\u0006\u0002\n\u0000R\u0010\u0010\u0005\u001a\u0004\u0018\u00010\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\n\u001a\u0004\u0018\u00010\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\f\u001a\u0004\u0018\u00010\rX\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u001c"}, d2 = {"Lapp/callpe/ui/misc/DeviceTestingActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "()V", "binding", "Lapp/callpe/databinding/ActivityDeviceTestingBinding;", "mLocalPreview", "Lapp/callpe/rtc/components/LocalRtcVideoView;", "mRoomId", "", "mToken", "rtcEventHandler", "Lapp/module/common/rtcmanager/handlers/RtcEventHandler;", "rtcManager", "Lapp/module/common/rtcmanager/RtcManager;", "initRtcSDK", "", "listenRtcEventHandler", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "onPause", "onResume", "requestPermissionIfNeeded", NativeProtocol.RESULT_ARGS_PERMISSIONS, "", "requestCallback", "Lcom/permissionx/guolindev/callback/RequestCallback;", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class DeviceTestingActivity extends AppCompatActivity {
    private ActivityDeviceTestingBinding binding;
    private LocalRtcVideoView mLocalPreview;
    private RtcEventHandler rtcEventHandler;
    private RtcManager rtcManager;
    private String mToken = "";
    private String mRoomId = "";

    public static final void initRtcSDK$lambda$3() {
    }

    protected void onCreate(android.os.Bundle r5) {
        throw new UnsupportedOperationException("Method not decompiled: app.callpe.ui.misc.DeviceTestingActivity.onCreate(android.os.Bundle):void");
    }

    public static final void onCreate$lambda$1(DeviceTestingActivity deviceTestingActivity, String str, boolean z, List list, List list2) {
        RtcManager rtcManager;
        Intrinsics.checkNotNullParameter(deviceTestingActivity, "this$0");
        Intrinsics.checkNotNullParameter(list, "<anonymous parameter 1>");
        Intrinsics.checkNotNullParameter(list2, "<anonymous parameter 2>");
        RtcManager rtcManager2 = deviceTestingActivity.rtcManager;
        if (rtcManager2 != null) {
            rtcManager2.enableCamera(true);
        }
        String str2 = "streamer_name_" + str;
        if (LoginActivity.INSTANCE.isVitok() && (rtcManager = deviceTestingActivity.rtcManager) != null) {
            ActivityDeviceTestingBinding activityDeviceTestingBinding = deviceTestingActivity.binding;
            ActivityDeviceTestingBinding activityDeviceTestingBinding2 = null;
            if (activityDeviceTestingBinding == null) {
                Intrinsics.throwUninitializedPropertyAccessException("binding");
                activityDeviceTestingBinding = null;
            }
            View view = (View) activityDeviceTestingBinding.faceUnityView;
            ActivityDeviceTestingBinding activityDeviceTestingBinding3 = deviceTestingActivity.binding;
            if (activityDeviceTestingBinding3 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("binding");
            } else {
                activityDeviceTestingBinding2 = activityDeviceTestingBinding3;
            }
            rtcManager.initBeautyService(view, activityDeviceTestingBinding2.previewLayout.getGlSurfaceView());
        }
        RtcRoomDetails rtcRoomDetails = new RtcRoomDetails(deviceTestingActivity.mRoomId, deviceTestingActivity.mToken, str.toString(), str2, false, 0L, 48, null);
        RtcManager rtcManager3 = deviceTestingActivity.rtcManager;
        if (rtcManager3 != null) {
            rtcManager3.joinRtcRoom(rtcRoomDetails);
        }
    }

    public static final void onCreate$lambda$2(DeviceTestingActivity deviceTestingActivity, View view) {
        Intrinsics.checkNotNullParameter(deviceTestingActivity, "this$0");
        deviceTestingActivity.finish();
    }

    private final void listenRtcEventHandler() {
        this.rtcEventHandler = new DeviceTestingActivity$listenRtcEventHandler$1(this);
    }

    private final void initRtcSDK() {
        RtcManager createManager$default;
        if (RtcManagerFactory.getCurrentRtcInstance() != null && (RtcManagerFactory.getCurrentRtcInstance() instanceof ZegoSdkManager)) {
            createManager$default = RtcManagerFactory.getCurrentRtcInstance();
        } else {
            createManager$default = RtcManagerFactory.createManager$default(null, "ZEGO", 1, null);
        }
        this.rtcManager = createManager$default;
        if (createManager$default != null) {
            createManager$default.setEventHandler(this.rtcEventHandler);
        }
        RtcManager rtcManager = this.rtcManager;
        if (rtcManager != null) {
            Application application = getApplication();
            Intrinsics.checkNotNullExpressionValue(application, "application");
            long j = ZEGOSDKConstants.appID;
            String str = ZEGOSDKConstants.appSign;
            Intrinsics.checkNotNullExpressionValue(str, "appSign");
            rtcManager.initSDK(application, j, str, "app.ri1l0", new SDKInitialise() {
                @Override
                public final void initialised() {
                    DeviceTestingActivity.initRtcSDK$lambda$3();
                }
            });
        }
    }

    private final void requestPermissionIfNeeded(final List<String> permissions, final RequestCallback requestCallback) {
        Iterator<String> it = permissions.iterator();
        boolean z = true;
        while (it.hasNext()) {
            if (ContextCompat.checkSelfPermission((Context) this, it.next()) != 0) {
                z = false;
            }
        }
        if (!z) {
            PermissionX.init((FragmentActivity) this).permissions(permissions).onExplainRequestReason(new ExplainReasonCallback() {
                public final void onExplainReason(ExplainScope explainScope, List list) {
                    DeviceTestingActivity.requestPermissionIfNeeded$lambda$4(permissions, this, explainScope, list);
                }
            }).onForwardToSettings(new ForwardToSettingsCallback() {
                public final void onForwardToSettings(ForwardScope forwardScope, List list) {
                    DeviceTestingActivity.requestPermissionIfNeeded$lambda$5(permissions, this, forwardScope, list);
                }
            }).request(new RequestCallback() {
                public final void onResult(boolean z2, List list, List list2) {
                    DeviceTestingActivity.requestPermissionIfNeeded$lambda$6(requestCallback, z2, list, list2);
                }
            });
        } else if (requestCallback != null) {
            requestCallback.onResult(true, permissions, new ArrayList());
        }
    }

    public static final void requestPermissionIfNeeded$lambda$4(List list, DeviceTestingActivity deviceTestingActivity, ExplainScope explainScope, List list2) {
        String string;
        Intrinsics.checkNotNullParameter(list, "$permissions");
        Intrinsics.checkNotNullParameter(deviceTestingActivity, "this$0");
        Intrinsics.checkNotNullParameter(explainScope, "scope");
        Intrinsics.checkNotNullParameter(list2, "deniedList");
        if (list.size() == 1) {
            if (list2.contains("android.permission.CAMERA")) {
                string = deviceTestingActivity.getString(2131952423);
                Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callp…ermission_explain_camera)");
            } else {
                if (list2.contains("android.permission.RECORD_AUDIO")) {
                    string = deviceTestingActivity.getString(2131952425);
                    Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callp…g.permission_explain_mic)");
                }
                string = "";
            }
        } else if (list2.size() == 1) {
            if (list2.contains("android.permission.CAMERA")) {
                string = deviceTestingActivity.getString(2131952423);
                Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callp…ermission_explain_camera)");
            } else {
                if (list2.contains("android.permission.RECORD_AUDIO")) {
                    string = deviceTestingActivity.getString(2131952425);
                    Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callp…g.permission_explain_mic)");
                }
                string = "";
            }
        } else {
            string = deviceTestingActivity.getString(2131952424);
            Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callp…ssion_explain_camera_mic)");
        }
        String string2 = deviceTestingActivity.getString(2131952377);
        Intrinsics.checkNotNullExpressionValue(string2, "getString(app.callpe.R.string.ok)");
        ExplainScope.showRequestReasonDialog$default(explainScope, list2, string, string2, (String) null, 8, (Object) null);
    }

    public static final void requestPermissionIfNeeded$lambda$5(List list, DeviceTestingActivity deviceTestingActivity, ForwardScope forwardScope, List list2) {
        String string;
        Intrinsics.checkNotNullParameter(list, "$permissions");
        Intrinsics.checkNotNullParameter(deviceTestingActivity, "this$0");
        Intrinsics.checkNotNullParameter(forwardScope, "scope");
        Intrinsics.checkNotNullParameter(list2, "deniedList");
        if (list.size() == 1) {
            if (list2.contains("android.permission.CAMERA")) {
                string = deviceTestingActivity.getString(2131952580);
                Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callp…R.string.settings_camera)");
            } else {
                if (list2.contains("android.permission.RECORD_AUDIO")) {
                    string = deviceTestingActivity.getString(2131952582);
                    Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callpe.R.string.settings_mic)");
                }
                string = "";
            }
        } else if (list2.size() == 1) {
            if (list2.contains("android.permission.CAMERA")) {
                string = deviceTestingActivity.getString(2131952580);
                Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callp…R.string.settings_camera)");
            } else {
                if (list2.contains("android.permission.RECORD_AUDIO")) {
                    string = deviceTestingActivity.getString(2131952582);
                    Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callpe.R.string.settings_mic)");
                }
                string = "";
            }
        } else {
            string = deviceTestingActivity.getString(2131952581);
            Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callp…ring.settings_camera_mic)");
        }
        String string2 = deviceTestingActivity.getString(2131952579);
        Intrinsics.checkNotNullExpressionValue(string2, "getString(app.callpe.R.string.settings)");
        ForwardScope.showForwardToSettingsDialog$default(forwardScope, list2, string, string2, (String) null, 8, (Object) null);
    }

    public static final void requestPermissionIfNeeded$lambda$6(RequestCallback requestCallback, boolean z, List list, List list2) {
        Intrinsics.checkNotNullParameter(list, "grantedList");
        Intrinsics.checkNotNullParameter(list2, "deniedList");
        if (requestCallback != null) {
            requestCallback.onResult(z, list, list2);
        }
    }

    protected void onDestroy() {
        super.onDestroy();
        RtcManager rtcManager = this.rtcManager;
        if (rtcManager != null) {
            rtcManager.disconnectUser(true);
        }
        ActivityDeviceTestingBinding activityDeviceTestingBinding = this.binding;
        if (activityDeviceTestingBinding == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            activityDeviceTestingBinding = null;
        }
        activityDeviceTestingBinding.previewLayout.onDestroy();
        RtcManager rtcManager2 = this.rtcManager;
        if (rtcManager2 != null) {
            rtcManager2.stopLocalPreview();
        }
        RtcManager rtcManager3 = this.rtcManager;
        if (rtcManager3 != null) {
            rtcManager3.leaveRtcRoom(null);
        }
        RtcManager rtcManager4 = this.rtcManager;
        if (rtcManager4 != null) {
            rtcManager4.setEventHandler(null);
        }
    }

    protected void onPause() {
        super.onPause();
        RtcManager rtcManager = this.rtcManager;
        if (rtcManager != null) {
            rtcManager.onPause();
        }
    }

    protected void onResume() {
        super.onResume();
        RtcManager rtcManager = this.rtcManager;
        if (rtcManager != null) {
            rtcManager.onResume();
        }
    }
}