导航菜单

页面标题

页面副标题

Rilo v2.0.21 - StreamerHomeActivity.java 源代码

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

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


package app.callpe.ui.home;

import android.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageInfo;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.ComponentActivity;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContract;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import androidx.viewpager2.widget.ViewPager2;
import app.callpe.App;
import app.callpe.common.agora.LiveStreamEvent;
import app.callpe.common.agora.LiveStreamEventTypes;
import app.callpe.common.agora.VideoCallEvent;
import app.callpe.common.agora.VideoCallEventType;
import app.callpe.common.utils.DateHelper;
import app.callpe.common.utils.Helper;
import app.callpe.common.utils.InternetSpeedTest;
import app.callpe.common.utils.badgeMenu.BadgeDrawerToggle;
import app.callpe.common.utils.extensions.ActivityExtKt;
import app.callpe.common.utils.helper_functions.AppUsage;
import app.callpe.common.utils.helper_functions.BatteryOptimization;
import app.callpe.common.utils.helper_functions.LocationUtils;
import app.callpe.common.utils.helper_functions.Utils;
import app.callpe.common.utils.helper_functions.VolumeManager;
import app.callpe.common.utils.receivers.CallBroadcastReceiver;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.data.model.BandwidthInfo;
import app.callpe.data.model.FcmModel;
import app.callpe.data.model.FcmVideoDetails;
import app.callpe.data.model.LiveStreamModel;
import app.callpe.data.model.StreamerModel;
import app.callpe.data.model.VideoDetailModel;
import app.callpe.data.repository.upload.DownloadProgressHelper;
import app.callpe.databinding.ActivityStreamerHomeBinding;
import app.callpe.databinding.PendingMediaUploadDialogBinding;
import app.callpe.databinding.SlowInternetSpeedDialogBinding;
import app.callpe.databinding.UnwatchVideoDialogBinding;
import app.callpe.service.ApiService;
import app.callpe.service.PingService;
import app.callpe.service.jobs.JobPriority;
import app.callpe.ui.call.RtcScreenHandler;
import app.callpe.ui.home.StreamerHomeActivity;
import app.callpe.ui.home.fragments.CallFragment;
import app.callpe.ui.home.fragments.NewUserFragment;
import app.callpe.ui.home.fragments.VitokChatFragment;
import app.callpe.ui.home.vitok.StreamerHubFragment;
import app.callpe.ui.home.vitok.fragments.StreamerStatsHomeFragment;
import app.callpe.ui.livestreaming.LiveStreamingActivity;
import app.callpe.ui.login.LoginActivity;
import com.birjuvachhani.locus.Constants;
import com.downloader.OnDownloadListener;
import com.downloader.OnProgressListener;
import com.downloader.OnStartOrResumeListener;
import com.downloader.PRDownloader;
import com.downloader.Priority;
import com.downloader.Progress;
import com.downloader.request.DownloadRequest;
import com.facebook.internal.NativeProtocol;
import com.google.android.material.badge.BadgeDrawable;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.navigation.NavigationBarView;
import com.google.android.material.navigation.NavigationView;
import com.google.gson.Gson;
import com.techiness.progressdialoglibrary.ProgressDialog;
import dagger.hilt.android.AndroidEntryPoint;
import java.io.File;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Objects;
import javax.inject.Inject;
import kotlin.Deprecated;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.ArrayIteratorKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import kotlin.jvm.internal.StringCompanionObject;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Job;
import timber.log.Timber;

