导航菜单

页面标题

页面副标题

Housing v14.7.8 - MoEDebuggerActivity.java 源代码

正在查看: Housing v14.7.8 应用的 MoEDebuggerActivity.java JAVA 源代码文件

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


package com.moengage.sdk.debugger;

import android.content.Context;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.i;
import androidx.appcompat.widget.AppCompatButton;
import androidx.lifecycle.b0;
import androidx.lifecycle.x;
import androidx.lifecycle.y0;
import com.moengage.core.internal.logger.Logger;
import com.moengage.core.internal.logger.LoggerConstantsKt;
import com.moengage.core.internal.model.SdkInstance;
import com.moengage.core.internal.model.logging.DebuggerLogConfig;
import com.moengage.core.internal.utils.CoreUtils;
import com.moengage.core.internal.utils.TimeUtilsKt;
import com.moengage.sdk.debugger.internal.ConstantsKt;
import com.moengage.sdk.debugger.internal.UtilsKt;
import com.moengage.sdk.debugger.internal.model.DebuggerInfo;
import com.moengage.sdk.debugger.internal.model.DebuggerStatus;
import com.moengage.sdk.debugger.internal.model.MessageType;
import com.moengage.sdk.debugger.internal.viewmodel.DebuggerViewModel;
import com.moengage.sdk.debugger.internal.viewmodel.DebuggerViewModelFactory;
import com.newrelic.agent.android.api.v2.TraceFieldInterface;
import com.newrelic.agent.android.background.ApplicationStateMonitor;
import com.newrelic.agent.android.instrumentation.Instrumented;
import com.newrelic.agent.android.tracing.Trace;
import com.newrelic.agent.android.tracing.TraceMachine;
import java.util.HashMap;
import java.util.TimeZone;
import kotlin.Metadata;
import kotlin.jvm.internal.n0;
import kotlin.jvm.internal.r;
import kq.l;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@Metadata(d1 = {"\u0000\u0080\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0002\u0010\u0003J\u000f\u0010\u0005\u001a\u00020\u0004H\u0002¢\u0006\u0004\b\u0005\u0010\u0003J\u000f\u0010\u0006\u001a\u00020\u0004H\u0002¢\u0006\u0004\b\u0006\u0010\u0003J\u000f\u0010\u0007\u001a\u00020\u0004H\u0002¢\u0006\u0004\b\u0007\u0010\u0003J\u0017\u0010\n\u001a\u00020\u00042\u0006\u0010\t\u001a\u00020\bH\u0002¢\u0006\u0004\b\n\u0010\u000bJ\u001f\u0010\u0010\u001a\u00020\u00042\u0006\u0010\r\u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\u000eH\u0002¢\u0006\u0004\b\u0010\u0010\u0011J\u0019\u0010\u0014\u001a\u00020\u00042\b\u0010\u0013\u001a\u0004\u0018\u00010\u0012H\u0014¢\u0006\u0004\b\u0014\u0010\u0015J\u0017\u0010\u0019\u001a\u00020\u00182\u0006\u0010\u0017\u001a\u00020\u0016H\u0016¢\u0006\u0004\b\u0019\u0010\u001aJ\u0017\u0010\u001d\u001a\u00020\u00182\u0006\u0010\u001c\u001a\u00020\u001bH\u0016¢\u0006\u0004\b\u001d\u0010\u001eR\u0014\u0010\u001f\u001a\u00020\f8\u0002X\u0082D¢\u0006\u0006\n\u0004\b\u001f\u0010 R\u0016\u0010\"\u001a\u00020!8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b\"\u0010#R\u0016\u0010%\u001a\u00020$8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b%\u0010&R\u0016\u0010(\u001a\u00020'8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b(\u0010)R\u0016\u0010*\u001a\u00020$8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b*\u0010&R\u0016\u0010+\u001a\u00020$8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b+\u0010&R\u0016\u0010,\u001a\u00020$8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b,\u0010&R\u0016\u0010.\u001a\u00020-8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b.\u0010/R\u0016\u00100\u001a\u00020-8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b0\u0010/R\u0016\u00101\u001a\u00020-8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b1\u0010/R\u0016\u00102\u001a\u00020$8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b2\u0010&R\u0016\u00103\u001a\u00020$8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b3\u0010&R\u0016\u00104\u001a\u00020$8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b4\u0010&R\u0016\u00105\u001a\u00020$8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b5\u0010&R\u0016\u00107\u001a\u0002068\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b7\u00108R\u0016\u0010:\u001a\u0002098\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b:\u0010;R\u0016\u0010=\u001a\u00020<8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b=\u0010>¨\u0006?"}, d2 = {"Lcom/moengage/sdk/debugger/MoEDebuggerActivity;", "Landroidx/appcompat/app/i;", "<init>", "()V", "Lzp/j0;", "initUIElements", "initViewModel", "initStaticViewData", "Lcom/moengage/sdk/debugger/internal/model/DebuggerStatus;", "debuggerStatus", "updateUIElementsVisibility", "(Lcom/moengage/sdk/debugger/internal/model/DebuggerStatus;)V", "", "message", "Lcom/moengage/sdk/debugger/internal/model/MessageType;", "messageType", "showMessage", "(Ljava/lang/String;Lcom/moengage/sdk/debugger/internal/model/MessageType;)V", "Landroid/os/Bundle;", "savedInstanceState", "onCreate", "(Landroid/os/Bundle;)V", "Landroid/view/Menu;", "menu", "", "onCreateOptionsMenu", "(Landroid/view/Menu;)Z", "Landroid/view/MenuItem;", "item", "onOptionsItemSelected", "(Landroid/view/MenuItem;)Z", "tag", "Ljava/lang/String;", "Landroid/widget/ProgressBar;", "progressBarView", "Landroid/widget/ProgressBar;", "Landroid/widget/TextView;", "errorMessageView", "Landroid/widget/TextView;", "Landroid/widget/LinearLayout;", "infoSectionView", "Landroid/widget/LinearLayout;", "logLevelView", "startTimeView", "endTimeView", "Landroidx/appcompat/widget/AppCompatButton;", "extendDebuggerTimeView", "Landroidx/appcompat/widget/AppCompatButton;", "stopDebuggerView", "startDebuggerView", "workspaceIdView", "environmentView", "deviceIdView", "uniqueIdView", "", ConstantsKt.BUNDLE_EXTRA_LOG_LEVEL, "I", "Lcom/moengage/core/internal/model/SdkInstance;", "sdkInstance", "Lcom/moengage/core/internal/model/SdkInstance;", "Lcom/moengage/sdk/debugger/internal/viewmodel/DebuggerViewModel;", "viewModel", "Lcom/moengage/sdk/debugger/internal/viewmodel/DebuggerViewModel;", "sdk-debugger_defaultRelease"}, k = 1, mv = {1, 9, 0}, xi = 48)
@Instrumented
public final class MoEDebuggerActivity extends i implements TraceFieldInterface {
    public Trace _nr_trace;
    private TextView deviceIdView;
    private TextView endTimeView;
    private TextView environmentView;
    private TextView errorMessageView;
    private AppCompatButton extendDebuggerTimeView;
    private LinearLayout infoSectionView;
    private TextView logLevelView;
    private ProgressBar progressBarView;
    private SdkInstance sdkInstance;
    private AppCompatButton startDebuggerView;
    private TextView startTimeView;
    private AppCompatButton stopDebuggerView;
    private TextView uniqueIdView;
    private DebuggerViewModel viewModel;
    private TextView workspaceIdView;