@Metadata(d1 = {"\u0000ì\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0007\n\u0000\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\t\n\u0002\b\u000e\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0015\n\u0002\b&\b\u0007\u0018\u0000 §\u00012\b\u0012\u0004\u0012\u00020\u00020\u0001:\u0004§\u0001¨\u0001B\u0005¢\u0006\u0002\u0010\u0003J\b\u0010O\u001a\u00020PH\u0002J\b\u0010Q\u001a\u00020PH\u0002J\u0010\u0010R\u001a\u00020\u001e2\u0006\u0010S\u001a\u00020TH\u0003J\b\u0010U\u001a\u00020PH\u0002J\b\u0010V\u001a\u00020PH\u0002J\"\u0010W\u001a\u00020P2\u0006\u0010X\u001a\u00020Y2\u0006\u0010Z\u001a\u00020\u001e2\b\u0010[\u001a\u0004\u0018\u00010\u0006H\u0002J\u0010\u0010\\\u001a\u00020P2\u0006\u0010\u0015\u001a\u00020\u0016H\u0002J\b\u0010]\u001a\u00020PH\u0002J\b\u0010^\u001a\u00020PH\u0002J\b\u0010_\u001a\u00020PH\u0002J\b\u0010`\u001a\u00020PH\u0002J\u0010\u0010a\u001a\u00020P2\u0006\u0010b\u001a\u00020\u0006H\u0002J\b\u0010c\u001a\u00020PH\u0002J\b\u0010d\u001a\u00020PH\u0002J\b\u0010e\u001a\u00020TH\u0002J\u0010\u0010f\u001a\u00020P2\u0006\u0010g\u001a\u00020hH\u0002J\u0010\u0010i\u001a\u00020P2\u0006\u0010g\u001a\u00020jH\u0002J\u0010\u0010k\u001a\u00020\u00022\u0006\u0010l\u001a\u00020mH\u0016J\b\u0010n\u001a\u00020PH\u0002J\b\u0010o\u001a\u00020PH\u0002J\u0010\u0010p\u001a\u00020P2\u0006\u0010q\u001a\u00020rH\u0002J\b\u0010s\u001a\u00020PH\u0002J\b\u0010t\u001a\u00020uH\u0002J\"\u0010v\u001a\u00020P2\u0006\u0010w\u001a\u00020\t2\u0006\u0010x\u001a\u00020\t2\b\u0010y\u001a\u0004\u0018\u00010!H\u0015J\b\u0010z\u001a\u00020PH\u0017J\b\u0010{\u001a\u00020PH\u0003J\u0012\u0010|\u001a\u00020P2\b\u0010}\u001a\u0004\u0018\u00010~H\u0014J\b\u0010\u007f\u001a\u00020PH\u0014J0\u0010\u0080\u0001\u001a\u00020P2\u0006\u0010w\u001a\u00020\t2\r\u0010\u0081\u0001\u001a\b\u0012\u0004\u0012\u00020\u00060\u00052\b\u0010\u0082\u0001\u001a\u00030\u0083\u0001H\u0016¢\u0006\u0003\u0010\u0084\u0001J\t\u0010\u0085\u0001\u001a\u00020PH\u0014J\t\u0010\u0086\u0001\u001a\u00020PH\u0014J\t\u0010\u0087\u0001\u001a\u00020PH\u0014J\u0014\u0010\u0088\u0001\u001a\u00020P2\t\b\u0002\u0010\u0089\u0001\u001a\u00020\u001eH\u0002J\u0014\u0010\u008a\u0001\u001a\u00020P2\t\b\u0002\u0010\u0089\u0001\u001a\u00020\u001eH\u0002J \u0010\u008b\u0001\u001a\u00020\u001e2\u000f\u0010\u0081\u0001\u001a\n\u0012\u0004\u0012\u00020\u0006\u0018\u00010\u0005H\u0002¢\u0006\u0003\u0010\u008c\u0001J\u0012\u0010\u008d\u0001\u001a\u00020\u001e2\u0007\u0010\u008e\u0001\u001a\u00020\u0006H\u0002J\u0007\u0010\u008f\u0001\u001a\u00020PJ\t\u0010\u0090\u0001\u001a\u00020PH\u0002J\t\u0010\u0091\u0001\u001a\u00020PH\u0002J\u0012\u0010\u0092\u0001\u001a\u00020P2\u0007\u0010\u0093\u0001\u001a\u00020\tH\u0002J\u0014\u0010\u0094\u0001\u001a\u00020P2\t\b\u0001\u0010\u0095\u0001\u001a\u00020\tH\u0002J\t\u0010\u0096\u0001\u001a\u00020PH\u0002J\t\u0010\u0097\u0001\u001a\u00020PH\u0002J\t\u0010\u0098\u0001\u001a\u00020PH\u0002J\u0010\u0010\u0099\u0001\u001a\u00020P2\u0007\u0010\u009a\u0001\u001a\u00020\u001eJ\u0010\u0010\u009b\u0001\u001a\u00020P2\u0007\u0010\u009a\u0001\u001a\u00020\u001eJ\u0011\u0010\u009c\u0001\u001a\u00020P2\u0006\u0010S\u001a\u00020TH\u0003J\u0012\u0010\u009d\u0001\u001a\u00020P2\u0007\u0010\u009e\u0001\u001a\u00020\u001eH\u0002J#\u0010\u009f\u0001\u001a\u00020P2\u0007\u0010 \u0001\u001a\u00020\u001e2\u0007\u0010¡\u0001\u001a\u00020\u00062\u0006\u0010X\u001a\u00020YH\u0002J\t\u0010¢\u0001\u001a\u00020PH\u0002J\t\u0010£\u0001\u001a\u00020PH\u0002J\t\u0010¤\u0001\u001a\u00020PH\u0002J\t\u0010¥\u0001\u001a\u00020PH\u0002J\u0012\u0010¦\u0001\u001a\u00020P2\u0007\u0010\u009e\u0001\u001a\u00020\u001eH\u0002R\u0016\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00060\u0005X\u0082\u000e¢\u0006\u0004\n\u0002\u0010\u0007R\u000e\u0010\b\u001a\u00020\tX\u0082D¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\tX\u0082D¢\u0006\u0002\n\u0000R\u0010\u0010\u000b\u001a\u0004\u0018\u00010\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\r\u001a\u0004\u0018\u00010\u000eX\u0082\u000e¢\u0006\u0002\n\u0000R\u001e\u0010\u000f\u001a\u00020\u00108\u0006@\u0006X\u0087.¢\u0006\u000e\n\u0000\u001a\u0004\b\u0011\u0010\u0012\"\u0004\b\u0013\u0010\u0014R\u0010\u0010\u0015\u001a\u0004\u0018\u00010\u0016X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0017\u001a\u00020\u0018X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0019\u001a\u00020\u0018X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u001a\u001a\u00020\u001bX\u0082.¢\u0006\u0002\n\u0000R\u0010\u0010\u001c\u001a\u0004\u0018\u00010\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u001d\u001a\u00020\u001eX\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010\u001f\u001a\u0010\u0012\f\u0012\n \"*\u0004\u0018\u00010!0!0 X\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010#\u001a\u0004\u0018\u00010!X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b$\u0010%\"\u0004\b&\u0010'R\u000e\u0010(\u001a\u00020)X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010*\u001a\u00020+X\u0082.¢\u0006\u0002\n\u0000R\u001a\u0010,\u001a\u00020-X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b.\u0010/\"\u0004\b0\u00101R\u000e\u00102\u001a\u000203X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u00104\u001a\u0004\u0018\u000105X\u0082\u000e¢\u0006\u0002\n\u0000R\u001e\u00106\u001a\u0010\u0012\f\u0012\n \"*\u0004\u0018\u00010\u00060\u00060 8\u0002X\u0083\u0004¢\u0006\u0002\n\u0000R\u000e\u00107\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u00108\u001a\u00020\u0006X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b9\u0010:\"\u0004\b;\u0010<R\u000e\u0010=\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010>\u001a\u00020?X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010@\u001a\u00020AX\u0082.¢\u0006\u0002\n\u0000R\u001a\u0010B\u001a\u00020\u001eX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\bC\u0010D\"\u0004\bE\u0010FR\u001b\u0010G\u001a\u00020H8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bK\u0010L\u001a\u0004\bI\u0010JR\u0010\u0010M\u001a\u0004\u0018\u00010NX\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006©\u0001"}, d2 = {"Lapp/callpe/ui/home/StreamerHomeActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityStreamerHomeBinding;", "()V", "PERMISSIONS", "", "", "[Ljava/lang/String;", "PERMISSION_REQ_FORWARD", "", "PERMISSION_REQ_STAY", "alertDialog", "Landroidx/appcompat/app/AlertDialog;", "alertDialogUpdate", "Landroid/app/AlertDialog;", "apiService", "Lapp/callpe/service/ApiService;", "getApiService", "()Lapp/callpe/service/ApiService;", "setApiService", "(Lapp/callpe/service/ApiService;)V", "bandwidthInfo", "Lapp/callpe/data/model/BandwidthInfo;", "batteryReceiver", "Landroid/content/BroadcastReceiver;", "broadcastReceiver", "drawer", "Landroidx/drawerlayout/widget/DrawerLayout;", "fullScreenIntentDialog", "isVitokDownloading", "", "launcher", "Landroidx/activity/result/ActivityResultLauncher;", "Landroid/content/Intent;", "kotlin.jvm.PlatformType", "mServiceIntent", "getMServiceIntent", "()Landroid/content/Intent;", "setMServiceIntent", "(Landroid/content/Intent;)V", "mViewPagerAdapter", "Lapp/callpe/ui/home/StreamerHomeActivity$ViewPager2Adapter;", "navigationView", "Lcom/google/android/material/navigation/NavigationView;", "pingService", "Lapp/callpe/service/PingService;", "getPingService", "()Lapp/callpe/service/PingService;", "setPingService", "(Lapp/callpe/service/PingService;)V", "previousBatterPercent", "", "progressHelper", "Lapp/callpe/data/repository/upload/DownloadProgressHelper;", "requestPermissionLauncher", "response", "streamerId", "getStreamerId", "()Ljava/lang/String;", "setStreamerId", "(Ljava/lang/String;)V", "streamerStatus", "toggle", "Lapp/callpe/common/utils/badgeMenu/BadgeDrawerToggle;", "toolbar", "Landroidx/appcompat/widget/Toolbar;", "userInteracted", "getUserInteracted", "()Z", "setUserInteracted", "(Z)V", "viewModel", "Lapp/callpe/ui/home/HomeViewModel;", "getViewModel", "()Lapp/callpe/ui/home/HomeViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "viewPager", "Landroidx/viewpager2/widget/ViewPager2;", "askAppUsagePermission", "", "askLocationPermission", "canUseFullScreenIntentCheck", "context", "Landroid/content/Context;", "checkBatterStatus", "checkForFSI", "checkForUpdate", "appVersion", "", "appForceUpdate", "appUrl", "checkInternetSpeedTest", "checkLocationPermission", "checkPendingCall", "checkPendingCallWithDelay", "checkPermissions", "downloadApk", "url", "fetchLiveStreamInfo", "fetchLocation", "getContext", "handleLiveStreamEvents", "event", "Lapp/callpe/common/agora/LiveStreamEvent;", "handleVideoCallEvents", "Lapp/callpe/common/agora/VideoCallEvent;", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "initSharedPrefs", "initViews", "initiateCall", "videoCallDetails", "Lapp/callpe/data/model/VideoDetailModel;", "installApkProgrammatically", "observeEvent", "Lkotlinx/coroutines/Job;", "onActivityResult", "requestCode", "resultCode", "data", "onBackPressed", "onClicks", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "onRequestPermissionsResult", NativeProtocol.RESULT_ARGS_PERMISSIONS, "grantResults", "", "(I[Ljava/lang/String;[I)V", "onResume", "onStart", "onStop", "ongoingCallLayout", "reset", "ongoingLivestreamLayout", "permissionArrayGranted", "([Ljava/lang/String;)Z", "permissionGranted", "permission", "refreshMissCallCount", "registerReceiver", "requestAppUsage", "requestPermissions", Constants.INTENT_EXTRA_CONFIGURATION, "setFabText", "text", "setNav", "setUpNavigation", "setUpToolbar", "showBadge", "isVisible", "showBadgeVitokChats", "showFullScreenNotificationPermissionDialog", "showOnlineOrOfflineBtn", "online", "showUpdateDialog", "isCancelable", "feAppUrl", "starServiceFunc", "stopServiceFunc", "toastNeedPermissions", "unRegisterReceiver", "updateGoLiveButton", "Companion", "ViewPager2Adapter", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class StreamerHomeActivity extends BaseActivity<ActivityStreamerHomeBinding> {

    public static final Companion INSTANCE = new Companion(null);
    private static boolean userOffline;
    private static boolean userOnline;
    private String[] PERMISSIONS;
    private final int PERMISSION_REQ_FORWARD;
    private final int PERMISSION_REQ_STAY;
    private AlertDialog alertDialog;
    private android.app.AlertDialog alertDialogUpdate;

    @Inject
    public ApiService apiService;
    private BandwidthInfo bandwidthInfo;
    private final BroadcastReceiver batteryReceiver;
    private final BroadcastReceiver broadcastReceiver;
    private DrawerLayout drawer;
    private AlertDialog fullScreenIntentDialog;
    private boolean isVitokDownloading;
    private ActivityResultLauncher<Intent> launcher;
    private Intent mServiceIntent;
    private ViewPager2Adapter mViewPagerAdapter;
    private NavigationView navigationView;
    private DownloadProgressHelper progressHelper;
    private final ActivityResultLauncher<String> requestPermissionLauncher;
    private BadgeDrawerToggle toggle;
    private Toolbar toolbar;
    private boolean userInteracted;

    private final Lazy viewModel;
    private ViewPager2 viewPager;
    private String response = "";
    private String streamerStatus = "";
    private PingService pingService = new PingService();
    private float previousBatterPercent = -1.0f;
    private String streamerId = "";

    public static final boolean getUserOffline() {
        return INSTANCE.getUserOffline();
    }

    public static final boolean getUserOnline() {
        return INSTANCE.getUserOnline();
    }

    public static final void setUserOffline(boolean z) {
        INSTANCE.setUserOffline(z);
    }

    public static final void setUserOnline(boolean z) {
        INSTANCE.setUserOnline(z);
    }

    @JvmStatic
    public static final void showAlert(Context context, DialogInterface.OnClickListener onClickListener) {
        INSTANCE.showAlert(context, onClickListener);
    }

    @JvmStatic
    public static final void showLowInternetSpeedDialog(Context context) {
        INSTANCE.showLowInternetSpeedDialog(context);
    }

    @JvmStatic
    public static final void showPendingMediaUploadAlert(Context context, String str, DialogInterface.OnClickListener onClickListener) {
        INSTANCE.showPendingMediaUploadAlert(context, str, onClickListener);
    }

    public StreamerHomeActivity() {
        final ComponentActivity componentActivity = (ComponentActivity) this;
        final Function0 function0 = null;
        this.viewModel = new ViewModelLazy(Reflection.getOrCreateKotlinClass(HomeViewModel.class), new Function0<ViewModelStore>() {
            {
                super(0);
            }

            public final ViewModelStore m1468invoke() {
                return componentActivity.getViewModelStore();
            }
        }, new Function0<ViewModelProvider.Factory>() {
            {
                super(0);
            }

            public final ViewModelProvider.Factory m1467invoke() {
                return componentActivity.getDefaultViewModelProviderFactory();
            }
        }, new Function0<CreationExtras>() {
            {
                super(0);
            }

            public final CreationExtras m1469invoke() {
                CreationExtras creationExtras;
                Function0 function02 = function0;
                return (function02 == null || (creationExtras = (CreationExtras) function02.invoke()) == null) ? componentActivity.getDefaultViewModelCreationExtras() : creationExtras;
            }
        });
        ActivityResultLauncher<String> registerForActivityResult = registerForActivityResult((ActivityResultContract) new ActivityResultContracts.RequestPermission(), new ActivityResultCallback() {
            public final void onActivityResult(Object obj) {
                StreamerHomeActivity.requestPermissionLauncher$lambda$1(StreamerHomeActivity.this, ((Boolean) obj).booleanValue());
            }
        });
        Intrinsics.checkNotNullExpressionValue(registerForActivityResult, "registerForActivityResul… finish()\n        }\n    }");
        this.requestPermissionLauncher = registerForActivityResult;
        this.PERMISSION_REQ_FORWARD = 1010;
        this.PERMISSION_REQ_STAY = 1011;
        this.PERMISSIONS = new String[]{"android.permission.RECORD_AUDIO", "android.permission.CAMERA", "android.permission.CALL_PHONE", "android.permission.READ_PHONE_STATE", "android.permission.READ_EXTERNAL_STORAGE"};
        this.batteryReceiver = new StreamerHomeActivity$batteryReceiver$1(this);
        ActivityResultLauncher<Intent> registerForActivityResult2 = registerForActivityResult((ActivityResultContract) new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
            public final void onActivityResult(Object obj) {
                StreamerHomeActivity.launcher$lambda$5(StreamerHomeActivity.this, (ActivityResult) obj);
            }
        });
        Intrinsics.checkNotNullExpressionValue(registerForActivityResult2, "registerForActivityResul…tically()\n        }\n    }");
        this.launcher = registerForActivityResult2;
        this.broadcastReceiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                Intrinsics.checkNotNullParameter(context, "context");
                Intrinsics.checkNotNullParameter(intent, "intent");
                Timber.e("Action %s", new Object[]{intent.getAction()});
                String action = intent.getAction();
                if (action != null) {
                    int hashCode = action.hashCode();
                    if (hashCode == 25391218) {
                        if (action.equals(app.callpe.common.utils.Constants.MAKE_OFFLINE)) {
                            StreamerHomeActivity.this.showOnlineOrOfflineBtn(false);
                        }
                    } else if (hashCode == 1809498564 && action.equals(app.callpe.common.utils.Constants.MAKE_ONLINE)) {
                        StreamerHomeActivity.this.showOnlineOrOfflineBtn(true);
                    }
                }
            }
        };
    }

    public final ApiService getApiService() {
        ApiService apiService = this.apiService;
        if (apiService != null) {
            return apiService;
        }
        Intrinsics.throwUninitializedPropertyAccessException("apiService");
        return null;
    }

    public final void setApiService(ApiService apiService) {
        Intrinsics.checkNotNullParameter(apiService, "<set-?>");
        this.apiService = apiService;
    }

    public final HomeViewModel getViewModel() {
        return (HomeViewModel) this.viewModel.getValue();
    }

    public final PingService getPingService() {
        return this.pingService;
    }

    public final void setPingService(PingService pingService) {
        Intrinsics.checkNotNullParameter(pingService, "<set-?>");
        this.pingService = pingService;
    }

    public final Intent getMServiceIntent() {
        return this.mServiceIntent;
    }

    public final void setMServiceIntent(Intent intent) {
        this.mServiceIntent = intent;
    }

    public final boolean getUserInteracted() {
        return this.userInteracted;
    }

    public final void setUserInteracted(boolean z) {
        this.userInteracted = z;
    }

    public final String getStreamerId() {
        return this.streamerId;
    }

    public final void setStreamerId(String str) {
        Intrinsics.checkNotNullParameter(str, "<set-?>");
        this.streamerId = str;
    }

    public static final void requestPermissionLauncher$lambda$1(StreamerHomeActivity streamerHomeActivity, boolean z) {
        Intrinsics.checkNotNullParameter(streamerHomeActivity, "this$0");
        if (z) {
            Timber.d("Permission granted", new Object[0]);
            if (streamerHomeActivity.permissionArrayGranted(streamerHomeActivity.PERMISSIONS)) {
                return;
            }
            streamerHomeActivity.requestPermissions(streamerHomeActivity.PERMISSION_REQ_FORWARD);
            return;
        }
        ActivityExtKt.toast((Activity) streamerHomeActivity, "Notification permission is necessary for using this app.");
        Intent intent = new Intent();
        intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
        intent.putExtra("android.provider.extra.APP_PACKAGE", streamerHomeActivity.getPackageName());
        streamerHomeActivity.startActivity(intent);
        streamerHomeActivity.finish();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setWindowFlag((Activity) this, 67108864, false);
        getWindow().setStatusBarColor(ContextCompat.getColor((Context) this, 2131100053));
        initSharedPrefs();
        if (Build.VERSION.SDK_INT < 30) {
            this.PERMISSIONS = new String[]{"android.permission.RECORD_AUDIO", "android.permission.CAMERA", "android.permission.CALL_PHONE", "android.permission.READ_PHONE_STATE", "android.permission.READ_EXTERNAL_STORAGE"};
        } else if (Build.VERSION.SDK_INT >= 33) {
            this.PERMISSIONS = new String[]{"android.permission.POST_NOTIFICATIONS", "android.permission.RECORD_AUDIO", "android.permission.CAMERA", "android.permission.CALL_PHONE", "android.permission.READ_PHONE_STATE"};
        }
        checkPermissions();
        checkBatterStatus();
        initViews();
        setUpToolbar();
        observeEvent();
        setUpNavigation();
        onClicks();
        getViewModel().getUserDetails();
        getViewModel().observeCallEvents();
        getViewModel().getActivePayouts();
        askLocationPermission();
    }

    public final void checkForUpdate(long appVersion, boolean appForceUpdate, String appUrl) {
        Unit unit;
        if (!LoginActivity.INSTANCE.isVitok() || appVersion <= Helper.getVersionCode((Context) this)) {
            return;
        }
        if (appUrl != null) {
            showUpdateDialog(false, appUrl, appVersion);
            unit = Unit.INSTANCE;
        } else {
            unit = null;
        }
        if (unit == null) {
            ActivityExtKt.toast((Activity) this, "Download url not present");
        }
    }

    private final void showUpdateDialog(boolean isCancelable, final String feAppUrl, long appVersion) {
        Window window;
        Window window2;
        try {
            DownloadProgressHelper downloadProgressHelper = new DownloadProgressHelper((Context) this, (Activity) this);
            this.progressHelper = downloadProgressHelper;
            downloadProgressHelper.setCancelable(isCancelable);
            AlertDialog.Builder builder = new AlertDialog.Builder((Context) this);
            LayoutInflater layoutInflater = getLayoutInflater();
            Intrinsics.checkNotNullExpressionValue(layoutInflater, "layoutInflater");
            View inflate = layoutInflater.inflate(2131559115, (ViewGroup) null);
            MaterialButton findViewById = inflate.findViewById(2131365240);
            MaterialButton findViewById2 = inflate.findViewById(2131365242);
            TextView textView = (TextView) inflate.findViewById(2131363406);
            ImageView imageView = (ImageView) inflate.findViewById(2131365244);
            builder.setCancelable(isCancelable);
            findViewById.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    StreamerHomeActivity.showUpdateDialog$lambda$4(StreamerHomeActivity.this, feAppUrl, view);
                }
            });
            builder.setView(inflate);
            imageView.setVisibility(8);
            findViewById2.setVisibility(8);
            Intrinsics.checkNotNullExpressionValue(textView, "versionTv");
            textView.setVisibility(0);
            StringBuilder sb = new StringBuilder();
            sb.append('v');
            sb.append(appVersion);
            textView.setText(sb.toString());
            android.app.AlertDialog create = builder.create();
            this.alertDialogUpdate = create;
            ((Window) Objects.requireNonNull(create != null ? create.getWindow() : null)).clearFlags(131080);
            android.app.AlertDialog alertDialog = this.alertDialogUpdate;
            if (alertDialog != null && (window2 = alertDialog.getWindow()) != null) {
                window2.setSoftInputMode(4);
            }
            android.app.AlertDialog alertDialog2 = this.alertDialogUpdate;
            if (alertDialog2 != null) {
                alertDialog2.show();
            }
            android.app.AlertDialog alertDialog3 = this.alertDialogUpdate;
            if (alertDialog3 == null || (window = alertDialog3.getWindow()) == null) {
                return;
            }
            window.setBackgroundDrawable(new ColorDrawable(0));
        } catch (Exception e) {
            Timber.e(e, "showChangePasswordDialog ", new Object[0]);
        }
    }

    public static final void showUpdateDialog$lambda$4(StreamerHomeActivity streamerHomeActivity, String str, View view) {
        Intrinsics.checkNotNullParameter(streamerHomeActivity, "this$0");
        Intrinsics.checkNotNullParameter(str, "$feAppUrl");
        try {
            streamerHomeActivity.downloadApk(str);
        } catch (Exception unused) {
        }
    }

    public static final void launcher$lambda$5(StreamerHomeActivity streamerHomeActivity, ActivityResult activityResult) {
        Intrinsics.checkNotNullParameter(streamerHomeActivity, "this$0");
        Intrinsics.checkNotNullParameter(activityResult, "result");
        if (activityResult.getResultCode() == -1) {
            streamerHomeActivity.installApkProgrammatically();
        }
    }

    public final void installApkProgrammatically() {
        try {
            Activity activity = (Activity) this;
            File file = new File(activity.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS), "vitok.apk");
            if (file.exists()) {
                if (Build.VERSION.SDK_INT >= 26) {
                    Intent intent = new Intent("android.settings.MANAGE_UNKNOWN_APP_SOURCES");
                    StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
                    String format = String.format("package:%s", Arrays.copyOf(new Object[]{activity.getPackageName()}, 1));
                    Intrinsics.checkNotNullExpressionValue(format, "format(format, *args)");
                    Intent data = intent.setData(Uri.parse(format));
                    Intrinsics.checkNotNullExpressionValue(data, "Intent(Settings.ACTION_M…                        )");
                    if (!activity.getPackageManager().canRequestPackageInstalls()) {
                        this.launcher.launch(data);
                    } else {
                        Uri uriForFile = FileProvider.getUriForFile(activity.getBaseContext(), activity.getApplicationContext().getPackageName() + ".provider", file);
                        Intent intent2 = new Intent("android.intent.action.VIEW", uriForFile);
                        intent2.putExtra("android.intent.extra.NOT_UNKNOWN_SOURCE", true);
                        intent2.setDataAndType(uriForFile, "application/vnd.android.package-archive");
                        intent2.setFlags(268468224);
                        intent2.addFlags(1);
                        startActivity(intent2);
                    }
                } else {
                    Intent intent3 = new Intent("android.intent.action.INSTALL_PACKAGE");
                    Uri uriForFile2 = FileProvider.getUriForFile(activity.getApplicationContext(), "app.ri1l0.provider", file);
                    Intrinsics.checkNotNullExpressionValue(uriForFile2, "getUriForFile(\n         …ile\n                    )");
                    activity.grantUriPermission(activity.getPackageName(), uriForFile2, 1);
                    activity.grantUriPermission(activity.getPackageName(), uriForFile2, 2);
                    intent3.setDataAndType(uriForFile2, "application/*");
                    intent3.setFlags(268435456);
                    intent3.addFlags(1);
                    intent3.addFlags(2);
                    startActivity(intent3);
                }
            } else {
                Toast.makeText(activity, getString(2131952060), 0).show();
                Timber.i(" file " + file.getPath() + " does not exist", new Object[0]);
            }
        } catch (Exception e) {
            Timber.i("%s", new Object[]{e.getMessage()});
        }
    }

    private final void downloadApk(String url) {
        if (this.isVitokDownloading) {
            Toast.makeText((Context) this, "Download already started.", 0).show();
            return;
        }
        File externalFilesDir = getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
        File file = new File(externalFilesDir, "vitok.apk");
        if (file.exists()) {
            PackageInfo packageArchiveInfo = getPackageManager().getPackageArchiveInfo(file.getPath(), 0);
            Intrinsics.checkNotNull(packageArchiveInfo);
            Context context = (Context) this;
            if (packageArchiveInfo.versionCode == Helper.getVersionCode(context)) {
                Timber.i("package version is same", new Object[0]);
                file.delete();
            } else if (packageArchiveInfo.versionCode > Helper.getVersionCode(context)) {
                Timber.i("package version is greater then current", new Object[0]);
                installApkProgrammatically();
                return;
            } else {
                Timber.i("package version is smaller then current", new Object[0]);
                file.delete();
            }
        }
        Intrinsics.checkNotNull(externalFilesDir);
        DownloadRequest build = PRDownloader.download(url, externalFilesDir.getPath(), "vitok.apk").setPriority(Priority.IMMEDIATE).build();
        this.isVitokDownloading = true;
        build.start(new OnDownloadListener() {
            public void onDownloadComplete() {
                throw new UnsupportedOperationException("Method not decompiled: app.callpe.ui.home.StreamerHomeActivity$downloadApk$1.onDownloadComplete():void");
            }

            public void onError(com.downloader.Error r3) {
                throw new UnsupportedOperationException("Method not decompiled: app.callpe.ui.home.StreamerHomeActivity$downloadApk$1.onError(com.downloader.Error):void");
            }
        });
        build.setOnStartOrResumeListener(new OnStartOrResumeListener() {
            public final void onStartOrResume() {
                StreamerHomeActivity.downloadApk$lambda$6(StreamerHomeActivity.this);
            }
        });
        build.setOnProgressListener(new OnProgressListener() {
            public final void onProgress(Progress progress) {
                StreamerHomeActivity.downloadApk$lambda$7(StreamerHomeActivity.this, progress);
            }
        });
    }

    public static final void downloadApk$lambda$6(StreamerHomeActivity streamerHomeActivity) {
        Intrinsics.checkNotNullParameter(streamerHomeActivity, "this$0");
        DownloadProgressHelper downloadProgressHelper = streamerHomeActivity.progressHelper;
        if (downloadProgressHelper != null) {
            if (downloadProgressHelper != null) {
                downloadProgressHelper.dismiss(streamerHomeActivity);
            }
            DownloadProgressHelper downloadProgressHelper2 = streamerHomeActivity.progressHelper;
            if (downloadProgressHelper2 != null) {
                downloadProgressHelper2.setProgressDialog();
            }
        }
    }

    public static final void downloadApk$lambda$7(StreamerHomeActivity streamerHomeActivity, Progress progress) {
        Intrinsics.checkNotNullParameter(streamerHomeActivity, "this$0");
        Intrinsics.checkNotNullParameter(progress, "progress");
        float f = (progress.currentBytes * 100) / progress.totalBytes;
        DownloadProgressHelper downloadProgressHelper = streamerHomeActivity.progressHelper;
        if (downloadProgressHelper != null && downloadProgressHelper != null) {
            downloadProgressHelper.progressDialogPercent(f);
        }
        Timber.e("Download Progress %s", new Object[]{Float.valueOf(f)});
    }

    private final void askLocationPermission() {
        LocationUtils.INSTANCE.showPermissionRationaleDialog(true, (Activity) this, new Function0<Unit>() {
            {
                super(0);
            }

            public Object invoke() {
                m1471invoke();
                return Unit.INSTANCE;
            }

            public final void m1471invoke() {
                StreamerHomeActivity.this.fetchLocation();
            }
        });
    }

    private final void initSharedPrefs() {
        Context context = (Context) this;
        String string = SharedPref.getString(context, PrefKeys.ACCOUNT_ID, "");
        Intrinsics.checkNotNullExpressionValue(string, "getString(this, PrefKeys.ACCOUNT_ID, \"\")");
        this.streamerId = string;
        String string2 = SharedPref.getString(context, PrefKeys.STREAMER_STATUS);
        Intrinsics.checkNotNullExpressionValue(string2, "getString(this, PrefKeys.STREAMER_STATUS)");
        this.streamerStatus = string2;
        this.bandwidthInfo = (BandwidthInfo) new Gson().fromJson(SharedPref.getString(context, PrefKeys.INTERNET_BANDWIDTH_CONFIG), BandwidthInfo.class);
    }

    public final void checkPendingCall() {
        try {
            long j = SharedPref.getLong((Context) this, PrefKeys.LATEST_CALL_ID, -1L);
            if (j == -1) {
                return;
            }
            getViewModel().fetchStatusOfVideoCall(j);
            SharedPref.setLong((Context) this, PrefKeys.LATEST_CALL_ID, -1L);
        } catch (Exception e) {
            Timber.e(e);
        }
    }

    private final void checkPendingCallWithDelay() {
        try {
            BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new StreamerHomeActivity$checkPendingCallWithDelay$1(this, null), 3, (Object) null);
        } catch (Exception e) {
            Timber.e(e);
        }
    }

    private final void checkBatterStatus() {
        registerReceiver(this.batteryReceiver, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
    }

    private final void checkPermissions() {
        if (Intrinsics.areEqual(this.streamerStatus, "APPROVED")) {
            Activity activity = (Activity) this;
            if (VolumeManager.INSTANCE.hasNotificationPolicyPermission(activity)) {
                VolumeManager.INSTANCE.setDeviceToNormal(activity);
            }
            if (Build.VERSION.SDK_INT >= 33) {
                this.requestPermissionLauncher.launch("android.permission.POST_NOTIFICATIONS");
            } else if (!permissionArrayGranted(this.PERMISSIONS)) {
                requestPermissions(this.PERMISSION_REQ_FORWARD);
            } else {
                BatteryOptimization.INSTANCE.removeBatteryOptimization(activity);
            }
        }
    }

    private final boolean permissionArrayGranted(String[] permissions) {
        if (permissions == null) {
            permissions = this.PERMISSIONS;
        }
        Iterator it = ArrayIteratorKt.iterator(permissions);
        while (it.hasNext()) {
            if (!permissionGranted((String) it.next())) {
                return false;
            }
        }
        return true;
    }

    private final boolean permissionGranted(String permission) {
        Timber.e("permission name " + permission, new Object[0]);
        return ContextCompat.checkSelfPermission((Context) this, permission) == 0;
    }

    private final void requestPermissions(int request) {
        ActivityCompat.requestPermissions((Activity) this, this.PERMISSIONS, request);
    }

    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
        Intrinsics.checkNotNullParameter(permissions, NativeProtocol.RESULT_ARGS_PERMISSIONS);
        Intrinsics.checkNotNullParameter(grantResults, "grantResults");
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        boolean z = false;
        Timber.e("requestCode == " + requestCode, new Object[0]);
        if (requestCode == this.PERMISSION_REQ_FORWARD || requestCode == this.PERMISSION_REQ_STAY) {
            boolean permissionArrayGranted = permissionArrayGranted(permissions);
            if (permissionArrayGranted && requestCode == this.PERMISSION_REQ_FORWARD) {
                BatteryOptimization.INSTANCE.removeBatteryOptimization((Activity) this);
            } else if (!permissionArrayGranted) {
                toastNeedPermissions();
            }
        }
        if (requestCode == 100123) {
            if (!(grantResults.length == 0)) {
                int length = grantResults.length;
                int i = 0;
                while (true) {
                    if (i >= length) {
                        z = true;
                        break;
                    } else {
                        if (!(grantResults[i] == 0)) {
                            break;
                        } else {
                            i++;
                        }
                    }
                }
                if (z) {
                    fetchLocation();
                }
            }
        }
    }

    public final void fetchLocation() {
        Context context = (Context) this;
        LocationUtils.INSTANCE.getLocation(false, context, getApiService(), new Function2<Double, Double, Unit>() {
            {
                super(2);
            }

            public Object invoke(Object obj, Object obj2) {
                invoke(((Number) obj).doubleValue(), ((Number) obj2).doubleValue());
                return Unit.INSTANCE;
            }

            public final void invoke(double d, double d2) {
                HomeViewModel viewModel;
                HomeViewModel viewModel2;
                Timber.d("Received location: " + d + ", " + d2, new Object[0]);
                viewModel = StreamerHomeActivity.this.getViewModel();
                viewModel.setLat(d);
                viewModel2 = StreamerHomeActivity.this.getViewModel();
                viewModel2.setLon(d2);
            }
        });
        LocationUtils.INSTANCE.isMockLocation(context, new StreamerHomeActivity$fetchLocation$2(this));
    }

    private final void toastNeedPermissions() {
        Toast.makeText((Context) this, 2131952354, 1).show();
        Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
        intent.setData(Uri.fromParts("package", getPackageName(), null));
        startActivityForResult(intent, JobPriority.MID);
    }

    private final void onClicks() {
        getBinding().streamerId.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                StreamerHomeActivity.onClicks$lambda$9(StreamerHomeActivity.this, view);
            }
        });
        getBinding().btnSwitch.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public final boolean onTouch(View view, MotionEvent motionEvent) {
                boolean onClicks$lambda$10;
                onClicks$lambda$10 = StreamerHomeActivity.onClicks$lambda$10(view, motionEvent);
                return onClicks$lambda$10;
            }
        });
        getBinding().btnSwitch.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                StreamerHomeActivity.onClicks$lambda$13(StreamerHomeActivity.this, view);
            }
        });
        getBinding().ongoingCallParent.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                StreamerHomeActivity.onClicks$lambda$16(StreamerHomeActivity.this, view);
            }
        });
        getBinding().ongoingLivestreamParent.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                StreamerHomeActivity.onClicks$lambda$18(StreamerHomeActivity.this, view);
            }
        });
    }

    public static final void onClicks$lambda$9(StreamerHomeActivity streamerHomeActivity, View view) {
        Intrinsics.checkNotNullParameter(streamerHomeActivity, "this$0");
        Helper.copyToClipboard((Context) streamerHomeActivity, streamerHomeActivity.streamerId);
    }

    public static final boolean onClicks$lambda$10(View view, MotionEvent motionEvent) {
        return motionEvent.getAction() == 2;
    }

    public static final void onClicks$lambda$13(StreamerHomeActivity streamerHomeActivity, View view) {
        Unit unit;
        Intrinsics.checkNotNullParameter(streamerHomeActivity, "this$0");
        boolean isChecked = streamerHomeActivity.getBinding().btnSwitch.isChecked();
        ProgressBar progressBar = streamerHomeActivity.getBinding().progress;
        Intrinsics.checkNotNullExpressionValue(progressBar, "binding.progress");
        progressBar.setVisibility(0);
        View view2 = streamerHomeActivity.getBinding().btnSwitch;
        Intrinsics.checkNotNullExpressionValue(view2, "binding.btnSwitch");
        view2.setVisibility(8);
        if (isChecked) {
            BandwidthInfo bandwidthInfo = streamerHomeActivity.bandwidthInfo;
            if (bandwidthInfo != null) {
                if (bandwidthInfo.getCheckBandwidth()) {
                    BandwidthInfo bandwidthInfo2 = streamerHomeActivity.bandwidthInfo;
                    Intrinsics.checkNotNull(bandwidthInfo2);
                    streamerHomeActivity.checkInternetSpeedTest(bandwidthInfo2);
                } else {
                    streamerHomeActivity.getViewModel().goOnlineOrOffline(true);
                }
                unit = Unit.INSTANCE;
            } else {
                unit = null;
            }
            if (unit == null) {
                streamerHomeActivity.getViewModel().goOnlineOrOffline(true);
            }
        } else {
            streamerHomeActivity.getViewModel().goOnlineOrOffline(false);
        }
        streamerHomeActivity.getBinding().btnSwitch.setChecked(!isChecked);
    }

    public static final void onClicks$lambda$16(StreamerHomeActivity streamerHomeActivity, View view) {
        Intrinsics.checkNotNullParameter(streamerHomeActivity, "this$0");
        VideoDetailModel videoDetails = streamerHomeActivity.getViewModel().getVideoDetails();
        if (videoDetails != null) {
            Context applicationContext = streamerHomeActivity.getApplicationContext();
            Intrinsics.checkNotNullExpressionValue(applicationContext, "applicationContext");
            Intent rtcScreenIntent = RtcScreenHandler.getRtcScreenIntent(applicationContext, RtcScreenHandler.getRtcScreenType$default(null, 1, null));
            rtcScreenIntent.putExtra(app.callpe.common.utils.Constants.FROM_NOTIFICATION_CLICK, !App.Companion.isVideoCallScreen());
            rtcScreenIntent.putExtra(app.callpe.common.utils.Constants.KEY_CALLING_CHANNEL, videoDetails.getAgoraChannelName());
            rtcScreenIntent.putExtra(app.callpe.common.utils.Constants.KEY_CALLING_VIDEO_ID, videoDetails.getId());
            rtcScreenIntent.putExtra(app.callpe.common.utils.Constants.KEY_AGORA_ACCESS_TOKEN, videoDetails.getAgoraUserToken());
            rtcScreenIntent.putExtra(app.callpe.common.utils.Constants.KEY_CALLER, streamerHomeActivity.getViewModel().getCaller());
            String callType = videoDetails.getCallType();
            if (callType != null && Intrinsics.areEqual(callType, "AUDIO")) {
                rtcScreenIntent.putExtra(app.callpe.common.utils.Constants.KEY_CALL_TYPE, "AUDIO");
            }
            rtcScreenIntent.putExtra(app.callpe.common.utils.Constants.FCM_DATA, new Gson().toJson(videoDetails));
            streamerHomeActivity.startActivity(rtcScreenIntent);
        }
    }

    public static final void onClicks$lambda$18(StreamerHomeActivity streamerHomeActivity, View view) {
        Intrinsics.checkNotNullParameter(streamerHomeActivity, "this$0");
        LiveStreamModel livestreamDetails = streamerHomeActivity.getViewModel().getLivestreamDetails();
        if (livestreamDetails != null) {
            LiveStreamingActivity.Companion companion = LiveStreamingActivity.INSTANCE;
            FragmentActivity fragmentActivity = (FragmentActivity) streamerHomeActivity;
            long id = livestreamDetails.getId();
            String roomId = livestreamDetails.getRoomId();
            String zegoToken = livestreamDetails.getZegoToken();
            if (zegoToken == null) {
                zegoToken = "";
            }
            String json = new Gson().toJson(livestreamDetails);
            Intrinsics.checkNotNullExpressionValue(json, "Gson().toJson(liveStreamModel)");
            companion.createOrJoinLiveStream(fragmentActivity, id, roomId, zegoToken, json, livestreamDetails.getLiveStreamProvider());
        }
    }

    private final void initViews() {
        DrawerLayout drawerLayout = getBinding().newHomeDrawerLayout;
        Intrinsics.checkNotNullExpressionValue(drawerLayout, "binding.newHomeDrawerLayout");
        this.drawer = drawerLayout;
        NavigationView navigationView = getBinding().newHomeNavView;
        Intrinsics.checkNotNullExpressionValue(navigationView, "binding.newHomeNavView");
        this.navigationView = navigationView;
        Toolbar toolbar = getBinding().toolbar;
        Intrinsics.checkNotNullExpressionValue(toolbar, "binding.toolbar");
        this.toolbar = toolbar;
    }

    private final Job observeEvent() {
        return BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new StreamerHomeActivity$observeEvent$1(this, null), 3, (Object) null);
    }

    private final void setNav() {
        throw new UnsupportedOperationException("Method not decompiled: app.callpe.ui.home.StreamerHomeActivity.setNav():void");
    }

    public static final boolean setNav$lambda$19(StreamerHomeActivity streamerHomeActivity, MenuItem menuItem) {
        Intrinsics.checkNotNullParameter(streamerHomeActivity, "this$0");
        Intrinsics.checkNotNullParameter(menuItem, "item");
        int itemId = menuItem.getItemId();
        DrawerLayout drawerLayout = streamerHomeActivity.drawer;
        if (drawerLayout == null) {
            Intrinsics.throwUninitializedPropertyAccessException("drawer");
            drawerLayout = null;
        }
        drawerLayout.closeDrawer(8388611);
        if (itemId != 2131363847) {
            return true;
        }
        streamerHomeActivity.getViewModel().signOut(streamerHomeActivity.getContext());
        return true;
    }

    private final void setUpNavigation() {
        boolean areEqual = Intrinsics.areEqual(this.streamerStatus, "APPROVED");
        getBinding().streamerId.setText("ID: " + this.streamerId);
        LinearLayout linearLayout = getBinding().onlineToggle;
        Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.onlineToggle");
        linearLayout.setVisibility(areEqual ? 0 : 8);
        TextView textView = getBinding().streamerId;
        Intrinsics.checkNotNullExpressionValue(textView, "binding.streamerId");
        textView.setVisibility(areEqual ^ true ? 0 : 8);
        this.viewPager = getBinding().viewPager;
        String str = this.streamerStatus;
        FragmentManager supportFragmentManager = getSupportFragmentManager();
        Intrinsics.checkNotNullExpressionValue(supportFragmentManager, "supportFragmentManager");
        Lifecycle lifecycle = getLifecycle();
        Intrinsics.checkNotNullExpressionValue(lifecycle, "lifecycle");
        RecyclerView.Adapter viewPager2Adapter = new ViewPager2Adapter(str, supportFragmentManager, lifecycle);
        this.mViewPagerAdapter = viewPager2Adapter;
        ViewPager2 viewPager2 = this.viewPager;
        if (viewPager2 != null) {
            viewPager2.setAdapter(viewPager2Adapter);
        }
        ViewPager2 viewPager22 = this.viewPager;
        if (viewPager22 != null) {
            viewPager22.setUserInputEnabled(false);
        }
        ViewPager2 viewPager23 = this.viewPager;
        if (viewPager23 != null) {
            viewPager23.setOffscreenPageLimit(5);
        }
        getBinding().bottomNavigation.setOnItemSelectedListener(new NavigationBarView.OnItemSelectedListener() {
            public final boolean onNavigationItemSelected(MenuItem menuItem) {
                boolean upNavigation$lambda$20;
                upNavigation$lambda$20 = StreamerHomeActivity.setUpNavigation$lambda$20(StreamerHomeActivity.this, menuItem);
                return upNavigation$lambda$20;
            }
        });
        ViewPager2 viewPager24 = this.viewPager;
        if (viewPager24 != null) {
            viewPager24.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
                public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
                    String str2;
                    str2 = StreamerHomeActivity.this.streamerStatus;
                    if (!Intrinsics.areEqual(str2, "APPROVED")) {
                        if (position == 0) {
                            StreamerHomeActivity.this.getBinding().homeTitle.setText(StreamerHomeActivity.this.getString(2131952128));
                            return;
                        } else if (position == 1) {
                            StreamerHomeActivity.this.getBinding().homeTitle.setText(StreamerHomeActivity.this.getString(2131953078));
                            return;
                        } else {
                            if (position != 2) {
                                return;
                            }
                            StreamerHomeActivity.this.getBinding().homeTitle.setText(StreamerHomeActivity.this.getString(2131951654));
                            return;
                        }
                    }
                    if (position == 0) {
                        StreamerHomeActivity.this.getBinding().homeTitle.setText(StreamerHomeActivity.this.getString(2131952128));
                        return;
                    }
                    if (position == 1) {
                        StreamerHomeActivity.this.getBinding().homeTitle.setText(StreamerHomeActivity.this.getString(2131951840));
                        return;
                    }
                    if (position == 2) {
                        StreamerHomeActivity.this.getBinding().homeTitle.setText(StreamerHomeActivity.this.getString(2131951769));
                    } else if (position == 3) {
                        StreamerHomeActivity.this.getBinding().homeTitle.setText(StreamerHomeActivity.this.getString(2131953078));
                    } else {
                        if (position != 4) {
                            return;
                        }
                        StreamerHomeActivity.this.getBinding().homeTitle.setText(StreamerHomeActivity.this.getString(2131951654));
                    }
                }

                public void onPageSelected(int position) {
                    String str2;
                    str2 = StreamerHomeActivity.this.streamerStatus;
                    if (!Intrinsics.areEqual(str2, "APPROVED")) {
                        if (position == 0) {
                            StreamerHomeActivity.this.getBinding().bottomNavigation.setSelectedItemId(2131362955);
                            return;
                        } else if (position == 1) {
                            StreamerHomeActivity.this.getBinding().bottomNavigation.setSelectedItemId(2131362963);
                            return;
                        } else {
                            if (position != 2) {
                                return;
                            }
                            StreamerHomeActivity.this.getBinding().bottomNavigation.setSelectedItemId(2131362948);
                            return;
                        }
                    }
                    if (position == 0) {
                        StreamerHomeActivity.this.getBinding().bottomNavigation.setSelectedItemId(2131362955);
                        return;
                    }
                    if (position == 1) {
                        StreamerHomeActivity.this.getBinding().bottomNavigation.setSelectedItemId(2131362950);
                        return;
                    }
                    if (position == 2) {
                        StreamerHomeActivity.this.getBinding().bottomNavigation.setSelectedItemId(2131362962);
                    } else if (position == 3) {
                        StreamerHomeActivity.this.getBinding().bottomNavigation.setSelectedItemId(2131362963);
                    } else {
                        if (position != 4) {
                            return;
                        }
                        StreamerHomeActivity.this.getBinding().bottomNavigation.setSelectedItemId(2131362948);
                    }
                }
            });
        }
        getBinding().fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                StreamerHomeActivity.setUpNavigation$lambda$21(StreamerHomeActivity.this, view);
            }
        });
        if (areEqual) {
            return;
        }
        MenuItem findItem = getBinding().bottomNavigation.getMenu().findItem(2131362950);
        MenuItem findItem2 = getBinding().bottomNavigation.getMenu().findItem(2131362962);
        findItem.setVisible(false);
        findItem2.setVisible(false);
        if (Intrinsics.areEqual(this.streamerStatus, "CREATED") || Intrinsics.areEqual(this.streamerStatus, "PASSED") || Intrinsics.areEqual(this.streamerStatus, "IGNORED") || Intrinsics.areEqual(this.streamerStatus, "REJECTED") || Intrinsics.areEqual(this.streamerStatus, "DATA_PENDING")) {
            ViewPager2 viewPager25 = this.viewPager;
            if (viewPager25 != null) {
                viewPager25.setCurrentItem(0);
            }
            View view = getBinding().bottomBar;
            Intrinsics.checkNotNullExpressionValue(view, "binding.bottomBar");
            view.setVisibility(8);
            return;
        }
        View view2 = getBinding().bottomBar;
        Intrinsics.checkNotNullExpressionValue(view2, "binding.bottomBar");
        view2.setVisibility(0);
    }

    public static final boolean setUpNavigation$lambda$20(StreamerHomeActivity streamerHomeActivity, MenuItem menuItem) {
        ViewPager2 viewPager2;
        Intrinsics.checkNotNullParameter(streamerHomeActivity, "this$0");
        Intrinsics.checkNotNullParameter(menuItem, "item");
        if (Intrinsics.areEqual(streamerHomeActivity.streamerStatus, "APPROVED")) {
            switch (menuItem.getItemId()) {
                case 2131362948:
                    ViewPager2 viewPager22 = streamerHomeActivity.viewPager;
                    if (viewPager22 != null) {
                        viewPager22.setCurrentItem(4);
                        break;
                    }
                    break;
                case 2131362950:
                    ViewPager2 viewPager23 = streamerHomeActivity.viewPager;
                    if (viewPager23 != null) {
                        viewPager23.setCurrentItem(1);
                        break;
                    }
                    break;
                case 2131362955:
                    ViewPager2 viewPager24 = streamerHomeActivity.viewPager;
                    if (viewPager24 != null) {
                        viewPager24.setCurrentItem(0);
                        break;
                    }
                    break;
                case 2131362962:
                    ViewPager2 viewPager25 = streamerHomeActivity.viewPager;
                    if (viewPager25 != null) {
                        viewPager25.setCurrentItem(2);
                        break;
                    }
                    break;
                case 2131362963:
                    ViewPager2 viewPager26 = streamerHomeActivity.viewPager;
                    if (viewPager26 != null) {
                        viewPager26.setCurrentItem(3);
                        break;
                    }
                    break;
            }
        } else {
            int itemId = menuItem.getItemId();
            if (itemId == 2131362948) {
                ViewPager2 viewPager27 = streamerHomeActivity.viewPager;
                if (viewPager27 != null) {
                    viewPager27.setCurrentItem(2);
                }
            } else if (itemId == 2131362955) {
                ViewPager2 viewPager28 = streamerHomeActivity.viewPager;
                if (viewPager28 != null) {
                    viewPager28.setCurrentItem(0);
                }
            } else if (itemId == 2131362963 && (viewPager2 = streamerHomeActivity.viewPager) != null) {
                viewPager2.setCurrentItem(1);
            }
        }
        return true;
    }

    public static final void setUpNavigation$lambda$21(StreamerHomeActivity streamerHomeActivity, View view) {
        ViewPager2 viewPager2;
        Intrinsics.checkNotNullParameter(streamerHomeActivity, "this$0");
        ViewPager2 viewPager22 = streamerHomeActivity.viewPager;
        if (viewPager22 != null) {
            if ((viewPager22 != null ? viewPager22.getAdapter() : null) == null || (viewPager2 = streamerHomeActivity.viewPager) == null) {
                return;
            }
            viewPager2.getCurrentItem();
        }
    }

    private final void setUpToolbar() {
        try {
            Toolbar toolbar = this.toolbar;
            Toolbar toolbar2 = null;
            if (toolbar == null) {
                Intrinsics.throwUninitializedPropertyAccessException("toolbar");
                toolbar = null;
            }
            toolbar.setOverflowIcon(ContextCompat.getDrawable((Context) this, 2131231656));
            Toolbar toolbar3 = this.toolbar;
            if (toolbar3 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("toolbar");
            } else {
                toolbar2 = toolbar3;
            }
            setSupportActionBar(toolbar2);
            ActionBar actionBar = (ActionBar) Objects.requireNonNull(getSupportActionBar());
            if (actionBar != null) {
                actionBar.setDisplayHomeAsUpEnabled(false);
            }
        } catch (Exception e) {
            Timber.e(e, "setUpToolbar: Error ", new Object[0]);
        }
    }

    public final void initiateCall(VideoDetailModel videoCallDetails) {
        try {
            if (!Intrinsics.areEqual(videoCallDetails.getStatus(), "CREATED")) {
                Timber.e("Call status " + videoCallDetails.getStatus(), new Object[0]);
                return;
            }
            FcmModel mapVideoDetailsToFcmModel = videoCallDetails.mapVideoDetailsToFcmModel("STREAMER");
            Intent intent = new Intent(getApplicationContext(), (Class<?>) CallBroadcastReceiver.class);
            FcmVideoDetails fcmVideoDetails = new FcmVideoDetails();
            fcmVideoDetails.fillValues(mapVideoDetailsToFcmModel, "STREAMER");
            intent.putExtra(app.callpe.common.utils.Constants.FCM_DATA, new Gson().toJson(fcmVideoDetails));
            sendBroadcast(intent);
        } catch (Exception e) {
            Timber.e(e);
        }
    }

    public final void showOnlineOrOfflineBtn(boolean online) {
        ProgressBar progressBar = getBinding().progress;
        Intrinsics.checkNotNullExpressionValue(progressBar, "binding.progress");
        progressBar.setVisibility(8);
        View view = getBinding().btnSwitch;
        Intrinsics.checkNotNullExpressionValue(view, "binding.btnSwitch");
        view.setVisibility(0);
        if (online) {
            starServiceFunc();
            getBinding().btnSwitch.setChecked(true);
            getBinding().statusTxt.setText(2131953093);
        } else {
            stopServiceFunc();
            getBinding().btnSwitch.setChecked(false);
            getBinding().statusTxt.setText(2131952360);
        }
        updateGoLiveButton(online);
    }

    private final void updateGoLiveButton(boolean online) {
        if (this.viewPager != null) {
            try {
                Fragment findFragmentByTag = getSupportFragmentManager().findFragmentByTag("f0");
                if (findFragmentByTag != null) {
                    if (findFragmentByTag instanceof StreamerStatsHomeFragment) {
                        ((StreamerStatsHomeFragment) findFragmentByTag).updateGoLiveButton(online);
                    }
                    Unit unit = Unit.INSTANCE;
                }
            } catch (Exception e) {
                Timber.e(e);
                Unit unit2 = Unit.INSTANCE;
            }
        }
    }

    private final Context getContext() {
        return (Context) this;
    }

    public final void handleLiveStreamEvents(LiveStreamEvent event) {
        LiveStreamModel liveStreamModel;
        if (event.getEvent() == LiveStreamEventTypes.ENDED) {
            ongoingLivestreamLayout(true);
        } else {
            if (event.getEvent() != LiveStreamEventTypes.LIVE_STREAM_INFO || (liveStreamModel = event.getLiveStreamModel()) == null) {
                return;
            }
            getViewModel().setLivestreamDetails(liveStreamModel);
            ongoingLivestreamLayout(false);
        }
    }

    public final void handleVideoCallEvents(VideoCallEvent event) {
        VideoDetailModel videoDetailModel;
        if (event.getEvent() == VideoCallEventType.CALL_STARTED) {
            ongoingLivestreamLayout(true);
            ongoingCallLayout$default(this, false, 1, null);
            return;
        }
        if (event.getEvent() == VideoCallEventType.CALL_ENDED) {
            ongoingCallLayout(true);
            fetchLiveStreamInfo();
            checkPendingCallWithDelay();
            return;
        }
        if (event.getEvent() != VideoCallEventType.CALL_INFO || getViewModel().getTimerSet() || (videoDetailModel = event.getVideoDetailModel()) == null) {
            return;
        }
        getViewModel().setVideoDetails(videoDetailModel);
        getViewModel().setCaller(event.getCaller());
        String startTime = videoDetailModel.getStartTime();
        if (startTime != null) {
            setWindowFlag((Activity) this, 67108864, false);
            Context context = (Context) this;
            getWindow().setStatusBarColor(ContextCompat.getColor(context, 2131100026));
            TextView textView = ((ActivityStreamerHomeBinding) getBinding()).callerName;
            StreamerModel userDetails = videoDetailModel.getUserDetails();
            textView.setText(userDetails != null ? userDetails.getName() : null);
            LinearLayout linearLayout = ((ActivityStreamerHomeBinding) getBinding()).ongoingCallParent;
            Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.ongoingCallParent");
            linearLayout.setVisibility(0);
            getViewModel().setTimerSet(true);
            getViewModel().setStartTime(DateHelper.convertIsoStringToMills$default(DateHelper.INSTANCE, startTime, null, 2, null));
            ((ActivityStreamerHomeBinding) getBinding()).timerLeft.setStartTime(getViewModel().getStartTime());
            SharedPref.setString(context, PrefKeys.START_TIME, startTime);
        }
    }

    private final void fetchLiveStreamInfo() {
        Fragment findFragmentByTag;
        if (this.viewPager == null || (findFragmentByTag = getSupportFragmentManager().findFragmentByTag("f0")) == null || !(findFragmentByTag instanceof StreamerStatsHomeFragment)) {
            return;
        }
        ((StreamerStatsHomeFragment) findFragmentByTag).fetchLiveStreamInfo();
    }

    static void ongoingCallLayout$default(StreamerHomeActivity streamerHomeActivity, boolean z, int i, Object obj) {
        if ((i & 1) != 0) {
            z = false;
        }
        streamerHomeActivity.ongoingCallLayout(z);
    }

    private final void ongoingCallLayout(boolean reset) {
        getViewModel().setTimerSet(false);
        getViewModel().setStartTime(-1L);
        if (reset) {
            setWindowFlag((Activity) this, 67108864, false);
            getWindow().setStatusBarColor(ContextCompat.getColor((Context) this, 2131099815));
            LinearLayout linearLayout = ((ActivityStreamerHomeBinding) getBinding()).ongoingCallParent;
            Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.ongoingCallParent");
            linearLayout.setVisibility(8);
            return;
        }
        setWindowFlag((Activity) this, 67108864, false);
        getWindow().setStatusBarColor(ContextCompat.getColor((Context) this, 2131100026));
        LinearLayout linearLayout2 = ((ActivityStreamerHomeBinding) getBinding()).ongoingCallParent;
        Intrinsics.checkNotNullExpressionValue(linearLayout2, "binding.ongoingCallParent");
        linearLayout2.setVisibility(0);
    }

    static void ongoingLivestreamLayout$default(StreamerHomeActivity streamerHomeActivity, boolean z, int i, Object obj) {
        if ((i & 1) != 0) {
            z = false;
        }
        streamerHomeActivity.ongoingLivestreamLayout(z);
    }

    private final void ongoingLivestreamLayout(boolean reset) {
        if (reset) {
            setWindowFlag((Activity) this, 67108864, false);
            getWindow().setStatusBarColor(ContextCompat.getColor((Context) this, 2131099815));
            LinearLayout linearLayout = ((ActivityStreamerHomeBinding) getBinding()).ongoingLivestreamParent;
            Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.ongoingLivestreamParent");
            linearLayout.setVisibility(8);
            return;
        }
        setWindowFlag((Activity) this, 67108864, false);
        getWindow().setStatusBarColor(ContextCompat.getColor((Context) this, 2131100026));
        LinearLayout linearLayout2 = ((ActivityStreamerHomeBinding) getBinding()).ongoingLivestreamParent;
        Intrinsics.checkNotNullExpressionValue(linearLayout2, "binding.ongoingLivestreamParent");
        linearLayout2.setVisibility(0);
    }

    public final void showBadge(boolean isVisible) {
        BadgeDrawable orCreateBadge = getBinding().bottomNavigation.getOrCreateBadge(2131362950);
        Intrinsics.checkNotNullExpressionValue(orCreateBadge, "binding.bottomNavigation…Badge(R.id.fragment_chat)");
        orCreateBadge.setVisible(isVisible);
    }

    public final void showBadgeVitokChats(boolean isVisible) {
        BadgeDrawable orCreateBadge = getBinding().bottomNavigation.getOrCreateBadge(2131362963);
        Intrinsics.checkNotNullExpressionValue(orCreateBadge, "binding.bottomNavigation…R.id.fragment_vitok_chat)");
        orCreateBadge.setVisible(isVisible);
    }

    public final void refreshMissCallCount() {
        getViewModel().getMissCallCount();
    }

    private final void setFabText(int text) {
        getBinding().fab.setText(text);
        if (getBinding().fab.isExtended()) {
            return;
        }
        getBinding().fab.extend();
    }

    private final void askAppUsagePermission() {
        androidx.appcompat.app.AlertDialog create = new AlertDialog.Builder((Context) this).create();
        this.alertDialog = create;
        if (create != null) {
            create.setTitle(getString(2131952428));
        }
        androidx.appcompat.app.AlertDialog alertDialog = this.alertDialog;
        if (alertDialog != null) {
            alertDialog.setCancelable(true);
        }
        androidx.appcompat.app.AlertDialog alertDialog2 = this.alertDialog;
        if (alertDialog2 != null) {
            alertDialog2.setMessage(getString(2131951679));
        }
        androidx.appcompat.app.AlertDialog alertDialog3 = this.alertDialog;
        if (alertDialog3 != null) {
            alertDialog3.setButton(-2, getString(2131951669), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    StreamerHomeActivity.askAppUsagePermission$lambda$29(StreamerHomeActivity.this, dialogInterface, i);
                }
            });
        }
        androidx.appcompat.app.AlertDialog alertDialog4 = this.alertDialog;
        if (alertDialog4 != null) {
            alertDialog4.show();
        }
    }

    public static final void askAppUsagePermission$lambda$29(StreamerHomeActivity streamerHomeActivity, DialogInterface dialogInterface, int i) {
        Intrinsics.checkNotNullParameter(streamerHomeActivity, "this$0");
        Intrinsics.checkNotNullParameter(dialogInterface, "dialog");
        streamerHomeActivity.requestAppUsage();
        dialogInterface.dismiss();
    }

    protected void onDestroy() {
        androidx.appcompat.app.AlertDialog alertDialog = this.alertDialog;
        if (alertDialog != null) {
            alertDialog.dismiss();
        }
        super.onDestroy();
        try {
            unregisterReceiver(this.batteryReceiver);
        } catch (Exception e) {
            Timber.e(e);
        }
    }

    @Deprecated(message = "Deprecated in Java")
    public void onBackPressed() {
        ViewPager2 viewPager2 = this.viewPager;
        if (viewPager2 != null) {
            if ((viewPager2 != null ? viewPager2.getAdapter() : null) != null) {
                ViewPager2 viewPager22 = this.viewPager;
                if (viewPager22 != null && viewPager22.getCurrentItem() == 0) {
                    finish();
                    return;
                }
                ViewPager2 viewPager23 = this.viewPager;
                if (viewPager23 == null) {
                    return;
                }
                viewPager23.setCurrentItem(0);
                return;
            }
        }
        super.onBackPressed();
    }

    @Deprecated(message = "Deprecated in Java")
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        Activity activity = (Activity) this;
        LocationUtils.handleActivityResult$default(LocationUtils.INSTANCE, activity, requestCode, resultCode, data, false, new Function0<Unit>() {
            {
                super(0);
            }

            public Object invoke() {
                m1472invoke();
                return Unit.INSTANCE;
            }

            public final void m1472invoke() {
                StreamerHomeActivity.this.fetchLocation();
            }
        }, 16, null);
        if (requestCode == 303) {
            checkPermissions();
            return;
        }
        if (requestCode == 500) {
            checkPermissions();
            return;
        }
        if (requestCode == 10001) {
            checkPermissions();
            return;
        }
        if (requestCode != 100132) {
            return;
        }
        if (LocationUtils.INSTANCE.isGpsEnabled((Context) this)) {
            fetchLocation();
        } else {
            Timber.d("XXXXXX_TEST: GPS still disabled after returning", new Object[0]);
            LocationUtils.showGpsManualEnableDialog$default(LocationUtils.INSTANCE, activity, false, 2, null);
        }
    }

    @Metadata(d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0004\u0018\u00002\u00020\u0001B\u001d\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007¢\u0006\u0002\u0010\bJ\u0010\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\fH\u0016J\u000e\u0010\r\u001a\u00020\n2\u0006\u0010\u000e\u001a\u00020\fJ\b\u0010\u000f\u001a\u00020\fH\u0016R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0010"}, d2 = {"Lapp/callpe/ui/home/StreamerHomeActivity$ViewPager2Adapter;", "Landroidx/viewpager2/adapter/FragmentStateAdapter;", "streamerStatus", "", "fm", "Landroidx/fragment/app/FragmentManager;", "lifecycle", "Landroidx/lifecycle/Lifecycle;", "(Ljava/lang/String;Landroidx/fragment/app/FragmentManager;Landroidx/lifecycle/Lifecycle;)V", "createFragment", "Landroidx/fragment/app/Fragment;", "position", "", "getItem", "currentItem", "getItemCount", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
    public static final class ViewPager2Adapter extends FragmentStateAdapter {
        private final FragmentManager fm;
        private final String streamerStatus;

        public ViewPager2Adapter(String str, FragmentManager fragmentManager, Lifecycle lifecycle) {
            super(fragmentManager, lifecycle);
            Intrinsics.checkNotNullParameter(str, "streamerStatus");
            Intrinsics.checkNotNullParameter(fragmentManager, "fm");
            Intrinsics.checkNotNullParameter(lifecycle, "lifecycle");
            this.streamerStatus = str;
            this.fm = fragmentManager;
        }

        public Fragment createFragment(int position) {
            if (Intrinsics.areEqual(this.streamerStatus, "APPROVED")) {
                if (position == 0) {
                    return new StreamerStatsHomeFragment();
                }
                if (position == 1) {
                    return new StreamerHubFragment();
                }
                if (position == 2) {
                    return new CallFragment();
                }
                if (position == 3) {
                    return new VitokChatFragment();
                }
                if (position == 4) {
                    return new StreamerAccountFragment();
                }
            } else {
                if (position == 0) {
                    return new StreamerStatsHomeFragment();
                }
                if (position == 1) {
                    return new VitokChatFragment();
                }
                if (position == 2) {
                    return new StreamerAccountFragment();
                }
            }
            return new NewUserFragment();
        }

        public int getItemCount() {
            return Intrinsics.areEqual(this.streamerStatus, "APPROVED") ? 5 : 3;
        }

        public final Fragment getItem(int currentItem) {
            Object obj = this.fm.getFragments().get(currentItem);
            Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type androidx.fragment.app.Fragment");
            return (Fragment) obj;
        }
    }

    @Override
    public ActivityStreamerHomeBinding inflateLayout(LayoutInflater layoutInflater) {
        Intrinsics.checkNotNullParameter(layoutInflater, "layoutInflater");
        ActivityStreamerHomeBinding inflate = ActivityStreamerHomeBinding.inflate(layoutInflater);
        Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
        return inflate;
    }

    private final void starServiceFunc() {
        this.pingService = new PingService();
        this.mServiceIntent = new Intent((Context) this, this.pingService.getClass());
        Activity activity = (Activity) this;
        if (!Utils.isMyServiceRunning(this.pingService.getClass(), activity)) {
            try {
                startService(this.mServiceIntent);
                Timber.d("Service started successfully", new Object[0]);
                return;
            } catch (Exception e) {
                String message = e.getMessage();
                if (message == null) {
                    message = "";
                }
                ActivityExtKt.toast(activity, message);
                return;
            }
        }
        Timber.d("Service is already running", new Object[0]);
    }

    private final void stopServiceFunc() {
        this.pingService = new PingService();
        this.mServiceIntent = new Intent((Context) this, this.pingService.getClass());
        if (Utils.isMyServiceRunning(this.pingService.getClass(), (Activity) this)) {
            stopService(this.mServiceIntent);
            Timber.d("Service stopped!!", new Object[0]);
        } else {
            Timber.d("Service is already stopped!!", new Object[0]);
        }
    }

    @Override
    protected void onStart() {
        super.onStart();
        registerReceiver();
    }

    protected void onStop() {
        super.onStop();
        unRegisterReceiver();
    }

    private final void registerReceiver() {
        LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance((Context) this);
        Intrinsics.checkNotNullExpressionValue(localBroadcastManager, "getInstance(this)");
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(app.callpe.common.utils.Constants.MAKE_OFFLINE);
        intentFilter.addAction(app.callpe.common.utils.Constants.MAKE_ONLINE);
        intentFilter.addAction(app.callpe.common.utils.Constants.NOTIFY);
        localBroadcastManager.registerReceiver(this.broadcastReceiver, intentFilter);
    }

    private final void unRegisterReceiver() {
        LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance((Context) this);
        Intrinsics.checkNotNullExpressionValue(localBroadcastManager, "getInstance(this)");
        localBroadcastManager.unregisterReceiver(this.broadcastReceiver);
    }

    protected void onResume() {
        super.onResume();
        checkLocationPermission();
        checkForFSI();
        if (userOffline) {
            showOnlineOrOfflineBtn(false);
            userOffline = false;
        }
        if (userOnline) {
            showOnlineOrOfflineBtn(true);
            userOnline = false;
        }
        checkPendingCall();
    }

    private final void checkLocationPermission() {
        Context context = (Context) this;
        if (LocationUtils.INSTANCE.isGpsEnabled(context) && LocationUtils.INSTANCE.getGpsPermissionAsked()) {
            boolean z = ActivityCompat.checkSelfPermission(context, "android.permission.ACCESS_FINE_LOCATION") == 0;
            boolean z2 = ActivityCompat.checkSelfPermission(context, "android.permission.ACCESS_COARSE_LOCATION") == 0;
            if (z || z2) {
                fetchLocation();
            } else {
                Toast.makeText(context, "Location permission needed!", 1).show();
                LocationUtils.INSTANCE.showLocationPermissionDialog(context);
            }
        }
    }

    @Metadata(d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\n\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0018\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u0013H\u0007J\u0010\u0010\u0014\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u0011H\u0007J \u0010\u0015\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0016\u001a\u00020\u00172\u0006\u0010\u0012\u001a\u00020\u0013H\u0007R$\u0010\u0003\u001a\u00020\u00048\u0006@\u0006X\u0087\u000e¢\u0006\u0014\n\u0000\u0012\u0004\b\u0005\u0010\u0002\u001a\u0004\b\u0006\u0010\u0007\"\u0004\b\b\u0010\tR$\u0010\n\u001a\u00020\u00048\u0006@\u0006X\u0087\u000e¢\u0006\u0014\n\u0000\u0012\u0004\b\u000b\u0010\u0002\u001a\u0004\b\f\u0010\u0007\"\u0004\b\r\u0010\t¨\u0006\u0018"}, d2 = {"Lapp/callpe/ui/home/StreamerHomeActivity$Companion;", "", "()V", "userOffline", "", "getUserOffline$annotations", "getUserOffline", "()Z", "setUserOffline", "(Z)V", "userOnline", "getUserOnline$annotations", "getUserOnline", "setUserOnline", "showAlert", "", "context", "Landroid/content/Context;", "onClickListener", "Landroid/content/DialogInterface$OnClickListener;", "showLowInternetSpeedDialog", "showPendingMediaUploadAlert", "title", "", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
    public static final class Companion {
        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        @JvmStatic
        public static void getUserOffline$annotations() {
        }

        @JvmStatic
        public static void getUserOnline$annotations() {
        }

        private Companion() {
        }

        public final boolean getUserOffline() {
            return StreamerHomeActivity.userOffline;
        }

        public final void setUserOffline(boolean z) {
            StreamerHomeActivity.userOffline = z;
        }

        public final boolean getUserOnline() {
            return StreamerHomeActivity.userOnline;
        }

        public final void setUserOnline(boolean z) {
            StreamerHomeActivity.userOnline = z;
        }

        @JvmStatic
        public final void showAlert(Context context, final DialogInterface.OnClickListener onClickListener) {
            Intrinsics.checkNotNullParameter(context, "context");
            Intrinsics.checkNotNullParameter(onClickListener, "onClickListener");
            UnwatchVideoDialogBinding inflate = UnwatchVideoDialogBinding.inflate(LayoutInflater.from(context));
            Intrinsics.checkNotNullExpressionValue(inflate, "inflate(LayoutInflater.from(context))");
            AlertDialog.Builder builder = new AlertDialog.Builder(context);
            builder.setView(inflate.getRoot());
            builder.setCancelable(true);
            final android.app.AlertDialog create = builder.create();
            Window window = create.getWindow();
            Intrinsics.checkNotNull(window);
            window.setBackgroundDrawableResource(R.color.transparent);
            create.show();
            inflate.allowButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    StreamerHomeActivity.Companion.showAlert$lambda$0(onClickListener, create, view);
                }
            });
        }

        public static final void showAlert$lambda$0(DialogInterface.OnClickListener onClickListener, android.app.AlertDialog alertDialog, View view) {
            Intrinsics.checkNotNullParameter(onClickListener, "$onClickListener");
            onClickListener.onClick(alertDialog, -1);
            alertDialog.dismiss();
        }

        @JvmStatic
        public final void showPendingMediaUploadAlert(Context context, String title, final DialogInterface.OnClickListener onClickListener) {
            Intrinsics.checkNotNullParameter(context, "context");
            Intrinsics.checkNotNullParameter(title, "title");
            Intrinsics.checkNotNullParameter(onClickListener, "onClickListener");
            PendingMediaUploadDialogBinding inflate = PendingMediaUploadDialogBinding.inflate(LayoutInflater.from(context));
            Intrinsics.checkNotNullExpressionValue(inflate, "inflate(LayoutInflater.from(context))");
            AlertDialog.Builder builder = new AlertDialog.Builder(context);
            builder.setView(inflate.getRoot());
            inflate.titleTextView.setText(title);
            builder.setCancelable(true);
            final android.app.AlertDialog create = builder.create();
            Window window = create.getWindow();
            Intrinsics.checkNotNull(window);
            window.setBackgroundDrawableResource(R.color.transparent);
            create.show();
            inflate.allowButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    StreamerHomeActivity.Companion.showPendingMediaUploadAlert$lambda$1(onClickListener, create, view);
                }
            });
        }

        public static final void showPendingMediaUploadAlert$lambda$1(DialogInterface.OnClickListener onClickListener, android.app.AlertDialog alertDialog, View view) {
            Intrinsics.checkNotNullParameter(onClickListener, "$onClickListener");
            onClickListener.onClick(alertDialog, -1);
            alertDialog.dismiss();
        }

        @JvmStatic
        public final void showLowInternetSpeedDialog(Context context) {
            Intrinsics.checkNotNullParameter(context, "context");
            SlowInternetSpeedDialogBinding inflate = SlowInternetSpeedDialogBinding.inflate(LayoutInflater.from(context));
            Intrinsics.checkNotNullExpressionValue(inflate, "inflate(LayoutInflater.from(context))");
            AlertDialog.Builder builder = new AlertDialog.Builder(context);
            builder.setView(inflate.getRoot());
            builder.setCancelable(true);
            final android.app.AlertDialog create = builder.create();
            Window window = create.getWindow();
            Intrinsics.checkNotNull(window);
            window.setBackgroundDrawableResource(R.color.transparent);
            create.show();
            inflate.dismissBtn.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    create.dismiss();
                }
            });
        }
    }

    private final void requestAppUsage() {
        if (AppUsage.INSTANCE.checkUsageStatsPermission(getContext())) {
            return;
        }
        startActivityForResult(new Intent("android.settings.USAGE_ACCESS_SETTINGS"), AppUsage.APP_USAGE_REQUEST_CODE);
    }

    private final void checkForFSI() {
        if (Build.VERSION.SDK_INT >= 34) {
            Context context = (Context) this;
            if (!canUseFullScreenIntentCheck(context)) {
                showFullScreenNotificationPermissionDialog(context);
                return;
            }
            androidx.appcompat.app.AlertDialog alertDialog = this.fullScreenIntentDialog;
            if (alertDialog != null) {
                alertDialog.dismiss();
            }
            this.fullScreenIntentDialog = null;
        }
    }

    private final boolean canUseFullScreenIntentCheck(Context context) {
        Object systemService = context.getSystemService("notification");
        Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
        return ((NotificationManager) systemService).canUseFullScreenIntent();
    }

    private final void showFullScreenNotificationPermissionDialog(final Context context) {
        androidx.appcompat.app.AlertDialog alertDialog = this.fullScreenIntentDialog;
        if (alertDialog != null) {
            alertDialog.dismiss();
        }
        androidx.appcompat.app.AlertDialog create = new AlertDialog.Builder(context).setTitle("Permission Required").setMessage("This app requires permission to show full-screen notifications. Please allow this permission in settings.").setPositiveButton("Allow", new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                StreamerHomeActivity.showFullScreenNotificationPermissionDialog$lambda$30(StreamerHomeActivity.this, context, dialogInterface, i);
            }
        }).setCancelable(false).create();
        this.fullScreenIntentDialog = create;
        if (create != null) {
            create.show();
        }
    }

    public static final void showFullScreenNotificationPermissionDialog$lambda$30(StreamerHomeActivity streamerHomeActivity, Context context, DialogInterface dialogInterface, int i) {
        Intrinsics.checkNotNullParameter(streamerHomeActivity, "this$0");
        Intrinsics.checkNotNullParameter(context, "$context");
        try {
            streamerHomeActivity.startActivity(new Intent("android.settings.MANAGE_APP_USE_FULL_SCREEN_INTENT").setData(Uri.parse("package:" + streamerHomeActivity.getPackageName())));
        } catch (Exception e) {
            Toast.makeText(context, "Error: " + e, 0).show();
        }
    }

    private final void checkInternetSpeedTest(BandwidthInfo bandwidthInfo) {
        ProgressDialog progressDialog = new ProgressDialog((Context) this, 0, 2, (DefaultConstructorMarker) null);
        progressDialog.setMessage("Checking Network Status...");
        progressDialog.setCancelable(false);
        progressDialog.show();
        String speedTestDownloadUrl = bandwidthInfo.getSpeedTestDownloadUrl();
        if (speedTestDownloadUrl == null) {
            speedTestDownloadUrl = "http://speedtest.tele2.net/1MB.zip";
        }
        String str = speedTestDownloadUrl;
        String speedTestUploadUrl = bandwidthInfo.getSpeedTestUploadUrl();
        if (speedTestUploadUrl == null) {
            speedTestUploadUrl = "https://store1.gofile.io/uploadFile";
        }
        InternetSpeedTest.INSTANCE.checkSpeed(str, speedTestUploadUrl, bandwidthInfo.getMinDownloadSpeedInKBps(), bandwidthInfo.getMinUploadSpeedInKBps(), new StreamerHomeActivity$checkInternetSpeedTest$1(progressDialog, this));
    }
}