    @NotNull
    private final String tag = "SDKDebugger_1.2.0_MoEDebuggerActivity";
    private int logLevel = 5;

    @Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
    public class WhenMappings {
        public static final int[] $EnumSwitchMapping$0;
        public static final int[] $EnumSwitchMapping$1;

        static {
            int[] iArr = new int[DebuggerStatus.values().length];
            try {
                iArr[DebuggerStatus.LOADING.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                iArr[DebuggerStatus.ERROR.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            $EnumSwitchMapping$0 = iArr;
            int[] iArr2 = new int[MessageType.values().length];
            try {
                iArr2[MessageType.TOAST.ordinal()] = 1;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                iArr2[MessageType.EMBEDDED.ordinal()] = 2;
            } catch (NoSuchFieldError unused4) {
            }
            $EnumSwitchMapping$1 = iArr2;
        }
    }

    public static final String access$getTag$p(MoEDebuggerActivity moEDebuggerActivity) {
        return moEDebuggerActivity.tag;
    }

    private final void initStaticViewData() {
        SdkInstance sdkInstance = this.sdkInstance;
        if (sdkInstance == null) {
            r.o("sdkInstance");
            throw null;
        }
        Logger.log$default(sdkInstance.logger, 0, null, null, new MoEDebuggerActivity$initStaticViewData$1(this), 7, null);
        TextView textView = this.workspaceIdView;
        if (textView == null) {
            r.o("workspaceIdView");
            throw null;
        }
        SdkInstance sdkInstance2 = this.sdkInstance;
        if (sdkInstance2 == null) {
            r.o("sdkInstance");
            throw null;
        }
        textView.setText(sdkInstance2.getInstanceMeta().getInstanceId());
        TextView textView2 = this.environmentView;
        if (textView2 == null) {
            r.o("environmentView");
            throw null;
        }
        boolean isDebugBuild = CoreUtils.isDebugBuild(this);
        SdkInstance sdkInstance3 = this.sdkInstance;
        if (sdkInstance3 != null) {
            textView2.setText(UtilsKt.getEnvironmentString(isDebugBuild, sdkInstance3.getInitConfig().getEnvironmentConfig().getEnvironment()));
        } else {
            r.o("sdkInstance");
            throw null;
        }
    }

    private final void initUIElements() {
        Logger.Companion.print$default(Logger.INSTANCE, 0, null, null, new MoEDebuggerActivity$initUIElements$1(this), 7, null);
        setSupportActionBar(findViewById(R.id.toolbar));
        View findViewById = findViewById(R.id.progressIndicatorView);
        r.j(findViewById, "findViewById(...)");
        this.progressBarView = (ProgressBar) findViewById;
        View findViewById2 = findViewById(R.id.errorMessageTextView);
        r.j(findViewById2, "findViewById(...)");
        this.errorMessageView = (TextView) findViewById2;
        View findViewById3 = findViewById(R.id.infoSectionView);
        r.j(findViewById3, "findViewById(...)");
        this.infoSectionView = (LinearLayout) findViewById3;
        View findViewById4 = findViewById(R.id.logLevelTextView);
        r.j(findViewById4, "findViewById(...)");
        this.logLevelView = (TextView) findViewById4;
        View findViewById5 = findViewById(R.id.startTimeTextView);
        r.j(findViewById5, "findViewById(...)");
        this.startTimeView = (TextView) findViewById5;
        View findViewById6 = findViewById(R.id.endTimeTextView);
        r.j(findViewById6, "findViewById(...)");
        this.endTimeView = (TextView) findViewById6;
        AppCompatButton findViewById7 = findViewById(R.id.stopButtonView);
        r.j(findViewById7, "findViewById(...)");
        this.stopDebuggerView = findViewById7;
        AppCompatButton findViewById8 = findViewById(R.id.startButtonView);
        r.j(findViewById8, "findViewById(...)");
        this.startDebuggerView = findViewById8;
        AppCompatButton findViewById9 = findViewById(R.id.extendButtonView);
        r.j(findViewById9, "findViewById(...)");
        this.extendDebuggerTimeView = findViewById9;
        View findViewById10 = findViewById(R.id.workspaceIdTextView);
        r.j(findViewById10, "findViewById(...)");
        this.workspaceIdView = (TextView) findViewById10;
        View findViewById11 = findViewById(R.id.environmentTextView);
        r.j(findViewById11, "findViewById(...)");
        this.environmentView = (TextView) findViewById11;
        View findViewById12 = findViewById(R.id.deviceIdTextView);
        r.j(findViewById12, "findViewById(...)");
        this.deviceIdView = (TextView) findViewById12;
        View findViewById13 = findViewById(R.id.uniqueIdTextView);
        r.j(findViewById13, "findViewById(...)");
        this.uniqueIdView = (TextView) findViewById13;
        AppCompatButton appCompatButton = this.startDebuggerView;
        if (appCompatButton == null) {
            r.o("startDebuggerView");
            throw null;
        }
        final int i = 0;
        appCompatButton.setOnClickListener(new View.OnClickListener(this) {
            public final MoEDebuggerActivity b;

            {
                this.b = this;
            }

            @Override
            public final void onClick(View view) {
                switch (i) {
                    case 0:
                        MoEDebuggerActivity.initUIElements$lambda$1(this.b, view);
                        break;
                    case 1:
                        MoEDebuggerActivity.initUIElements$lambda$2(this.b, view);
                        break;
                    default:
                        MoEDebuggerActivity.initUIElements$lambda$3(this.b, view);
                        break;
                }
            }
        });
        AppCompatButton appCompatButton2 = this.stopDebuggerView;
        if (appCompatButton2 == null) {
            r.o("stopDebuggerView");
            throw null;
        }
        final int i2 = 1;
        appCompatButton2.setOnClickListener(new View.OnClickListener(this) {
            public final MoEDebuggerActivity b;

            {
                this.b = this;
            }

            @Override
            public final void onClick(View view) {
                switch (i2) {
                    case 0:
                        MoEDebuggerActivity.initUIElements$lambda$1(this.b, view);
                        break;
                    case 1:
                        MoEDebuggerActivity.initUIElements$lambda$2(this.b, view);
                        break;
                    default:
                        MoEDebuggerActivity.initUIElements$lambda$3(this.b, view);
                        break;
                }
            }
        });
        AppCompatButton appCompatButton3 = this.extendDebuggerTimeView;
        if (appCompatButton3 == null) {
            r.o("extendDebuggerTimeView");
            throw null;
        }
        final int i3 = 2;
        appCompatButton3.setOnClickListener(new View.OnClickListener(this) {
            public final MoEDebuggerActivity b;

            {
                this.b = this;
            }

            @Override
            public final void onClick(View view) {
                switch (i3) {
                    case 0:
                        MoEDebuggerActivity.initUIElements$lambda$1(this.b, view);
                        break;
                    case 1:
                        MoEDebuggerActivity.initUIElements$lambda$2(this.b, view);
                        break;
                    default:
                        MoEDebuggerActivity.initUIElements$lambda$3(this.b, view);
                        break;
                }
            }
        });
    }

    public static final void initUIElements$lambda$1(MoEDebuggerActivity moEDebuggerActivity, View view) {
        r.k(moEDebuggerActivity, "this$0");
        DebuggerViewModel debuggerViewModel = moEDebuggerActivity.viewModel;
        if (debuggerViewModel == null) {
            r.o("viewModel");
            throw null;
        }
        debuggerViewModel.enableDebuggerLogs(moEDebuggerActivity.logLevel);
        String string = moEDebuggerActivity.getResources().getString(R.string.moe_debugger_enable_log_update_message);
        r.j(string, "getString(...)");
        moEDebuggerActivity.showMessage(string, MessageType.TOAST);
    }

    public static final void initUIElements$lambda$2(MoEDebuggerActivity moEDebuggerActivity, View view) {
        r.k(moEDebuggerActivity, "this$0");
        DebuggerViewModel debuggerViewModel = moEDebuggerActivity.viewModel;
        if (debuggerViewModel == null) {
            r.o("viewModel");
            throw null;
        }
        debuggerViewModel.disableDebuggerLogs();
        String string = moEDebuggerActivity.getResources().getString(R.string.moe_debugger_disable_log_update_message);
        r.j(string, "getString(...)");
        moEDebuggerActivity.showMessage(string, MessageType.TOAST);
    }

    public static final void initUIElements$lambda$3(MoEDebuggerActivity moEDebuggerActivity, View view) {
        r.k(moEDebuggerActivity, "this$0");
        DebuggerViewModel debuggerViewModel = moEDebuggerActivity.viewModel;
        if (debuggerViewModel == null) {
            r.o("viewModel");
            throw null;
        }
        debuggerViewModel.updateDebuggerExpiry(moEDebuggerActivity.logLevel);
        String string = moEDebuggerActivity.getResources().getString(R.string.moe_debugger_timing_update_message);
        r.j(string, "getString(...)");
        moEDebuggerActivity.showMessage(string, MessageType.TOAST);
    }

    private final void initViewModel() {
        SdkInstance sdkInstance = this.sdkInstance;
        if (sdkInstance == null) {
            r.o("sdkInstance");
            throw null;
        }
        Logger.log$default(sdkInstance.logger, 0, null, null, new MoEDebuggerActivity$initViewModel$1(this), 7, null);
        int i = this.logLevel;
        SdkInstance sdkInstance2 = this.sdkInstance;
        if (sdkInstance2 == null) {
            r.o("sdkInstance");
            throw null;
        }
        DebuggerViewModel debuggerViewModel = (DebuggerViewModel) new y0(this, new DebuggerViewModelFactory(i, sdkInstance2, this)).b(n0.b(DebuggerViewModel.class));
        this.viewModel = debuggerViewModel;
        x<DebuggerStatus> debuggerStatus = debuggerViewModel.getDebuggerStatus();
        final MoEDebuggerActivity$initViewModel$2 moEDebuggerActivity$initViewModel$2 = new MoEDebuggerActivity$initViewModel$2(this);
        final int i2 = 0;
        debuggerStatus.i(this, new b0() {
            public final void a(Object obj) {
                switch (i2) {
                    case 0:
                        MoEDebuggerActivity.initViewModel$lambda$4(moEDebuggerActivity$initViewModel$2, obj);
                        break;
                    case 1:
                        MoEDebuggerActivity.initViewModel$lambda$5(moEDebuggerActivity$initViewModel$2, obj);
                        break;
                    case 2:
                        MoEDebuggerActivity.initViewModel$lambda$6(moEDebuggerActivity$initViewModel$2, obj);
                        break;
                    default:
                        MoEDebuggerActivity.initViewModel$lambda$7(moEDebuggerActivity$initViewModel$2, obj);
                        break;
                }
            }
        });
        DebuggerViewModel debuggerViewModel2 = this.viewModel;
        if (debuggerViewModel2 == null) {
            r.o("viewModel");
            throw null;
        }
        x<String> deviceId = debuggerViewModel2.getDeviceId();
        final MoEDebuggerActivity$initViewModel$3 moEDebuggerActivity$initViewModel$3 = new MoEDebuggerActivity$initViewModel$3(this);
        final int i3 = 1;
        deviceId.i(this, new b0() {
            public final void a(Object obj) {
                switch (i3) {
                    case 0:
                        MoEDebuggerActivity.initViewModel$lambda$4(moEDebuggerActivity$initViewModel$3, obj);
                        break;
                    case 1:
                        MoEDebuggerActivity.initViewModel$lambda$5(moEDebuggerActivity$initViewModel$3, obj);
                        break;
                    case 2:
                        MoEDebuggerActivity.initViewModel$lambda$6(moEDebuggerActivity$initViewModel$3, obj);
                        break;
                    default:
                        MoEDebuggerActivity.initViewModel$lambda$7(moEDebuggerActivity$initViewModel$3, obj);
                        break;
                }
            }
        });
        DebuggerViewModel debuggerViewModel3 = this.viewModel;
        if (debuggerViewModel3 == null) {
            r.o("viewModel");
            throw null;
        }
        x<String> uniqueId = debuggerViewModel3.getUniqueId();
        final MoEDebuggerActivity$initViewModel$4 moEDebuggerActivity$initViewModel$4 = new MoEDebuggerActivity$initViewModel$4(this);
        final int i4 = 2;
        uniqueId.i(this, new b0() {
            public final void a(Object obj) {
                switch (i4) {
                    case 0:
                        MoEDebuggerActivity.initViewModel$lambda$4(moEDebuggerActivity$initViewModel$4, obj);
                        break;
                    case 1:
                        MoEDebuggerActivity.initViewModel$lambda$5(moEDebuggerActivity$initViewModel$4, obj);
                        break;
                    case 2:
                        MoEDebuggerActivity.initViewModel$lambda$6(moEDebuggerActivity$initViewModel$4, obj);
                        break;
                    default:
                        MoEDebuggerActivity.initViewModel$lambda$7(moEDebuggerActivity$initViewModel$4, obj);
                        break;
                }
            }
        });
        DebuggerViewModel debuggerViewModel4 = this.viewModel;
        if (debuggerViewModel4 == null) {
            r.o("viewModel");
            throw null;
        }
        x<DebuggerLogConfig> debuggerLogConfig = debuggerViewModel4.getDebuggerLogConfig();
        final MoEDebuggerActivity$initViewModel$5 moEDebuggerActivity$initViewModel$5 = new MoEDebuggerActivity$initViewModel$5(this);
        final int i5 = 3;
        debuggerLogConfig.i(this, new b0() {
            public final void a(Object obj) {
                switch (i5) {
                    case 0:
                        MoEDebuggerActivity.initViewModel$lambda$4(moEDebuggerActivity$initViewModel$5, obj);
                        break;
                    case 1:
                        MoEDebuggerActivity.initViewModel$lambda$5(moEDebuggerActivity$initViewModel$5, obj);
                        break;
                    case 2:
                        MoEDebuggerActivity.initViewModel$lambda$6(moEDebuggerActivity$initViewModel$5, obj);
                        break;
                    default:
                        MoEDebuggerActivity.initViewModel$lambda$7(moEDebuggerActivity$initViewModel$5, obj);
                        break;
                }
            }
        });
    }

    public static final void initViewModel$lambda$4(l lVar, Object obj) {
        r.k(lVar, "$tmp0");
        lVar.invoke(obj);
    }

    public static final void initViewModel$lambda$5(l lVar, Object obj) {
        r.k(lVar, "$tmp0");
        lVar.invoke(obj);
    }

    public static final void initViewModel$lambda$6(l lVar, Object obj) {
        r.k(lVar, "$tmp0");
        lVar.invoke(obj);
    }

    public static final void initViewModel$lambda$7(l lVar, Object obj) {
        r.k(lVar, "$tmp0");
        lVar.invoke(obj);
    }

    private final void showMessage(String message, MessageType messageType) {
        int i = WhenMappings.$EnumSwitchMapping$1[messageType.ordinal()];
        if (i == 1) {
            Toast.makeText((Context) this, (CharSequence) message, 1).show();
            return;
        }
        if (i != 2) {
            return;
        }
        TextView textView = this.errorMessageView;
        if (textView == null) {
            r.o("errorMessageView");
            throw null;
        }
        textView.setText(message);
        TextView textView2 = this.errorMessageView;
        if (textView2 == null) {
            r.o("errorMessageView");
            throw null;
        }
        textView2.setVisibility(0);
        ProgressBar progressBar = this.progressBarView;
        if (progressBar == null) {
            r.o("progressBarView");
            throw null;
        }
        progressBar.setVisibility(8);
        LinearLayout linearLayout = this.infoSectionView;
        if (linearLayout != null) {
            linearLayout.setVisibility(8);
        } else {
            r.o("infoSectionView");
            throw null;
        }
    }

    public final void updateUIElementsVisibility(DebuggerStatus debuggerStatus) {
        int i = WhenMappings.$EnumSwitchMapping$0[debuggerStatus.ordinal()];
        if (i == 1) {
            ProgressBar progressBar = this.progressBarView;
            if (progressBar == null) {
                r.o("progressBarView");
                throw null;
            }
            progressBar.setVisibility(0);
            TextView textView = this.errorMessageView;
            if (textView == null) {
                r.o("errorMessageView");
                throw null;
            }
            textView.setVisibility(8);
            LinearLayout linearLayout = this.infoSectionView;
            if (linearLayout != null) {
                linearLayout.setVisibility(8);
                return;
            } else {
                r.o("infoSectionView");
                throw null;
            }
        }
        if (i == 2) {
            ProgressBar progressBar2 = this.progressBarView;
            if (progressBar2 == null) {
                r.o("progressBarView");
                throw null;
            }
            progressBar2.setVisibility(8);
            TextView textView2 = this.errorMessageView;
            if (textView2 == null) {
                r.o("errorMessageView");
                throw null;
            }
            textView2.setVisibility(0);
            LinearLayout linearLayout2 = this.infoSectionView;
            if (linearLayout2 != null) {
                linearLayout2.setVisibility(8);
                return;
            } else {
                r.o("infoSectionView");
                throw null;
            }
        }
        ProgressBar progressBar3 = this.progressBarView;
        if (progressBar3 == null) {
            r.o("progressBarView");
            throw null;
        }
        progressBar3.setVisibility(8);
        TextView textView3 = this.errorMessageView;
        if (textView3 == null) {
            r.o("errorMessageView");
            throw null;
        }
        textView3.setVisibility(8);
        LinearLayout linearLayout3 = this.infoSectionView;
        if (linearLayout3 == null) {
            r.o("infoSectionView");
            throw null;
        }
        linearLayout3.setVisibility(0);
        if (debuggerStatus == DebuggerStatus.ENABLED) {
            AppCompatButton appCompatButton = this.startDebuggerView;
            if (appCompatButton == null) {
                r.o("startDebuggerView");
                throw null;
            }
            appCompatButton.setVisibility(8);
            AppCompatButton appCompatButton2 = this.stopDebuggerView;
            if (appCompatButton2 == null) {
                r.o("stopDebuggerView");
                throw null;
            }
            appCompatButton2.setVisibility(0);
            AppCompatButton appCompatButton3 = this.extendDebuggerTimeView;
            if (appCompatButton3 != null) {
                appCompatButton3.setVisibility(0);
                return;
            } else {
                r.o("extendDebuggerTimeView");
                throw null;
            }
        }
        AppCompatButton appCompatButton4 = this.startDebuggerView;
        if (appCompatButton4 == null) {
            r.o("startDebuggerView");
            throw null;
        }
        appCompatButton4.setVisibility(0);
        AppCompatButton appCompatButton5 = this.stopDebuggerView;
        if (appCompatButton5 == null) {
            r.o("stopDebuggerView");
            throw null;
        }
        appCompatButton5.setVisibility(8);
        AppCompatButton appCompatButton6 = this.extendDebuggerTimeView;
        if (appCompatButton6 != null) {
            appCompatButton6.setVisibility(8);
        } else {
            r.o("extendDebuggerTimeView");
            throw null;
        }
    }

    public void onCreate(@Nullable Bundle savedInstanceState) {
        Logger.Companion companion;
        SdkInstance instanceFromDeepLink;
        TraceMachine.startTracing("MoEDebuggerActivity");
        try {
            TraceMachine.enterMethod(this._nr_trace, "MoEDebuggerActivity#onCreate", null);
        } catch (NoSuchFieldError unused) {
            TraceMachine.enterMethod(null, "MoEDebuggerActivity#onCreate", null);
        }
        super/*androidx.fragment.app.u*/.onCreate(savedInstanceState);
        try {
            companion = Logger.INSTANCE;
            Logger.Companion.print$default(companion, 0, null, null, new MoEDebuggerActivity$onCreate$1(this), 7, null);
            setContentView(R.layout.activity_moe_debugger);
            initUIElements();
            instanceFromDeepLink = UtilsKt.getInstanceFromDeepLink(getIntent().getExtras());
        } catch (Throwable th) {
            if (th instanceof UnsupportedOperationException) {
                String string = getResources().getString(R.string.moe_debugger_wrong_environment);
                r.j(string, "getString(...)");
                showMessage(string, MessageType.EMBEDDED);
            }
            Logger.Companion.print$default(Logger.INSTANCE, 1, th, null, new MoEDebuggerActivity$onCreate$3(this), 4, null);
        }
        if (instanceFromDeepLink == null) {
            Logger.Companion.print$default(companion, 0, null, null, new MoEDebuggerActivity$onCreate$2$1(this), 7, null);
            String string2 = getResources().getString(R.string.moe_debugger_wrong_workspace_id_message);
            r.j(string2, "getString(...)");
            showMessage(string2, MessageType.EMBEDDED);
            TraceMachine.exitMethod();
            return;
        }
        this.sdkInstance = instanceFromDeepLink;
        HashMap<String, Integer> log_type_to_level_mapping = LoggerConstantsKt.getLOG_TYPE_TO_LEVEL_MAPPING();
        Bundle extras = getIntent().getExtras();
        Integer num = log_type_to_level_mapping.get(extras != null ? extras.getString(ConstantsKt.BUNDLE_EXTRA_LOG_LEVEL) : null);
        this.logLevel = num != null ? num.intValue() : 5;
        initStaticViewData();
        initViewModel();
        TraceMachine.exitMethod();
    }

    public boolean onCreateOptionsMenu(@NotNull Menu menu) {
        r.k(menu, "menu");
        getMenuInflater().inflate(R.menu.moe_debugger_share_menu, menu);
        return true;
    }

    public boolean onOptionsItemSelected(@NotNull MenuItem item) {
        r.k(item, "item");
        try {
            if (item.getItemId() != R.id.action_share) {
                return super/*android.app.Activity*/.onOptionsItemSelected(item);
            }
            if (this.sdkInstance == null) {
                String string = getResources().getString(R.string.moe_debugger_share_error_text);
                r.j(string, "getString(...)");
                showMessage(string, MessageType.TOAST);
                return true;
            }
            String string2 = getResources().getString(R.string.moe_debugger_share_subject);
            r.j(string2, "getString(...)");
            DebuggerViewModel debuggerViewModel = this.viewModel;
            if (debuggerViewModel == null) {
                r.o("viewModel");
                throw null;
            }
            DebuggerStatus debuggerStatus = (DebuggerStatus) debuggerViewModel.getDebuggerStatus().e();
            if (debuggerStatus == null) {
                debuggerStatus = DebuggerStatus.LOADING;
            }
            DebuggerStatus debuggerStatus2 = debuggerStatus;
            r.h(debuggerStatus2);
            TextView textView = this.logLevelView;
            if (textView == null) {
                r.o("logLevelView");
                throw null;
            }
            String obj = textView.getText().toString();
            TextView textView2 = this.startTimeView;
            if (textView2 == null) {
                r.o("startTimeView");
                throw null;
            }
            String obj2 = textView2.getText().toString();
            TextView textView3 = this.endTimeView;
            if (textView3 == null) {
                r.o("endTimeView");
                throw null;
            }
            String obj3 = textView3.getText().toString();
            TextView textView4 = this.workspaceIdView;
            if (textView4 == null) {
                r.o("workspaceIdView");
                throw null;
            }
            String obj4 = textView4.getText().toString();
            TextView textView5 = this.environmentView;
            if (textView5 == null) {
                r.o("environmentView");
                throw null;
            }
            String obj5 = textView5.getText().toString();
            TextView textView6 = this.deviceIdView;
            if (textView6 == null) {
                r.o("deviceIdView");
                throw null;
            }
            String obj6 = textView6.getText().toString();
            TextView textView7 = this.uniqueIdView;
            if (textView7 == null) {
                r.o("uniqueIdView");
                throw null;
            }
            String obj7 = textView7.getText().toString();
            TimeZone timeZone = TimeZone.getDefault();
            r.j(timeZone, "getDefault(...)");
            UtilsKt.shareText(this, new DebuggerInfo(string2, debuggerStatus2, obj, obj2, obj3, obj4, obj5, obj6, obj7, UtilsKt.getOffSetString(timeZone, TimeUtilsKt.currentMillis())));
            return true;
        } catch (Throwable th) {
            SdkInstance sdkInstance = this.sdkInstance;
            if (sdkInstance != null) {
                Logger.log$default(sdkInstance.logger, 1, th, null, new MoEDebuggerActivity$onOptionsItemSelected$1(this), 4, null);
                return super/*android.app.Activity*/.onOptionsItemSelected(item);
            }
            r.o("sdkInstance");
            throw null;
        }
    }

    public void onStart() {
        super.onStart();
        ApplicationStateMonitor.getInstance().activityStarted();
    }

    public void onStop() {
        super.onStop();
        ApplicationStateMonitor.getInstance().activityStopped();
    }
}