正在查看: Biko v2.0.23 应用的 LiveStreamingActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Biko v2.0.23 应用的 LiveStreamingActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package app.callpe.ui.livestreaming;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.Application;
import android.app.Dialog;
import android.app.PictureInPictureParams;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.media.AudioManager;
import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.util.Rational;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewPropertyAnimator;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.ComponentActivity;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
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.transition.TransitionManager;
import app.callpe.App;
import app.callpe.adapters.LiveCoverAdapter;
import app.callpe.adapters.LiveStreamGiftAnimationAdapter;
import app.callpe.adapters.LiveStreamMessageAdapter;
import app.callpe.common.agora.CohostEvent;
import app.callpe.common.agora.CohostEventType;
import app.callpe.common.agora.LiveStreamCloseEvent;
import app.callpe.common.agora.LiveStreamEndEvent;
import app.callpe.common.agora.LiveStreamStates;
import app.callpe.common.utils.Constants;
import app.callpe.common.utils.GiftTimerManager;
import app.callpe.common.utils.Helper;
import app.callpe.common.utils.RxBus;
import app.callpe.common.utils.ZEGOSDKConstants;
import app.callpe.common.utils.custom.CustomLinearLayoutManager;
import app.callpe.common.utils.custom.CustomPagerSnapHelper;
import app.callpe.common.utils.custom.NoScrollRecyclerView;
import app.callpe.common.utils.custom.OnSnapListener;
import app.callpe.common.utils.custom.panels.OverlappingPanelsLayout;
import app.callpe.common.utils.extensions.ActivityExtKt;
import app.callpe.common.utils.extensions.NumberExtKt;
import app.callpe.common.utils.extensions.ViewExtKt;
import app.callpe.common.utils.helper_functions.DialogHelper;
import app.callpe.common.utils.helper_functions.Utils;
import app.callpe.common.utils.receivers.LiveStreamBroadcastReceiver;
import app.callpe.common.utils.receivers.UserCohostBroadcastReceiver;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.data.model.Balance;
import app.callpe.data.model.CohostModel;
import app.callpe.data.model.CohostRequestModel;
import app.callpe.data.model.GiftModel;
import app.callpe.data.model.GiftRequestModel;
import app.callpe.data.model.LiveStreamMessageModel;
import app.callpe.data.model.LiveStreamModel;
import app.callpe.data.model.LiveStreamParticipant;
import app.callpe.data.model.LivestreamConfig;
import app.callpe.data.model.StreamerModel;
import app.callpe.data.model.StreamerUserLivestreamGame;
import app.callpe.data.model.User;
import app.callpe.data.model.VideoCallGameRequestModel;
import app.callpe.databinding.ActivityLiveStreamingBinding;
import app.callpe.databinding.GiftPopupBinding;
import app.callpe.databinding.GiftReceivedPopupLivestreamBinding;
import app.callpe.databinding.StreamerMoreOptionDialogLayoutBinding;
import app.callpe.rtc.RtcManagerFactory;
import app.callpe.rtc.components.LocalRtcVideoView;
import app.callpe.rtc.components.RemoteRtcVideoView;
import app.callpe.service.LiveStreamingService;
import app.callpe.service.UserCohostService;
import app.callpe.ui.bottomsheet.CallSheet;
import app.callpe.ui.bottomsheet.CohostCallSheet;
import app.callpe.ui.bottomsheet.GiftBottomSheet;
import app.callpe.ui.bottomsheet.VerifyNumberSheet;
import app.callpe.ui.call.RtcScreenHandler;
import app.callpe.ui.call.ZegoVideoCallActivity;
import app.callpe.ui.dialog.RechargeDialog;
import app.callpe.ui.home.StreamerDetailActivity;
import app.callpe.ui.home.fragments.LiveStreamersFragment;
import app.callpe.ui.livestreaming.bottomsheet.CohostRequestBottomSheet;
import app.callpe.ui.livestreaming.bottomsheet.FollowAndLeaveBottomSheet;
import app.callpe.ui.livestreaming.bottomsheet.GameRequestDialog;
import app.callpe.ui.livestreaming.bottomsheet.LiveStreamAudienceSheet;
import app.callpe.ui.livestreaming.bottomsheet.LiveStreamMessageOptionsSheet;
import app.callpe.ui.login.LoginActivity;
import app.callpe.ui.payment.WalletActivity;
import app.callpe.ui.user.UserDetailsActivity;
import app.callpe.ui.user.games.bottomsheet.GamesBottomSheet;
import app.callpe.ui.user.games.common.GameUtils;
import app.module.common.interfaces.SDKInitialise;
import app.module.common.interfaces.SignOutListener;
import app.module.common.model.rtc.RtcRoomDetails;
import app.module.common.rtcmanager.RtcManager;
import app.module.common.rtcmanager.handlers.RtcEventHandler;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
import com.bumptech.glide.load.Transformation;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.request.RequestOptions;
import com.facebook.internal.NativeProtocol;
import com.google.android.material.button.MaterialButton;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.mikhaellopez.circularprogressbar.CircularProgressBar;
import com.permissionx.guolindev.PermissionX;
import com.permissionx.guolindev.callback.ExplainReasonCallback;
import com.permissionx.guolindev.callback.ForwardToSettingsCallback;
import com.permissionx.guolindev.callback.RequestCallback;
import com.permissionx.guolindev.request.ExplainScope;
import com.permissionx.guolindev.request.ForwardScope;
import com.uzairiqbal.circulartimerview.CircularTimerListener;
import com.uzairiqbal.circulartimerview.CircularTimerView;
import com.uzairiqbal.circulartimerview.TimeFormatEnum;
import com.vdx.sud.SudGameViewModel;
import com.vdx.sud.model.DataCallback;
import com.vdx.sud.model.LoadingScreen;
import com.vdx.sud.utils.DensityUtils;
import com.vdx.sud.utils.SystemUtils;
import dagger.hilt.android.AndroidEntryPoint;
import gun0912.tedkeyboardobserver.TedRxKeyboardObserver;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.Queue;
import java.util.concurrent.CancellationException;
import javax.inject.Inject;
import jp.wasabeef.glide.transformations.BlurTransformation;
import jp.wasabeef.recyclerview.animators.SlideInLeftAnimator;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import kotlin.jvm.internal.StringCompanionObject;
import kotlin.text.StringsKt;
import kotlin.time.Duration;
import kotlin.time.DurationKt;
import kotlin.time.DurationUnit;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CompletableJob;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.Job;
import kotlinx.coroutines.MainCoroutineDispatcher;
import kotlinx.coroutines.SupervisorKt;
import tech.sud.mgp.SudMGPWrapper.model.GameConfigModel;
import tech.sud.mgp.SudMGPWrapper.model.GameViewInfoModel;
import tech.sud.mgp.SudMGPWrapper.state.SudMGPMGState;
import timber.log.Timber;
@Metadata(d1 = {"\u0000\u0098\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\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\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u000e\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0010\u0007\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0017\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\u000b\n\u0002\u0018\u0002\n\u0002\b#\n\u0002\u0018\u0002\n\u0002\b\u0010\b\u0007\u0018\u0000 ´\u00022\u00020\u00012\u00020\u00022\u00020\u00032\u00020\u00042\u00020\u0005:\u0006³\u0002´\u0002µ\u0002B\u0005¢\u0006\u0002\u0010\u0006J\n\u0010\u009c\u0001\u001a\u00030\u009d\u0001H\u0002J\u0014\u0010\u009e\u0001\u001a\u00030\u009d\u00012\b\u0010\u009f\u0001\u001a\u00030 \u0001H\u0002J\u0013\u0010¡\u0001\u001a\u00030\u009d\u00012\t\u0010¢\u0001\u001a\u0004\u0018\u00010HJ\u0011\u0010£\u0001\u001a\u00030\u009d\u00012\u0007\u0010¢\u0001\u001a\u00020HJ\u001c\u0010¤\u0001\u001a\u00030\u009d\u00012\u0007\u0010¥\u0001\u001a\u00020\b2\u0007\u0010¦\u0001\u001a\u00020\bH\u0002J\u0014\u0010§\u0001\u001a\u00030\u009d\u00012\b\u0010¨\u0001\u001a\u00030©\u0001H\u0002J\u0014\u0010ª\u0001\u001a\u00030\u009d\u00012\b\u0010«\u0001\u001a\u00030©\u0001H\u0002J\u001c\u0010¬\u0001\u001a\u00030\u009d\u00012\u0007\u0010\u00ad\u0001\u001a\u00020\b2\u0007\u0010®\u0001\u001a\u00020\bH\u0002J\n\u0010¯\u0001\u001a\u00030\u009d\u0001H\u0002J(\u0010°\u0001\u001a\u00030\u009d\u00012\t\b\u0002\u0010±\u0001\u001a\u00020\u00142\u0011\u0010²\u0001\u001a\f\u0012\u0007\u0012\u0005\u0018\u00010\u009d\u00010³\u0001H\u0002J\u0013\u0010´\u0001\u001a\u00030\u009d\u00012\u0007\u0010µ\u0001\u001a\u00020\u0014H\u0002J\n\u0010¶\u0001\u001a\u00030\u009d\u0001H\u0002J\n\u0010·\u0001\u001a\u00030\u009d\u0001H\u0016J\n\u0010¸\u0001\u001a\u00030\u009d\u0001H\u0002J\n\u0010¹\u0001\u001a\u00030\u009d\u0001H\u0002J\u001f\u0010º\u0001\u001a\u00030\u009d\u00012\n\u0010»\u0001\u001a\u0005\u0018\u00010¼\u00012\u0007\u0010½\u0001\u001a\u00020\bH\u0002J\n\u0010¾\u0001\u001a\u00030\u009d\u0001H\u0003J\n\u0010¿\u0001\u001a\u00030\u009d\u0001H\u0002J\u0013\u0010À\u0001\u001a\u00030\u009d\u00012\u0007\u0010Á\u0001\u001a\u00020\u0014H\u0002J\n\u0010Â\u0001\u001a\u00030\u009d\u0001H\u0002J\n\u0010Ã\u0001\u001a\u00030\u009d\u0001H\u0002J\u0015\u0010Ä\u0001\u001a\u00030\u009d\u00012\t\u0010Å\u0001\u001a\u0004\u0018\u00010nH\u0002J\n\u0010Æ\u0001\u001a\u00030\u009d\u0001H\u0002J\t\u0010Ç\u0001\u001a\u00020\u0014H\u0002J\u001b\u0010È\u0001\u001a\u00020\u00142\u0007\u0010É\u0001\u001a\u00020#2\u0007\u0010Ê\u0001\u001a\u00020#H\u0002J\n\u0010Ë\u0001\u001a\u00030\u009d\u0001H\u0002J\n\u0010Ì\u0001\u001a\u00030\u009d\u0001H\u0002J\t\u0010Í\u0001\u001a\u00020:H\u0002J\n\u0010Î\u0001\u001a\u00030\u009d\u0001H\u0003J\n\u0010Ï\u0001\u001a\u00030\u009d\u0001H\u0017J\n\u0010Ð\u0001\u001a\u00030\u009d\u0001H\u0016J\n\u0010Ñ\u0001\u001a\u00030\u009d\u0001H\u0003J\u0014\u0010Ò\u0001\u001a\u00030\u009d\u00012\b\u0010Ó\u0001\u001a\u00030Ô\u0001H\u0016J\u0014\u0010Õ\u0001\u001a\u00030\u009d\u00012\b\u0010Ó\u0001\u001a\u00030Ô\u0001H\u0016J\u0016\u0010Ö\u0001\u001a\u00030\u009d\u00012\n\u0010×\u0001\u001a\u0005\u0018\u00010Ø\u0001H\u0014J\n\u0010Ù\u0001\u001a\u00030\u009d\u0001H\u0014J\n\u0010Ú\u0001\u001a\u00030\u009d\u0001H\u0016J\u0014\u0010Û\u0001\u001a\u00030\u009d\u00012\b\u0010Ü\u0001\u001a\u00030Ý\u0001H\u0016J\u0014\u0010Þ\u0001\u001a\u00030\u009d\u00012\b\u0010Ü\u0001\u001a\u00030Ý\u0001H\u0016J\n\u0010ß\u0001\u001a\u00030\u009d\u0001H\u0016J\u0015\u0010à\u0001\u001a\u00030\u009d\u00012\t\u0010Å\u0001\u001a\u0004\u0018\u00010nH\u0015J\u001d\u0010á\u0001\u001a\u00030\u009d\u00012\u0007\u0010â\u0001\u001a\u00020\u00142\b\u0010ã\u0001\u001a\u00030ä\u0001H\u0017J\n\u0010å\u0001\u001a\u00030\u009d\u0001H\u0014J\n\u0010æ\u0001\u001a\u00030\u009d\u0001H\u0014J\n\u0010ç\u0001\u001a\u00030\u009d\u0001H\u0014J\n\u0010è\u0001\u001a\u00030\u009d\u0001H\u0014J\n\u0010é\u0001\u001a\u00030\u009d\u0001H\u0002J\u0014\u0010ê\u0001\u001a\u00030\u009d\u00012\b\u0010ë\u0001\u001a\u00030ì\u0001H\u0002J\u001f\u0010í\u0001\u001a\u00030\u009d\u00012\b\u0010\u009f\u0001\u001a\u00030 \u00012\t\b\u0002\u0010î\u0001\u001a\u00020\u0014H\u0002J\u0014\u0010ï\u0001\u001a\u00030\u009d\u00012\b\u0010\u009f\u0001\u001a\u00030 \u0001H\u0002J\u0014\u0010ð\u0001\u001a\u00030\u009d\u00012\b\u0010\u009f\u0001\u001a\u00030 \u0001H\u0002J\n\u0010ñ\u0001\u001a\u00030\u009d\u0001H\u0002J\n\u0010ò\u0001\u001a\u00030\u009d\u0001H\u0002J\n\u0010ó\u0001\u001a\u00030\u009d\u0001H\u0002J\u0014\u0010ô\u0001\u001a\u00030\u009d\u00012\b\u0010õ\u0001\u001a\u00030ö\u0001H\u0002J\n\u0010÷\u0001\u001a\u00030\u009d\u0001H\u0002J\u0013\u0010ø\u0001\u001a\u00030\u009d\u00012\u0007\u0010ù\u0001\u001a\u00020-H\u0002J\u0013\u0010ú\u0001\u001a\u00030\u009d\u00012\u0007\u0010û\u0001\u001a\u00020\u0014H\u0002J\n\u0010ü\u0001\u001a\u00030\u009d\u0001H\u0002J\n\u0010ý\u0001\u001a\u00030\u009d\u0001H\u0002J\n\u0010þ\u0001\u001a\u00030\u009d\u0001H\u0002J\n\u0010ÿ\u0001\u001a\u00030\u009d\u0001H\u0002J$\u0010\u0080\u0002\u001a\u00030\u009d\u00012\f\u0010t\u001a\b\u0012\u0004\u0012\u00020-0u2\n\u0010\u0081\u0002\u001a\u0005\u0018\u00010\u0082\u0002H\u0002J\u0014\u0010\u0083\u0002\u001a\u00030\u009d\u00012\b\u0010\u009f\u0001\u001a\u00030 \u0001H\u0002J\u0015\u0010\u0084\u0002\u001a\u00030\u009d\u00012\t\b\u0002\u0010\u0085\u0002\u001a\u00020\u0014H\u0002J\u0015\u0010\u0086\u0002\u001a\u00030\u009d\u00012\t\u0010Å\u0001\u001a\u0004\u0018\u00010nH\u0002J\u0015\u0010\u0087\u0002\u001a\u00030\u009d\u00012\t\b\u0002\u0010\u0085\u0002\u001a\u00020\u0014H\u0002J\n\u0010\u0088\u0002\u001a\u00030\u009d\u0001H\u0002J\u0013\u0010\u0089\u0002\u001a\u00030\u009d\u00012\u0007\u0010\u008a\u0002\u001a\u00020-H\u0002J\u0013\u0010\u008b\u0002\u001a\u00030\u009d\u00012\u0007\u0010\u008a\u0002\u001a\u00020-H\u0002J\n\u0010\u008c\u0002\u001a\u00030\u009d\u0001H\u0002J\n\u0010\u008d\u0002\u001a\u00030\u009d\u0001H\u0002J'\u0010\u008e\u0002\u001a\u00030\u009d\u00012\u001b\u0010\u008f\u0002\u001a\u0016\u0012\u0004\u0012\u00020-\u0018\u00010Bj\n\u0012\u0004\u0012\u00020-\u0018\u0001`CH\u0002J\u0016\u0010\u0090\u0002\u001a\u00030\u009d\u00012\n\u0010\u0091\u0002\u001a\u0005\u0018\u00010 \u0001H\u0002J\n\u0010\u0092\u0002\u001a\u00030\u009d\u0001H\u0002J\u0013\u0010\u0092\u0002\u001a\u00030\u009d\u00012\u0007\u0010\u0093\u0002\u001a\u00020-H\u0002J\n\u0010\u0094\u0002\u001a\u00030\u009d\u0001H\u0002J\n\u0010\u0095\u0002\u001a\u00030\u009d\u0001H\u0002J\n\u0010\u0096\u0002\u001a\u00030\u009d\u0001H\u0002J\n\u0010\u0097\u0002\u001a\u00030\u009d\u0001H\u0002J\u0014\u0010\u0098\u0002\u001a\u00030\u009d\u00012\b\u0010\u0099\u0002\u001a\u00030Ô\u0001H\u0002J\u0014\u0010\u009a\u0002\u001a\u00030\u009d\u00012\b\u0010\u0099\u0002\u001a\u00030Ý\u0001H\u0002J\u0013\u0010\u009b\u0002\u001a\u00030\u009d\u00012\u0007\u0010\u0099\u0002\u001a\u00020HH\u0002J\u0011\u0010\u009c\u0002\u001a\u00030\u009d\u00012\u0007\u0010\u0099\u0002\u001a\u00020HJ\n\u0010\u009d\u0002\u001a\u00030\u009d\u0001H\u0002J\n\u0010\u009e\u0002\u001a\u00030\u009d\u0001H\u0002J\n\u0010\u009f\u0002\u001a\u00030\u009d\u0001H\u0002J'\u0010 \u0002\u001a\u00030\u009d\u00012\u0007\u0010¡\u0002\u001a\u00020#2\u0007\u0010¢\u0002\u001a\u00020#2\t\u0010£\u0002\u001a\u0004\u0018\u00010-H\u0002J\u0014\u0010¤\u0002\u001a\u00030\u009d\u00012\b\u0010¥\u0002\u001a\u00030¦\u0002H\u0002J\n\u0010§\u0002\u001a\u00030\u009d\u0001H\u0002J\n\u0010¨\u0002\u001a\u00030\u009d\u0001H\u0002J\n\u0010©\u0002\u001a\u00030\u009d\u0001H\u0002J\n\u0010ª\u0002\u001a\u00030\u009d\u0001H\u0002J(\u0010«\u0002\u001a\u00030\u009d\u00012\b\u0010\u009f\u0001\u001a\u00030 \u00012\u0007\u0010¬\u0002\u001a\u00020\b2\t\b\u0002\u0010\u00ad\u0002\u001a\u00020\u0014H\u0002J\n\u0010®\u0002\u001a\u00030\u009d\u0001H\u0002J\b\u0010¯\u0002\u001a\u00030\u009d\u0001J\n\u0010°\u0002\u001a\u00030\u009d\u0001H\u0002J\u0014\u0010±\u0002\u001a\u00030\u009d\u00012\b\u0010\u009f\u0001\u001a\u00030 \u0001H\u0002J\u0014\u0010²\u0002\u001a\u00030\u009d\u00012\b\u0010\u009f\u0001\u001a\u00030 \u0001H\u0003R\u000e\u0010\u0007\u001a\u00020\bX\u0082D¢\u0006\u0002\n\u0000R\u0010\u0010\t\u001a\u0004\u0018\u00010\nX\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010\u000b\u001a\u0004\u0018\u00010\fX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\r\u0010\u000e\"\u0004\b\u000f\u0010\u0010R\u000e\u0010\u0011\u001a\u00020\u0012X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u0013\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u0015\u001a\u00020\n8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0016\u0010\u0017R\u000e\u0010\u0018\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0019\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010\u001a\u001a\u0004\u0018\u00010\u001bX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u001c\u0010\u001d\"\u0004\b\u001e\u0010\u001fR\u000e\u0010 \u001a\u00020!X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\"\u001a\u00020#X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010$\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010%\u001a\u00020&X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010'\u001a\u0004\u0018\u00010(X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010)\u001a\u0004\u0018\u00010*X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010+\u001a\u00020#X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010,\u001a\u0004\u0018\u00010-X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010.\u001a\u0004\u0018\u00010\u0012X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010/\u001a\u0004\u0018\u000100X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u00101\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u00102\u001a\u00020\u0014X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b3\u00104\"\u0004\b5\u00106R\u0010\u00107\u001a\u0004\u0018\u000108X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u00109\u001a\u0004\u0018\u00010:X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010;\u001a\u0004\u0018\u00010<X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010=\u001a\u00020>X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010?\u001a\u0004\u0018\u00010@X\u0082\u000e¢\u0006\u0002\n\u0000R\u001e\u0010A\u001a\u0012\u0012\u0004\u0012\u00020-0Bj\b\u0012\u0004\u0012\u00020-`CX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010D\u001a\u0004\u0018\u00010EX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010F\u001a\b\u0012\u0004\u0012\u00020H0GX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010I\u001a\b\u0012\u0004\u0012\u00020H0GX\u0082\u0004¢\u0006\u0002\n\u0000R\u001a\u0010J\u001a\u00020\u0014X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\bK\u00104\"\u0004\bL\u00106R\u001a\u0010M\u001a\u00020\u0014X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\bN\u00104\"\u0004\bO\u00106R\u0010\u0010P\u001a\u0004\u0018\u00010:X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010Q\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010R\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010S\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010T\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010U\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010V\u001a\u00020WX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010X\u001a\u0004\u0018\u00010YX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010Z\u001a\u0004\u0018\u00010[X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\\\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010]\u001a\u00020#X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010^\u001a\u0004\u0018\u00010_X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010`\u001a\u0004\u0018\u00010aX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010b\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010c\u001a\u0004\u0018\u00010:X\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010d\u001a\u00020-X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\be\u0010f\"\u0004\bg\u0010hR\u0010\u0010i\u001a\u0004\u0018\u00010jX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010k\u001a\u0004\u0018\u00010lX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010m\u001a\u0004\u0018\u00010nX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010o\u001a\u0004\u0018\u00010nX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010p\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010q\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010r\u001a\u0004\u0018\u00010sX\u0082\u000e¢\u0006\u0002\n\u0000R\u0017\u0010t\u001a\b\u0012\u0004\u0012\u00020-0u¢\u0006\b\n\u0000\u001a\u0004\bv\u0010wR\u0010\u0010x\u001a\u0004\u0018\u00010:X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010y\u001a\u00020zX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010{\u001a\u00020-X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010|\u001a\u0004\u0018\u00010}X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010~\u001a\u0004\u0018\u00010\u007fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000f\u0010\u0080\u0001\u001a\u00020-X\u0082\u000e¢\u0006\u0002\n\u0000R$\u0010\u0081\u0001\u001a\u00030\u0082\u00018\u0006@\u0006X\u0087.¢\u0006\u0012\n\u0000\u001a\u0006\b\u0083\u0001\u0010\u0084\u0001\"\u0006\b\u0085\u0001\u0010\u0086\u0001R\u000f\u0010\u0087\u0001\u001a\u00020zX\u0082\u000e¢\u0006\u0002\n\u0000R\u000f\u0010\u0088\u0001\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u000f\u0010\u0089\u0001\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u000f\u0010\u008a\u0001\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\"\u0010\u008b\u0001\u001a\u0005\u0018\u00010\u008c\u0001X\u0086\u000e¢\u0006\u0012\n\u0000\u001a\u0006\b\u008d\u0001\u0010\u008e\u0001\"\u0006\b\u008f\u0001\u0010\u0090\u0001R\u0012\u0010\u0091\u0001\u001a\u0005\u0018\u00010\u0092\u0001X\u0082\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\u0093\u0001\u001a\u0005\u0018\u00010\u0094\u0001X\u0082\u000e¢\u0006\u0002\n\u0000R!\u0010\u0095\u0001\u001a\u00030\u0096\u00018BX\u0082\u0084\u0002¢\u0006\u0010\n\u0006\b\u0099\u0001\u0010\u009a\u0001\u001a\u0006\b\u0097\u0001\u0010\u0098\u0001R\u000f\u0010\u009b\u0001\u001a\u00020-X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006¶\u0002"}, d2 = {"Lapp/callpe/ui/livestreaming/LiveStreamingActivity;", "Lapp/callpe/ui/livestreaming/BaseLiveStreamingActivity;", "Lapp/callpe/ui/livestreaming/bottomsheet/LiveStreamMessageOptionsSheet$BottomSheetDialogListener;", "Lapp/callpe/ui/livestreaming/bottomsheet/FollowAndLeaveBottomSheet$BottomSheetDialogListener;", "Lapp/callpe/ui/livestreaming/bottomsheet/CohostRequestBottomSheet$BottomSheetDialogListener;", "Lapp/callpe/ui/livestreaming/bottomsheet/GameRequestDialog$RequestDialogListener;", "()V", "LIVESTREAM_LOCKED_DIALOG_THRESHOLD", "", "_binding", "Lapp/callpe/databinding/ActivityLiveStreamingBinding;", "adapter", "Lapp/callpe/adapters/LiveStreamMessageAdapter;", "getAdapter", "()Lapp/callpe/adapters/LiveStreamMessageAdapter;", "setAdapter", "(Lapp/callpe/adapters/LiveStreamMessageAdapter;)V", "alertDialog", "Landroid/app/Dialog;", "bigAnimation", "", "binding", "getBinding", "()Lapp/callpe/databinding/ActivityLiveStreamingBinding;", "blockCurrentUserLivestreamMessages", "blockLivestreamUnpaidUserMessage", "bottomSheet", "Lapp/callpe/ui/bottomsheet/CallSheet;", "getBottomSheet", "()Lapp/callpe/ui/bottomsheet/CallSheet;", "setBottomSheet", "(Lapp/callpe/ui/bottomsheet/CallSheet;)V", "broadcastReceiver", "Landroid/content/BroadcastReceiver;", "callPingDuration", "", "chatHeightAlreadySet", "chatRvParentState", "Lapp/callpe/ui/livestreaming/LiveStreamingActivity$ChatRvState;", "cohostBottomSheet", "Lapp/callpe/ui/bottomsheet/CohostCallSheet;", "cohostRequestBottomSheet", "Lapp/callpe/ui/livestreaming/bottomsheet/CohostRequestBottomSheet;", "currentCoHostId", "currentStatus", "", "dialog", "disposable", "Lio/reactivex/disposables/Disposable;", "firstRecharge", "firstRechargeDone", "getFirstRechargeDone", "()Z", "setFirstRechargeDone", "(Z)V", "followAndLeaveBottomSheet", "Lapp/callpe/ui/livestreaming/bottomsheet/FollowAndLeaveBottomSheet;", "followDialogJob", "Lkotlinx/coroutines/Job;", "gameRequestDialog", "Lapp/callpe/ui/livestreaming/bottomsheet/GameRequestDialog;", "gameViewModel", "Lcom/vdx/sud/SudGameViewModel;", "gamesBottomSheet", "Lapp/callpe/ui/user/games/bottomsheet/GamesBottomSheet;", "gamesList", "Ljava/util/ArrayList;", "Lkotlin/collections/ArrayList;", "giftAnimationAdapter", "Lapp/callpe/adapters/LiveStreamGiftAnimationAdapter;", "giftAnimationQueue", "Ljava/util/Queue;", "Lapp/callpe/data/model/GiftRequestModel;", "giftReceivedQueue", "hideCallRate", "getHideCallRate", "setHideCallRate", "hideStreamerCallRate", "getHideStreamerCallRate", "setHideStreamerCallRate", "imageUploadJob", "isCohostEnabled", "isCohostServiceRunning", "isLivestreamLocked", "isPopUpShown", "isSplitScreenActive", "job", "Lkotlinx/coroutines/CompletableJob;", "liveCoverAdapter", "Lapp/callpe/adapters/LiveCoverAdapter;", "liveCoverRecyclerView", "Lapp/callpe/common/utils/custom/NoScrollRecyclerView;", "liveKitSdkinitialized", "liveStreamId", "liveStreamOptionsSheet", "Lapp/callpe/ui/livestreaming/bottomsheet/LiveStreamMessageOptionsSheet;", "liveStreamingService", "Lapp/callpe/service/LiveStreamingService;", "liveWatchedFor60Seconds", "livestreamLockJob", "localUserId", "getLocalUserId", "()Ljava/lang/String;", "setLocalUserId", "(Ljava/lang/String;)V", "mCoHostPreviewLayout", "Lapp/callpe/rtc/components/RemoteRtcVideoView;", "mPreviewLayout", "Lapp/callpe/rtc/components/LocalRtcVideoView;", "mServiceIntent", "Landroid/content/Intent;", "mUserCohostServiceIntent", "mobileNumberVerified", "moderating", "pagerSnapHelper", "Lapp/callpe/common/utils/custom/CustomPagerSnapHelper;", NativeProtocol.RESULT_ARGS_PERMISSIONS, "", "getPermissions", "()Ljava/util/List;", "reconnectionJob", "reconnectionScope", "Lkotlinx/coroutines/CoroutineScope;", "roomId", "rtcEventHandler", "Lapp/module/common/rtcmanager/handlers/RtcEventHandler;", "rtcManager", "Lapp/module/common/rtcmanager/RtcManager;", "rtcProvider", "rxBus", "Lapp/callpe/common/utils/RxBus;", "getRxBus", "()Lapp/callpe/common/utils/RxBus;", "setRxBus", "(Lapp/callpe/common/utils/RxBus;)V", "scope", "showGames", "soundAlreadyPublishing", "sudGameAlreadyStarted", "timer", "Landroid/os/CountDownTimer;", "getTimer", "()Landroid/os/CountDownTimer;", "setTimer", "(Landroid/os/CountDownTimer;)V", "userCohostService", "Lapp/callpe/service/UserCohostService;", "verifyNumberFragment", "Lapp/callpe/ui/bottomsheet/VerifyNumberSheet;", "viewModel", "Lapp/callpe/ui/livestreaming/LiveStreamViewModel;", "getViewModel", "()Lapp/callpe/ui/livestreaming/LiveStreamViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "zegoToken", "addGitAnimatedItem", "", "addMessageItems", "liveStreamModel", "Lapp/callpe/data/model/LiveStreamModel;", "addToGiftAnimationQueue", "giftModel", "addToGiftQueue", "adjustHostViewSize", "widthDp", "heightDp", "adjustLudoGameAndHostViewSplit", "ludoGameHeightRatio", "", "adjustLudoGameViewSize", "heightRatio", "checkForTimeLeftWithUser", "secondsLeft", "duration", "checkForUserSoundPublish", "destroyItems", "destroyAll", "singOutSuccess", "Lkotlin/Function0;", "enableMicrophone", "enableMic", "enablePip", "finish", "finishCoHost", "handleKickedAndBannedUsers", "handleLivestreamLockedCase", "livestreamConfig", "Lapp/callpe/data/model/LivestreamConfig;", "freeChatDays", "handleLivestreamScreenSwipes", "handleLudoGameBtnVisibility", "handlePipModel", "inPictureInPictureMode", "initAndSignInZEGOSDK", "initUI", "initValues", "intent", "initVideo", "isLastVisible", "isSameDay", "time1", "time2", "listenRtcEvents", "loginInRoom", "observeEvent", "observeKeyboardVisibility", "onBackPressed", "onBottomSheetDismissed", "onClicks", "onCohostRequestAccepted", "cohostRequestModel", "Lapp/callpe/data/model/CohostRequestModel;", "onCohostRequestRejected", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "onFollowAndLeaveClicked", "onGameRequestAccepted", "requestModel", "Lapp/callpe/data/model/VideoCallGameRequestModel;", "onGameRequestRejected", "onLeaveClicked", "onNewIntent", "onPictureInPictureModeChanged", "isInPictureInPictureMode", "newConfig", "Landroid/content/res/Configuration;", "onResume", "onStart", "onStop", "onUserLeaveHint", "openAudienceBottomSheet", "openCallSheet", "streamer", "Lapp/callpe/data/model/StreamerModel;", "openCoHostCallSheet", "forLudo", "openCoHostMoreOption", "openFollowAndLeaveBottomSheet", "openGamesBottomSheet", "openGiftBottomSheet", "openKeyboard", "openStreamerOptionsMenu", "host", "Lapp/callpe/data/model/LiveStreamMessageModel;", "openVerifyNumberBottomSheet", "pauseLayout", "profile", "reconnectingBox", "reconnecting", "refresh", "registerReceiver", "reinitializeStream", "removeTaskFromRecents", "requestPermissionIfNeeded", "requestCallback", "Lcom/permissionx/guolindev/callback/RequestCallback;", "resetChatRvHeight", "resetHostViewToFullScreen", "stopAnim", "resetStreamer", "resetViewsToDefault", "retrieveSharedPrefValues", "sendBroadcastInfo", NativeProtocol.WEB_DIALOG_ACTION, "sendCohostBroadcastInfo", "serverIsNotWorking", "serverIsWorking", "setGameList", "activeGames", "setProfileValues", "liveStreamDetails", "setSdkName", "sdkName", "setStreamerUI", "setUpGameLottieAnimation", "setUpLiveChatRV", "setupLocalPreview", "showCohostRequestPopup", "model", "showGameRequestPopup", "showGiftReceivedDialog", "showGiftRequestDialog", "showLowBalancePopup", "starServiceFunc", "startCostServiceFunc", "startImageUploadLoop", "streamId", "egressFrequency", "source", "startSudGame", "streamerUserLivestreamGame", "Lapp/callpe/data/model/StreamerUserLivestreamGame;", "stopCohostServiceFunc", "stopImageUploadLoop", "stopPublishScreen", "stopServiceFunc", "switchStreamer", "position", "liveEnded", "touchEventClicked", "translateLivestreamLayoutToRight", "unRegisterReceiver", "updateCohostUi", "updateValues", "ChatRvState", "Companion", "LivestreamLockingStrategy", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class LiveStreamingActivity extends Hilt_LiveStreamingActivity implements LiveStreamMessageOptionsSheet.BottomSheetDialogListener, FollowAndLeaveBottomSheet.BottomSheetDialogListener, CohostRequestBottomSheet.BottomSheetDialogListener, GameRequestDialog.RequestDialogListener {
public static final String COHOST_END = "COHOST_END";
public static final String COHOST_ID = "COHOST_ID";
public static final String COHOST_JOIN_REQUEST = "COHOST_JOIN_REQUEST";
public static final String COHOST_REQUEST_ACCEPT = "COHOST_REQUEST_ACCEPT";
public static final String COHOST_REQUEST_REJECT = "COHOST_REQUEST_REJECT";
public static final Companion INSTANCE = new Companion(null);
public static final String FROM_LIVE_SCREEN = "FROM_LIVE_SCREEN";
public static final String GIFT_RECEIVE_LIVESTREAM = "GIFT_RECEIVE_LIVESTREAM";
public static final String LIVE_STREAM_ID = "LIVE_STREAM_ID";
public static final String LIVE_STREAM_MODEL = "LIVE_STREAM_MODEL";
public static final long RECONNECT_DELAY = 15000;
public static final String ROOM_ID = "ROOM_ID";
public static final String RTC_PROVIDER = "RTC_PROVIDER";
public static final String ZEGO_TOKEN = "ZegoToken";
private static boolean isLiveStreamScreenOpen;
private ActivityLiveStreamingBinding _binding;
private LiveStreamMessageAdapter adapter;
private Dialog alertDialog;
private boolean bigAnimation;
private boolean blockCurrentUserLivestreamMessages;
private boolean blockLivestreamUnpaidUserMessage;
private CallSheet bottomSheet;
private boolean chatHeightAlreadySet;
private CohostCallSheet cohostBottomSheet;
private CohostRequestBottomSheet cohostRequestBottomSheet;
private String currentStatus;
private Dialog dialog;
private Disposable disposable;
private boolean firstRecharge;
private boolean firstRechargeDone;
private FollowAndLeaveBottomSheet followAndLeaveBottomSheet;
private Job followDialogJob;
private GameRequestDialog gameRequestDialog;
private GamesBottomSheet gamesBottomSheet;
private LiveStreamGiftAnimationAdapter giftAnimationAdapter;
private boolean hideCallRate;
private boolean hideStreamerCallRate;
private Job imageUploadJob;
private boolean isCohostEnabled;
private boolean isCohostServiceRunning;
private boolean isLivestreamLocked;
private boolean isPopUpShown;
private boolean isSplitScreenActive;
private LiveCoverAdapter liveCoverAdapter;
private NoScrollRecyclerView liveCoverRecyclerView;
private boolean liveKitSdkinitialized;
private LiveStreamMessageOptionsSheet liveStreamOptionsSheet;
private LiveStreamingService liveStreamingService;
private boolean liveWatchedFor60Seconds;
private Job livestreamLockJob;
private RemoteRtcVideoView mCoHostPreviewLayout;
private LocalRtcVideoView mPreviewLayout;
private Intent mServiceIntent;
private Intent mUserCohostServiceIntent;
private boolean mobileNumberVerified;
private boolean moderating;
private CustomPagerSnapHelper pagerSnapHelper;
private Job reconnectionJob;
private RtcEventHandler rtcEventHandler;
private RtcManager rtcManager;
@Inject
public RxBus rxBus;
private boolean showGames;
private boolean soundAlreadyPublishing;
private boolean sudGameAlreadyStarted;
private CountDownTimer timer;
private UserCohostService userCohostService;
private VerifyNumberSheet verifyNumberFragment;
private final Lazy viewModel;
private String zegoToken = "";
private String roomId = "";
private String rtcProvider = "ZEGO";
private long liveStreamId = -1;
private long callPingDuration = 2;
private CompletableJob job = SupervisorKt.SupervisorJob$default((Job) null, 1, (Object) null);
private CoroutineScope scope = CoroutineScopeKt.CoroutineScope(Dispatchers.getMain().plus(this.job));
private final Queue<GiftRequestModel> giftReceivedQueue = new LinkedList();
private final Queue<GiftRequestModel> giftAnimationQueue = new LinkedList();
private final List<String> permissions = CollectionsKt.listOf(new String[]{"android.permission.CAMERA", "android.permission.RECORD_AUDIO"});
private final CoroutineScope reconnectionScope = CoroutineScopeKt.CoroutineScope(Dispatchers.getMain());
private ArrayList<String> gamesList = new ArrayList<>();
private String localUserId = "";
private final int LIVESTREAM_LOCKED_DIALOG_THRESHOLD = 10;
private ChatRvState chatRvParentState = ChatRvState.VISIBLE;
private long currentCoHostId = -1;
private final SudGameViewModel gameViewModel = new SudGameViewModel();
private final BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String stringExtra;
LiveStreamViewModel viewModel;
LiveStreamViewModel viewModel2;
LiveStreamViewModel viewModel3;
ActivityLiveStreamingBinding binding;
ActivityLiveStreamingBinding binding2;
ActivityLiveStreamingBinding binding3;
ActivityLiveStreamingBinding binding4;
RemoteRtcVideoView remoteRtcVideoView;
RtcManager rtcManager;
NoScrollRecyclerView noScrollRecyclerView;
LiveStreamViewModel viewModel4;
String stringExtra2;
String stringExtra3;
String stringExtra4;
LiveStreamViewModel viewModel5;
String stringExtra5;
long j;
String stringExtra6;
LiveStreamViewModel viewModel6;
LiveStreamViewModel viewModel7;
LiveStreamViewModel viewModel8;
LiveStreamViewModel viewModel9;
ActivityLiveStreamingBinding binding5;
ActivityLiveStreamingBinding binding6;
ActivityLiveStreamingBinding binding7;
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(intent, "intent");
Timber.e("Action %s", new Object[]{intent.getAction()});
String action = intent.getAction();
if (action != null) {
switch (action.hashCode()) {
case -2075034971:
if (action.equals(LiveStreamingActivity.COHOST_JOIN_REQUEST) && LiveStreamingActivity.this.getIsStreamer() && (stringExtra = intent.getStringExtra("cohost")) != null) {
LiveStreamingActivity liveStreamingActivity = LiveStreamingActivity.this;
CohostRequestModel cohostRequestModel = (CohostRequestModel) new Gson().fromJson(stringExtra, CohostRequestModel.class);
if (cohostRequestModel != null) {
viewModel = liveStreamingActivity.getViewModel();
viewModel.setCohostRequestModel(cohostRequestModel);
long livestreamId = cohostRequestModel.getLivestreamId();
viewModel2 = liveStreamingActivity.getViewModel();
if (livestreamId == viewModel2.getLiveStreamId()) {
liveStreamingActivity.showCohostRequestPopup(cohostRequestModel);
break;
}
}
}
break;
case -1171537894:
if (action.equals(Constants.LIVESTREAM_KILL_SCREEN)) {
viewModel3 = LiveStreamingActivity.this.getViewModel();
LiveStreamViewModel.endStream$default(viewModel3, LiveStreamingActivity.this.getIsStreamer(), false, 0L, null, 14, null);
LiveStreamingActivity.this.finish();
break;
}
break;
case -853151216:
if (action.equals(LiveStreamingActivity.COHOST_END) && !LiveStreamingActivity.this.getIsStreamer()) {
intent.getStringExtra("cohost");
binding = LiveStreamingActivity.this.getBinding();
LinearLayout linearLayout = binding.cohostProfileParent;
Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.cohostProfileParent");
linearLayout.setVisibility(8);
binding2 = LiveStreamingActivity.this.getBinding();
AppCompatTextView appCompatTextView = binding2.cohostingTimeWithGame;
Intrinsics.checkNotNullExpressionValue(appCompatTextView, "binding.cohostingTimeWithGame");
((View) appCompatTextView).setVisibility(8);
ActivityExtKt.toast((Activity) LiveStreamingActivity.this, "Co-host ended!");
binding3 = LiveStreamingActivity.this.getBinding();
LinearLayout linearLayout2 = binding3.applyToCohost;
Intrinsics.checkNotNullExpressionValue(linearLayout2, "binding.applyToCohost");
linearLayout2.setVisibility(0);
binding4 = LiveStreamingActivity.this.getBinding();
LinearLayout linearLayout3 = binding4.endCohostUser;
Intrinsics.checkNotNullExpressionValue(linearLayout3, "binding.endCohostUser");
linearLayout3.setVisibility(8);
remoteRtcVideoView = LiveStreamingActivity.this.mCoHostPreviewLayout;
if (remoteRtcVideoView != null) {
remoteRtcVideoView.stopAudioVideo();
}
rtcManager = LiveStreamingActivity.this.rtcManager;
if (rtcManager != null) {
rtcManager.openMicrophone(false);
}
noScrollRecyclerView = LiveStreamingActivity.this.liveCoverRecyclerView;
if (noScrollRecyclerView != null) {
noScrollRecyclerView.setScrollEnabled(true);
}
viewModel4 = LiveStreamingActivity.this.getViewModel();
viewModel4.getUserBalance();
LiveStreamingActivity.this.stopCohostServiceFunc();
LiveStreamingActivity.this.getRxBus().send(new CohostEvent(CohostEventType.ENDED, null, 2, null));
break;
}
break;
case 31643316:
if (action.equals(Constants.GIFT_RECEIVE) && LiveStreamingActivity.this.getIsStreamer() && (stringExtra2 = intent.getStringExtra("gift")) != null) {
LiveStreamingActivity liveStreamingActivity2 = LiveStreamingActivity.this;
GiftRequestModel giftRequestModel = (GiftRequestModel) new Gson().fromJson(stringExtra2, GiftRequestModel.class);
if (giftRequestModel != null) {
liveStreamingActivity2.addToGiftQueue(giftRequestModel);
break;
}
}
break;
case 45045344:
if (action.equals(Constants.GIFT_REQUEST) && !LiveStreamingActivity.this.getIsStreamer() && (stringExtra3 = intent.getStringExtra("gift")) != null) {
LiveStreamingActivity liveStreamingActivity3 = LiveStreamingActivity.this;
GiftRequestModel giftRequestModel2 = (GiftRequestModel) new Gson().fromJson(stringExtra3, GiftRequestModel.class);
if (giftRequestModel2 != null) {
liveStreamingActivity3.showGiftRequestDialog(giftRequestModel2);
break;
}
}
break;
case 240030167:
if (action.equals(LiveStreamingActivity.GIFT_RECEIVE_LIVESTREAM) && !LiveStreamingActivity.this.getIsStreamer() && (stringExtra4 = intent.getStringExtra("gift")) != null) {
LiveStreamingActivity liveStreamingActivity4 = LiveStreamingActivity.this;
GiftRequestModel giftRequestModel3 = (GiftRequestModel) new Gson().fromJson(stringExtra4, GiftRequestModel.class);
if (giftRequestModel3 != null) {
Long livestreamId2 = giftRequestModel3.getLivestreamId();
long longValue = livestreamId2 != null ? livestreamId2.longValue() : -1L;
viewModel5 = liveStreamingActivity4.getViewModel();
if (longValue == viewModel5.getLiveStreamId()) {
liveStreamingActivity4.addToGiftAnimationQueue(giftRequestModel3);
break;
}
}
}
break;
case 758149221:
if (action.equals(ZegoVideoCallActivity.STREAMER_USER_GAME_JOIN_REQUEST) && LiveStreamingActivity.this.getIsStreamer() && (stringExtra5 = intent.getStringExtra("ludo_game")) != null) {
LiveStreamingActivity liveStreamingActivity5 = LiveStreamingActivity.this;
VideoCallGameRequestModel videoCallGameRequestModel = (VideoCallGameRequestModel) new Gson().fromJson(stringExtra5, VideoCallGameRequestModel.class);
if (videoCallGameRequestModel != null) {
long entityId = videoCallGameRequestModel.getEntityId();
j = liveStreamingActivity5.liveStreamId;
if (entityId == j) {
liveStreamingActivity5.showGameRequestPopup(videoCallGameRequestModel);
break;
}
}
}
break;
case 1304905251:
if (action.equals(ZegoVideoCallActivity.STREAMER_USER_GAME_REQUEST_ACCEPT) && !LiveStreamingActivity.this.getIsStreamer()) {
ActivityExtKt.toast((Activity) LiveStreamingActivity.this, "Ludo request accepted");
break;
}
break;
case 1624162403:
if (action.equals(LiveStreamingActivity.COHOST_REQUEST_ACCEPT) && !LiveStreamingActivity.this.getIsStreamer() && (stringExtra6 = intent.getStringExtra("cohost")) != null) {
LiveStreamingActivity liveStreamingActivity6 = LiveStreamingActivity.this;
CohostRequestModel cohostRequestModel2 = (CohostRequestModel) new Gson().fromJson(stringExtra6, CohostRequestModel.class);
if (cohostRequestModel2 != null) {
viewModel6 = liveStreamingActivity6.getViewModel();
viewModel6.setCohostRequestModel(cohostRequestModel2);
long livestreamId3 = cohostRequestModel2.getLivestreamId();
viewModel7 = liveStreamingActivity6.getViewModel();
if (livestreamId3 == viewModel7.getLiveStreamId()) {
viewModel8 = liveStreamingActivity6.getViewModel();
long cohostId = cohostRequestModel2.getCohostId();
viewModel9 = liveStreamingActivity6.getViewModel();
viewModel8.joinAsCohost(cohostId, viewModel9.getCurrentPosition());
break;
}
}
}
break;
case 1793655994:
if (action.equals(ZegoVideoCallActivity.STREAMER_USER_GAME_REQUEST_REJECT) && !LiveStreamingActivity.this.getIsStreamer()) {
ActivityExtKt.toast((Activity) LiveStreamingActivity.this, "Ludo request rejected");
break;
}
break;
case 2112913146:
if (action.equals(LiveStreamingActivity.COHOST_REQUEST_REJECT) && !LiveStreamingActivity.this.getIsStreamer()) {
intent.getStringExtra("cohost");
binding5 = LiveStreamingActivity.this.getBinding();
AppCompatImageView appCompatImageView = binding5.cohostConnectAnimView;
Intrinsics.checkNotNullExpressionValue(appCompatImageView, "binding.cohostConnectAnimView");
((View) appCompatImageView).setVisibility(8);
binding6 = LiveStreamingActivity.this.getBinding();
ImageView imageView = binding6.cohostIc;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.cohostIc");
imageView.setVisibility(0);
binding7 = LiveStreamingActivity.this.getBinding();
LinearLayout linearLayout4 = binding7.cohostProfileParent;
Intrinsics.checkNotNullExpressionValue(linearLayout4, "binding.cohostProfileParent");
linearLayout4.setVisibility(8);
ActivityExtKt.toast((Activity) LiveStreamingActivity.this, "Streamer rejected your Co-host request");
break;
}
break;
}
}
}
};
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0004\b\u0086\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002j\u0002\b\u0003j\u0002\b\u0004¨\u0006\u0005"}, d2 = {"Lapp/callpe/ui/livestreaming/LiveStreamingActivity$ChatRvState;", "", "(Ljava/lang/String;I)V", "INVISIBLE", "VISIBLE", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public enum ChatRvState {
INVISIBLE,
VISIBLE
}
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0005\b\u0086\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002j\u0002\b\u0003j\u0002\b\u0004j\u0002\b\u0005¨\u0006\u0006"}, d2 = {"Lapp/callpe/ui/livestreaming/LiveStreamingActivity$LivestreamLockingStrategy;", "", "(Ljava/lang/String;I)V", "HARD", "SOFT", "NONE", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public enum LivestreamLockingStrategy {
HARD,
SOFT,
NONE
}
public void onBackPressed() {
}
@Override
public void onBottomSheetDismissed() {
}
public LiveStreamingActivity() {
final Function0 function0 = null;
final ComponentActivity componentActivity = (ComponentActivity) this;
this.viewModel = new ViewModelLazy(Reflection.getOrCreateKotlinClass(LiveStreamViewModel.class), new Function0<ViewModelStore>() {
{
super(0);
}
public final ViewModelStore m1829invoke() {
return componentActivity.getViewModelStore();
}
}, new Function0<ViewModelProvider.Factory>() {
{
super(0);
}
public final ViewModelProvider.Factory m1828invoke() {
return componentActivity.getDefaultViewModelProviderFactory();
}
}, new Function0<CreationExtras>() {
{
super(0);
}
public final CreationExtras m1830invoke() {
CreationExtras creationExtras;
Function0 function02 = function0;
return (function02 == null || (creationExtras = (CreationExtras) function02.invoke()) == null) ? componentActivity.getDefaultViewModelCreationExtras() : creationExtras;
}
});
}
public final ActivityLiveStreamingBinding getBinding() {
ActivityLiveStreamingBinding activityLiveStreamingBinding = this._binding;
Intrinsics.checkNotNull(activityLiveStreamingBinding);
return activityLiveStreamingBinding;
}
public final RxBus getRxBus() {
RxBus rxBus = this.rxBus;
if (rxBus != null) {
return rxBus;
}
Intrinsics.throwUninitializedPropertyAccessException("rxBus");
return null;
}
public final void setRxBus(RxBus rxBus) {
Intrinsics.checkNotNullParameter(rxBus, "<set-?>");
this.rxBus = rxBus;
}
public final LiveStreamMessageAdapter getAdapter() {
return this.adapter;
}
public final void setAdapter(LiveStreamMessageAdapter liveStreamMessageAdapter) {
this.adapter = liveStreamMessageAdapter;
}
public final CountDownTimer getTimer() {
return this.timer;
}
public final void setTimer(CountDownTimer countDownTimer) {
this.timer = countDownTimer;
}
public final List<String> getPermissions() {
return this.permissions;
}
public final LiveStreamViewModel getViewModel() {
return (LiveStreamViewModel) this.viewModel.getValue();
}
public final boolean getFirstRechargeDone() {
return this.firstRechargeDone;
}
public final void setFirstRechargeDone(boolean z) {
this.firstRechargeDone = z;
}
public final boolean getHideCallRate() {
return this.hideCallRate;
}
public final void setHideCallRate(boolean z) {
this.hideCallRate = z;
}
public final boolean getHideStreamerCallRate() {
return this.hideStreamerCallRate;
}
public final void setHideStreamerCallRate(boolean z) {
this.hideStreamerCallRate = z;
}
public final String getLocalUserId() {
return this.localUserId;
}
public final void setLocalUserId(String str) {
Intrinsics.checkNotNullParameter(str, "<set-?>");
this.localUserId = str;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
isLiveStreamScreenOpen = true;
this._binding = ActivityLiveStreamingBinding.inflate(getLayoutInflater());
setContentView((View) getBinding().getRoot());
this.localUserId = getViewModel().getAccountId();
setSdkName();
listenRtcEvents();
RtcManager currentRtcInstance = RtcManagerFactory.getCurrentRtcInstance();
this.rtcManager = currentRtcInstance;
if (currentRtcInstance != null) {
currentRtcInstance.setEventHandler(this.rtcEventHandler);
}
setStreamerUI();
setUpGameLottieAnimation();
retrieveSharedPrefValues();
initUI();
observeEvent();
initValues(getIntent());
onClicks();
setUpLiveChatRV();
handleKickedAndBannedUsers();
observeKeyboardVisibility();
handleLivestreamScreenSwipes();
Timber.d("Method called - onCreate", new Object[0]);
}
private final void setSdkName() {
RemoteRtcVideoView remoteRtcVideoView;
LocalRtcVideoView localRtcVideoView;
Intent intent = getIntent();
if (intent != null) {
getViewModel().setCurrentSDK(String.valueOf(intent.getStringExtra("RTC_PROVIDER")));
}
ActivityLiveStreamingBinding activityLiveStreamingBinding = this._binding;
if (activityLiveStreamingBinding != null && (localRtcVideoView = activityLiveStreamingBinding.hostView) != null) {
localRtcVideoView.setCurrentSDK(getViewModel().getCurrentSDK());
}
ActivityLiveStreamingBinding activityLiveStreamingBinding2 = this._binding;
if (activityLiveStreamingBinding2 == null || (remoteRtcVideoView = activityLiveStreamingBinding2.coHostView) == null) {
return;
}
remoteRtcVideoView.setCurrentSDK(getViewModel().getCurrentSDK());
}
private final void setSdkName(String sdkName) {
RemoteRtcVideoView remoteRtcVideoView;
LocalRtcVideoView localRtcVideoView;
getViewModel().setCurrentSDK(sdkName);
ActivityLiveStreamingBinding activityLiveStreamingBinding = this._binding;
if (activityLiveStreamingBinding != null && (localRtcVideoView = activityLiveStreamingBinding.hostView) != null) {
localRtcVideoView.setCurrentSDK(getViewModel().getCurrentSDK());
}
ActivityLiveStreamingBinding activityLiveStreamingBinding2 = this._binding;
if (activityLiveStreamingBinding2 == null || (remoteRtcVideoView = activityLiveStreamingBinding2.coHostView) == null) {
return;
}
remoteRtcVideoView.setCurrentSDK(getViewModel().getCurrentSDK());
}
private final void setStreamerUI() {
if (getIsStreamer()) {
getBinding().messageText.setText("Say hi.. ");
try {
int dimensionPixelSize = getResources().getDimensionPixelSize(2131166329);
ViewGroup.LayoutParams layoutParams = getBinding().chatRV.getLayoutParams();
layoutParams.height = dimensionPixelSize;
getBinding().chatRV.setLayoutParams(layoutParams);
getBinding().chatRV.requestLayout();
} catch (Exception e) {
Timber.e(e.toString(), new Object[0]);
}
}
if (getIsStreamer()) {
try {
ConstraintLayout constraintLayout = getBinding().swipeContentLayout;
Intrinsics.checkNotNullExpressionValue(constraintLayout, "binding.swipeContentLayout");
LinearLayout linearLayout = getBinding().linearLayout22;
Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.linearLayout22");
LinearLayout linearLayout2 = getBinding().cohostLL;
Intrinsics.checkNotNullExpressionValue(linearLayout2, "binding.cohostLL");
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(constraintLayout);
constraintSet.connect(linearLayout2.getId(), 3, linearLayout.getId(), 4);
constraintSet.setMargin(linearLayout2.getId(), 3, 0);
constraintSet.applyTo(constraintLayout);
linearLayout2.setGravity(8388611);
} catch (Exception e2) {
Timber.e(e2.toString(), new Object[0]);
}
}
}
private final void setUpGameLottieAnimation() {
getBinding().gameLottie.setMinFrame(0);
getBinding().gameLottie.setMaxFrame(125);
getBinding().gameLottie.playAnimation();
getBinding().swipeGuideAnim.setMinFrame(100);
getBinding().swipeGuideAnim.setMaxFrame(300);
getBinding().swipeGuideAnim.playAnimation();
}
private final void retrieveSharedPrefValues() {
Context context = (Context) this;
this.mobileNumberVerified = SharedPref.getBoolean(context, PrefKeys.MOBILE_NUMBER_VERIFIED);
this.showGames = SharedPref.getBoolean(context, PrefKeys.SHOW_GAMES);
this.firstRechargeDone = SharedPref.getBoolean(context, PrefKeys.FIRST_RECHARGE_DONE);
boolean z = SharedPref.getBoolean(context, PrefKeys.HIDE_CALL_RATE);
this.hideCallRate = z;
this.hideStreamerCallRate = z;
boolean z2 = SharedPref.getBoolean(context, PrefKeys.BLOCK_LIVESTREAM_UNPAID_USER_MESSAGE);
this.blockLivestreamUnpaidUserMessage = z2;
this.blockCurrentUserLivestreamMessages = z2 && !this.firstRechargeDone;
this.isCohostEnabled = getIsStreamer() ? true : SharedPref.getBoolean(context, PrefKeys.IS_COHOST_ENABLED);
}
private final void handleLivestreamScreenSwipes() {
try {
getBinding().topLayout.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view, MotionEvent motionEvent) {
boolean handleLivestreamScreenSwipes$lambda$1;
handleLivestreamScreenSwipes$lambda$1 = LiveStreamingActivity.handleLivestreamScreenSwipes$lambda$1(LiveStreamingActivity.this, view, motionEvent);
return handleLivestreamScreenSwipes$lambda$1;
}
});
getBinding().overlapingLayout.setSwipeListener(new OverlappingPanelsLayout.OnSwipeListener() {
@Override
public void onSwipe(OverlappingPanelsLayout.SwipeDirection direction) {
Intrinsics.checkNotNullParameter(direction, "direction");
if (direction == OverlappingPanelsLayout.SwipeDirection.LEFT) {
LiveStreamingActivity.this.touchEventClicked();
}
}
});
} catch (Exception e) {
Timber.e(e);
}
}
public static final boolean handleLivestreamScreenSwipes$lambda$1(LiveStreamingActivity liveStreamingActivity, View view, MotionEvent motionEvent) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
if (motionEvent.getAction() != 0) {
return false;
}
if (!liveStreamingActivity.getViewModel().getFaceUnityViewVisible()) {
return true;
}
liveStreamingActivity.getViewModel().setFaceUnityViewVisible(false);
View view2 = liveStreamingActivity.getBinding().faceUnityView;
Intrinsics.checkNotNullExpressionValue(view2, "binding.faceUnityView");
view2.setVisibility(8);
return true;
}
public final void touchEventClicked() {
if (this._binding == null) {
return;
}
EditText editText = getBinding().messageEt;
Intrinsics.checkNotNullExpressionValue(editText, "binding.messageEt");
if (editText.getVisibility() == 0) {
EditText editText2 = getBinding().messageEt;
Intrinsics.checkNotNullExpressionValue(editText2, "binding.messageEt");
ViewExtKt.hideSoftKeyboard(editText2);
}
}
public final void translateLivestreamLayoutToRight() {
RelativeLayout relativeLayout;
ViewPropertyAnimator animate;
ViewPropertyAnimator translationX;
ViewPropertyAnimator duration;
ViewPropertyAnimator withEndAction;
try {
ActivityLiveStreamingBinding activityLiveStreamingBinding = this._binding;
if (activityLiveStreamingBinding == null || (relativeLayout = activityLiveStreamingBinding.topLayout) == null || (animate = relativeLayout.animate()) == null || (translationX = animate.translationX(getBinding().topLayout.getWidth())) == null || (duration = translationX.setDuration(350L)) == null || (withEndAction = duration.withEndAction(new Runnable() {
@Override
public final void run() {
LiveStreamingActivity.translateLivestreamLayoutToRight$lambda$2(LiveStreamingActivity.this);
}
})) == null) {
return;
}
withEndAction.start();
} catch (Exception e) {
Timber.e(e);
}
}
public static final void translateLivestreamLayoutToRight$lambda$2(LiveStreamingActivity liveStreamingActivity) {
LinearLayout linearLayout;
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
liveStreamingActivity.getBinding().topLayout.setVisibility(8);
if (liveStreamingActivity.getIsStreamer()) {
ActivityLiveStreamingBinding activityLiveStreamingBinding = liveStreamingActivity._binding;
ImageView imageView = activityLiveStreamingBinding != null ? activityLiveStreamingBinding.leaveButtonBottomLayout : null;
if (imageView != null) {
imageView.setVisibility(0);
}
ActivityLiveStreamingBinding activityLiveStreamingBinding2 = liveStreamingActivity._binding;
linearLayout = activityLiveStreamingBinding2 != null ? activityLiveStreamingBinding2.closeStreamBottomLayout : null;
if (linearLayout == null) {
return;
}
linearLayout.setVisibility(8);
return;
}
ActivityLiveStreamingBinding activityLiveStreamingBinding3 = liveStreamingActivity._binding;
ImageView imageView2 = activityLiveStreamingBinding3 != null ? activityLiveStreamingBinding3.leaveButtonBottomLayout : null;
if (imageView2 != null) {
imageView2.setVisibility(8);
}
ActivityLiveStreamingBinding activityLiveStreamingBinding4 = liveStreamingActivity._binding;
linearLayout = activityLiveStreamingBinding4 != null ? activityLiveStreamingBinding4.closeStreamBottomLayout : null;
if (linearLayout == null) {
return;
}
linearLayout.setVisibility(0);
}
private final void handleKickedAndBannedUsers() {
Disposable disposable = this.disposable;
if (disposable != null && disposable != null) {
disposable.dispose();
}
this.disposable = getRxBus().toObservable().observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer() {
public final void accept(Object obj) {
LiveStreamingActivity.handleKickedAndBannedUsers$lambda$4(LiveStreamingActivity.this, obj);
}
});
}
public static final void handleKickedAndBannedUsers$lambda$4(LiveStreamingActivity liveStreamingActivity, Object obj) {
AppCompatImageView appCompatImageView;
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
if (obj instanceof LiveStreamCloseEvent) {
if (((LiveStreamCloseEvent) obj).isStreamer()) {
liveStreamingActivity.getViewModel().pauseLiveStream();
} else {
LiveStreamViewModel.endStream$default(liveStreamingActivity.getViewModel(), liveStreamingActivity.getIsStreamer(), false, 0L, null, 14, null);
}
liveStreamingActivity.finish();
return;
}
if (obj instanceof LiveStreamEndEvent) {
liveStreamingActivity.finish();
return;
}
if (obj instanceof LiveStreamStates) {
LiveStreamStates liveStreamStates = (LiveStreamStates) obj;
if (Intrinsics.areEqual(liveStreamStates.getAction(), Constants.PAUSE)) {
RtcManager rtcManager = liveStreamingActivity.rtcManager;
if (rtcManager != null) {
rtcManager.enableCamera(false);
}
RtcManager rtcManager2 = liveStreamingActivity.rtcManager;
if (rtcManager2 != null) {
rtcManager2.openMicrophone(false);
}
ActivityLiveStreamingBinding activityLiveStreamingBinding = liveStreamingActivity._binding;
appCompatImageView = activityLiveStreamingBinding != null ? activityLiveStreamingBinding.btnMute : null;
if (appCompatImageView != null) {
appCompatImageView.setActivated(true);
}
LocalRtcVideoView localRtcVideoView = liveStreamingActivity.mPreviewLayout;
if (localRtcVideoView == null) {
return;
}
localRtcVideoView.setVisibility(8);
return;
}
if (Intrinsics.areEqual(liveStreamStates.getAction(), Constants.UNPAUSE)) {
RtcManager rtcManager3 = liveStreamingActivity.rtcManager;
if (rtcManager3 != null) {
rtcManager3.enableCamera(true);
}
RtcManager rtcManager4 = liveStreamingActivity.rtcManager;
if (rtcManager4 != null) {
rtcManager4.openMicrophone(true);
}
LocalRtcVideoView localRtcVideoView2 = liveStreamingActivity.mPreviewLayout;
if (localRtcVideoView2 != null) {
localRtcVideoView2.setVisibility(0);
}
ActivityLiveStreamingBinding activityLiveStreamingBinding2 = liveStreamingActivity._binding;
appCompatImageView = activityLiveStreamingBinding2 != null ? activityLiveStreamingBinding2.btnMute : null;
if (appCompatImageView == null) {
return;
}
appCompatImageView.setActivated(false);
return;
}
return;
}
appCompatImageView = obj instanceof Pair ? (Pair) obj : null;
if (appCompatImageView != null) {
Object component1 = appCompatImageView.component1();
Object component2 = appCompatImageView.component2();
if (Intrinsics.areEqual(component1, Constants.LIVESTREAM_KICK)) {
if (Intrinsics.areEqual(component2, Long.valueOf(liveStreamingActivity.liveStreamId))) {
Toast.makeText((Context) liveStreamingActivity, "Streamer kicked you out.", 1).show();
liveStreamingActivity.finish();
liveStreamingActivity.stopCohostServiceFunc();
return;
}
return;
}
if (Intrinsics.areEqual(component1, Constants.LIVESTREAM_BAN) && Intrinsics.areEqual(component2, Long.valueOf(liveStreamingActivity.liveStreamId))) {
Toast.makeText((Context) liveStreamingActivity, "Streamer banned you.", 1).show();
liveStreamingActivity.finish();
liveStreamingActivity.stopCohostServiceFunc();
}
}
}
private final void setUpLiveChatRV() {
this.liveCoverRecyclerView = getBinding().liveCoverRv;
Context context = (Context) this;
RecyclerView.LayoutManager customLinearLayoutManager = new CustomLinearLayoutManager(context);
customLinearLayoutManager.setStackFromEnd(true);
getBinding().chatRV.setLayoutManager(customLinearLayoutManager);
ArrayList arrayList = null;
this.adapter = new LiveStreamMessageAdapter(arrayList, new LiveStreamMessageAdapter.ItemClickListener() {
@Override
public void onItemClick(LiveStreamMessageModel host) {
Intrinsics.checkNotNullParameter(host, "host");
}
@Override
public void onItemSwipedRight() {
LiveStreamingActivity.this.translateLivestreamLayoutToRight();
}
@Override
public void onMoreOptionsClick(LiveStreamMessageModel host) {
Intrinsics.checkNotNullParameter(host, "host");
LiveStreamingActivity.this.openStreamerOptionsMenu(host);
}
}, 1, arrayList);
getBinding().chatRV.setAdapter(this.adapter);
if (getIsStreamer()) {
return;
}
RecyclerView.LayoutManager customLinearLayoutManager2 = new CustomLinearLayoutManager(context);
customLinearLayoutManager2.setReverseLayout(true);
getBinding().giftRV.setLayoutManager(customLinearLayoutManager2);
this.giftAnimationAdapter = new LiveStreamGiftAnimationAdapter(null, new LiveStreamGiftAnimationAdapter.ItemClickListener() {
@Override
public void onItemClick(GiftRequestModel host) {
Intrinsics.checkNotNullParameter(host, "host");
}
}, 1, null);
RecyclerView recyclerView = getBinding().giftRV;
Intrinsics.checkNotNullExpressionValue(recyclerView, "binding.giftRV");
((View) recyclerView).setVisibility(0);
getBinding().giftRV.setAdapter(this.giftAnimationAdapter);
getBinding().giftRV.setItemAnimator((RecyclerView.ItemAnimator) new SlideInLeftAnimator());
final RecyclerView.LayoutManager customLinearLayoutManager3 = new CustomLinearLayoutManager(context);
NoScrollRecyclerView noScrollRecyclerView = this.liveCoverRecyclerView;
if (noScrollRecyclerView != null) {
noScrollRecyclerView.setLayoutManager(customLinearLayoutManager3);
}
CustomPagerSnapHelper customPagerSnapHelper = new CustomPagerSnapHelper();
this.pagerSnapHelper = customPagerSnapHelper;
customPagerSnapHelper.attachToRecyclerView(this.liveCoverRecyclerView);
LiveCoverAdapter liveCoverAdapter = new LiveCoverAdapter(new ArrayList());
this.liveCoverAdapter = liveCoverAdapter;
NoScrollRecyclerView noScrollRecyclerView2 = this.liveCoverRecyclerView;
if (noScrollRecyclerView2 != null) {
noScrollRecyclerView2.setAdapter(liveCoverAdapter);
}
CustomPagerSnapHelper customPagerSnapHelper2 = this.pagerSnapHelper;
if (customPagerSnapHelper2 != null) {
customPagerSnapHelper2.setOnSnapListener(new OnSnapListener() {
@Override
public void onSnapped(int position) {
LiveCoverAdapter liveCoverAdapter2;
ArrayList<LiveStreamModel> liveStreamers;
try {
LiveStreamingActivity.this.chatHeightAlreadySet = false;
liveCoverAdapter2 = LiveStreamingActivity.this.liveCoverAdapter;
LiveStreamModel liveStreamModel = (liveCoverAdapter2 == null || (liveStreamers = liveCoverAdapter2.getLiveStreamers()) == null) ? null : liveStreamers.get(position);
if (liveStreamModel != null) {
LiveStreamingActivity.switchStreamer$default(LiveStreamingActivity.this, liveStreamModel, position, false, 4, null);
}
} catch (Exception e) {
Timber.e(e);
}
}
});
}
NoScrollRecyclerView noScrollRecyclerView3 = this.liveCoverRecyclerView;
if (noScrollRecyclerView3 != null) {
noScrollRecyclerView3.addOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(RecyclerView recyclerView2, int dx, int dy) {
LiveStreamViewModel viewModel;
LiveStreamViewModel viewModel2;
LiveStreamViewModel viewModel3;
Intrinsics.checkNotNullParameter(recyclerView2, "recyclerView");
super.onScrolled(recyclerView2, dx, dy);
int childCount = CustomLinearLayoutManager.this.getChildCount();
int itemCount = CustomLinearLayoutManager.this.getItemCount();
int findFirstVisibleItemPosition = CustomLinearLayoutManager.this.findFirstVisibleItemPosition();
viewModel = this.getViewModel();
boolean z = (viewModel.getLiveStreamers().size() > 3 && findFirstVisibleItemPosition + childCount >= itemCount + (-3)) || findFirstVisibleItemPosition + childCount >= itemCount + (-1);
if (itemCount <= 0 || !z) {
return;
}
viewModel2 = this.getViewModel();
if (viewModel2.getIsLoading()) {
return;
}
viewModel3 = this.getViewModel();
viewModel3.getLiveStreamersList(true);
}
});
}
}
public final void openStreamerOptionsMenu(LiveStreamMessageModel host) {
try {
LiveStreamMessageOptionsSheet newInstance = LiveStreamMessageOptionsSheet.INSTANCE.newInstance(host);
this.liveStreamOptionsSheet = newInstance;
if (newInstance != null) {
newInstance.setListener(this);
}
LiveStreamMessageOptionsSheet liveStreamMessageOptionsSheet = this.liveStreamOptionsSheet;
if (liveStreamMessageOptionsSheet != null) {
FragmentManager supportFragmentManager = getSupportFragmentManager();
LiveStreamMessageOptionsSheet liveStreamMessageOptionsSheet2 = this.liveStreamOptionsSheet;
liveStreamMessageOptionsSheet.show(supportFragmentManager, liveStreamMessageOptionsSheet2 != null ? liveStreamMessageOptionsSheet2.getTag() : null);
}
} catch (Exception e) {
Timber.e(e);
}
}
private final void openAudienceBottomSheet() {
LiveStreamAudienceSheet newInstance = LiveStreamAudienceSheet.INSTANCE.newInstance();
newInstance.setStreamer(getIsStreamer());
newInstance.setLivestreamId(this.liveStreamId);
newInstance.setListener(new LiveStreamAudienceSheet.BottomSheetDialogListener() {
@Override
public void onBottomSheetDismissed() {
}
});
newInstance.show(getSupportFragmentManager(), "liveStreamAudienceSheet");
}
private final void initUI() {
ActivityLiveStreamingBinding activityLiveStreamingBinding = this._binding;
if (activityLiveStreamingBinding == null) {
return;
}
this.mPreviewLayout = activityLiveStreamingBinding != null ? activityLiveStreamingBinding.hostView : null;
ActivityLiveStreamingBinding activityLiveStreamingBinding2 = this._binding;
this.mCoHostPreviewLayout = activityLiveStreamingBinding2 != null ? activityLiveStreamingBinding2.coHostView : null;
Timber.tag("ZegoSpecs").e(String.valueOf(this.mPreviewLayout), new Object[0]);
Timber.tag("ZegoSpecs").e(String.valueOf(this.mCoHostPreviewLayout), new Object[0]);
handleLudoGameBtnVisibility();
if (getIsStreamer()) {
ImageView imageView = getBinding().leaveButton;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.leaveButton");
imageView.setVisibility(0);
LinearLayout linearLayout = getBinding().closeStream;
Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.closeStream");
linearLayout.setVisibility(8);
LinearLayout linearLayout2 = getBinding().playPauseParentLayout;
Intrinsics.checkNotNullExpressionValue(linearLayout2, "binding.playPauseParentLayout");
linearLayout2.setVisibility(0);
FrameLayout frameLayout = getBinding().giftBtn;
Intrinsics.checkNotNullExpressionValue(frameLayout, "binding.giftBtn");
frameLayout.setVisibility(0);
FrameLayout frameLayout2 = getBinding().micBtnParent;
Intrinsics.checkNotNullExpressionValue(frameLayout2, "binding.micBtnParent");
frameLayout2.setVisibility(0);
ActivityLiveStreamingBinding activityLiveStreamingBinding3 = this._binding;
FrameLayout frameLayout3 = activityLiveStreamingBinding3 != null ? activityLiveStreamingBinding3.beautyBtnParent : null;
if (frameLayout3 != null) {
FrameLayout frameLayout4 = frameLayout3;
RtcManager rtcManager = this.rtcManager;
frameLayout4.setVisibility(rtcManager != null && rtcManager.isAIEffectsEnabled((Context) this) ? 0 : 8);
}
} else {
if (SharedPref.getBoolean((Context) this, PrefKeys.LIVESTREAM_SWIPE_GUIDE_SHOWN, false)) {
LinearLayout linearLayout3 = getBinding().swipeGuide;
Intrinsics.checkNotNullExpressionValue(linearLayout3, "binding.swipeGuide");
linearLayout3.setVisibility(8);
} else {
LinearLayout linearLayout4 = getBinding().swipeGuide;
Intrinsics.checkNotNullExpressionValue(linearLayout4, "binding.swipeGuide");
linearLayout4.setVisibility(0);
}
ImageView imageView2 = getBinding().leaveButton;
Intrinsics.checkNotNullExpressionValue(imageView2, "binding.leaveButton");
imageView2.setVisibility(8);
ImageView imageView3 = getBinding().leaveButtonDummy;
Intrinsics.checkNotNullExpressionValue(imageView3, "binding.leaveButtonDummy");
imageView3.setVisibility(8);
LinearLayout linearLayout5 = getBinding().closeStream;
Intrinsics.checkNotNullExpressionValue(linearLayout5, "binding.closeStream");
linearLayout5.setVisibility(0);
LinearLayout linearLayout6 = getBinding().playPauseParentLayout;
Intrinsics.checkNotNullExpressionValue(linearLayout6, "binding.playPauseParentLayout");
linearLayout6.setVisibility(8);
ImageView imageView4 = getBinding().callStreamer;
Intrinsics.checkNotNullExpressionValue(imageView4, "binding.callStreamer");
imageView4.setVisibility(0);
FrameLayout frameLayout5 = getBinding().beautyBtnParent;
Intrinsics.checkNotNullExpressionValue(frameLayout5, "binding.beautyBtnParent");
frameLayout5.setVisibility(8);
FrameLayout frameLayout6 = getBinding().micBtnParent;
Intrinsics.checkNotNullExpressionValue(frameLayout6, "binding.micBtnParent");
frameLayout6.setVisibility(8);
ImageView imageView5 = getBinding().leaveButtonDummy;
Intrinsics.checkNotNullExpressionValue(imageView5, "binding.leaveButtonDummy");
imageView5.setVisibility(8);
}
LinearLayout linearLayout7 = getBinding().applyToCohost;
Intrinsics.checkNotNullExpressionValue(linearLayout7, "binding.applyToCohost");
linearLayout7.setVisibility(!getIsStreamer() && this.isCohostEnabled ? 0 : 8);
}
private final void handleLudoGameBtnVisibility() {
ArrayList arrayList = (ArrayList) new Gson().fromJson(SharedPref.getString((Context) this, PrefKeys.ACTIVE_GAMES_IN_LIVESTREAM, "[]"), new TypeToken<ArrayList<String>>() {
}.getType());
if (arrayList == null) {
arrayList = new ArrayList();
}
Iterator it = arrayList.iterator();
while (it.hasNext()) {
String str = (String) it.next();
LinearLayout linearLayout = getBinding().ludoGameBtnParent;
Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.ludoGameBtnParent");
linearLayout.setVisibility(Intrinsics.areEqual(str, "LUDO") ? 0 : 8);
}
}
private final void onClicks() {
LinearLayout linearLayout;
MaterialButton materialButton;
MaterialButton materialButton2;
LinearLayout linearLayout2;
AppCompatImageView appCompatImageView;
LinearLayout linearLayout3;
AppCompatImageView appCompatImageView2;
TextView textView;
LinearLayout linearLayout4;
LinearLayout linearLayout5;
LinearLayout linearLayout6;
ImageView imageView;
FrameLayout frameLayout;
FrameLayout frameLayout2;
ImageView imageView2;
ImageView imageView3;
LinearLayout linearLayout7;
LocalRtcVideoView localRtcVideoView;
ImageView imageView4;
LinearLayout linearLayout8;
LinearLayout linearLayout9;
LinearLayout linearLayout10;
ImageView imageView5;
ImageView imageView6;
LinearLayout linearLayout11;
ActivityLiveStreamingBinding activityLiveStreamingBinding = this._binding;
if (activityLiveStreamingBinding != null && (linearLayout11 = activityLiveStreamingBinding.collapseChat) != null) {
linearLayout11.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$6(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding2 = this._binding;
if (activityLiveStreamingBinding2 != null && (imageView6 = activityLiveStreamingBinding2.leaveButton) != null) {
imageView6.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$7(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding3 = this._binding;
if (activityLiveStreamingBinding3 != null && (imageView5 = activityLiveStreamingBinding3.leaveButtonBottomLayout) != null) {
imageView5.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$8(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding4 = this._binding;
if (activityLiveStreamingBinding4 != null && (linearLayout10 = activityLiveStreamingBinding4.closeStream) != null) {
linearLayout10.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$10(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding5 = this._binding;
if (activityLiveStreamingBinding5 != null && (linearLayout9 = activityLiveStreamingBinding5.closeStreamBottomLayout) != null) {
linearLayout9.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$12(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding6 = this._binding;
if (activityLiveStreamingBinding6 != null && (linearLayout8 = activityLiveStreamingBinding6.liveMessageBtn) != null) {
linearLayout8.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$13(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding7 = this._binding;
if (activityLiveStreamingBinding7 != null && (imageView4 = activityLiveStreamingBinding7.msgSendBtn) != null) {
imageView4.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$14(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding8 = this._binding;
if (activityLiveStreamingBinding8 != null && (localRtcVideoView = activityLiveStreamingBinding8.hostView) != null) {
localRtcVideoView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$15(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding9 = this._binding;
if (activityLiveStreamingBinding9 != null && (linearLayout7 = activityLiveStreamingBinding9.viewCountParent) != null) {
linearLayout7.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$16(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding10 = this._binding;
if (activityLiveStreamingBinding10 != null && (imageView3 = activityLiveStreamingBinding10.pauseLivestream) != null) {
imageView3.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$17(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding11 = this._binding;
if (activityLiveStreamingBinding11 != null && (imageView2 = activityLiveStreamingBinding11.unPauseLivestream) != null) {
imageView2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$18(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding12 = this._binding;
if (activityLiveStreamingBinding12 != null && (frameLayout2 = activityLiveStreamingBinding12.giftBtn) != null) {
frameLayout2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$19(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding13 = this._binding;
if (activityLiveStreamingBinding13 != null && (frameLayout = activityLiveStreamingBinding13.gameBtnParent) != null) {
frameLayout.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$20(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding14 = this._binding;
if (activityLiveStreamingBinding14 != null && (imageView = activityLiveStreamingBinding14.callStreamer) != null) {
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$22(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding15 = this._binding;
if (activityLiveStreamingBinding15 != null && (linearLayout6 = activityLiveStreamingBinding15.applyToCohost) != null) {
linearLayout6.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$24(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding16 = this._binding;
if (activityLiveStreamingBinding16 != null && (linearLayout5 = activityLiveStreamingBinding16.playLudo) != null) {
linearLayout5.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$29(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding17 = this._binding;
if (activityLiveStreamingBinding17 != null && (linearLayout4 = activityLiveStreamingBinding17.endCohostUser) != null) {
linearLayout4.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$32(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding18 = this._binding;
if (activityLiveStreamingBinding18 != null && (textView = activityLiveStreamingBinding18.streamerMoreOptions) != null) {
textView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$36(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding19 = this._binding;
if (activityLiveStreamingBinding19 != null && (appCompatImageView2 = activityLiveStreamingBinding19.beautyBtn) != null) {
appCompatImageView2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$37(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding20 = this._binding;
if (activityLiveStreamingBinding20 != null && (linearLayout3 = activityLiveStreamingBinding20.streamerProfileParent) != null) {
linearLayout3.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$39(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding21 = this._binding;
if (activityLiveStreamingBinding21 != null && (appCompatImageView = activityLiveStreamingBinding21.btnMute) != null) {
appCompatImageView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$40(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding22 = this._binding;
if (activityLiveStreamingBinding22 != null && (linearLayout2 = activityLiveStreamingBinding22.cohostProfileParent) != null) {
linearLayout2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$43(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding23 = this._binding;
if (activityLiveStreamingBinding23 != null && (materialButton2 = activityLiveStreamingBinding23.rechargeNow) != null) {
materialButton2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$45(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding24 = this._binding;
if (activityLiveStreamingBinding24 != null && (materialButton = activityLiveStreamingBinding24.closeLivescreen) != null) {
materialButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.onClicks$lambda$46(LiveStreamingActivity.this, view);
}
});
}
ActivityLiveStreamingBinding activityLiveStreamingBinding25 = this._binding;
if (activityLiveStreamingBinding25 == null || (linearLayout = activityLiveStreamingBinding25.swipeGuide) == null) {
return;
}
linearLayout.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view, MotionEvent motionEvent) {
boolean onClicks$lambda$47;
onClicks$lambda$47 = LiveStreamingActivity.onClicks$lambda$47(LiveStreamingActivity.this, view, motionEvent);
return onClicks$lambda$47;
}
});
}
public static final void onClicks$lambda$6(LiveStreamingActivity liveStreamingActivity, View view) {
ImageView imageView;
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
if (liveStreamingActivity.chatRvParentState == ChatRvState.VISIBLE) {
ActivityLiveStreamingBinding activityLiveStreamingBinding = liveStreamingActivity._binding;
LinearLayout linearLayout = activityLiveStreamingBinding != null ? activityLiveStreamingBinding.chatRvParent : null;
if (linearLayout != null) {
linearLayout.setVisibility(8);
}
ActivityLiveStreamingBinding activityLiveStreamingBinding2 = liveStreamingActivity._binding;
imageView = activityLiveStreamingBinding2 != null ? activityLiveStreamingBinding2.collapseChatImg : null;
if (imageView != null) {
imageView.setRotation(-90.0f);
}
liveStreamingActivity.chatRvParentState = ChatRvState.INVISIBLE;
return;
}
if (liveStreamingActivity.chatRvParentState == ChatRvState.INVISIBLE) {
ActivityLiveStreamingBinding activityLiveStreamingBinding3 = liveStreamingActivity._binding;
LinearLayout linearLayout2 = activityLiveStreamingBinding3 != null ? activityLiveStreamingBinding3.chatRvParent : null;
if (linearLayout2 != null) {
linearLayout2.setVisibility(0);
}
ActivityLiveStreamingBinding activityLiveStreamingBinding4 = liveStreamingActivity._binding;
imageView = activityLiveStreamingBinding4 != null ? activityLiveStreamingBinding4.collapseChatImg : null;
if (imageView != null) {
imageView.setRotation(90.0f);
}
liveStreamingActivity.chatRvParentState = ChatRvState.VISIBLE;
}
}
public static final void onClicks$lambda$7(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
LiveStreamViewModel.endStream$default(liveStreamingActivity.getViewModel(), liveStreamingActivity.getIsStreamer(), false, 0L, null, 14, null);
liveStreamingActivity.finish();
}
public static final void onClicks$lambda$8(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
LiveStreamViewModel.endStream$default(liveStreamingActivity.getViewModel(), liveStreamingActivity.getIsStreamer(), false, 0L, null, 14, null);
liveStreamingActivity.finish();
}
public static final void onClicks$lambda$10(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
LiveStreamModel liveStreamDetails = liveStreamingActivity.getViewModel().getLiveStreamDetails();
if (liveStreamDetails != null) {
liveStreamingActivity.openFollowAndLeaveBottomSheet(liveStreamDetails);
}
}
public static final void onClicks$lambda$12(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
LiveStreamModel liveStreamDetails = liveStreamingActivity.getViewModel().getLiveStreamDetails();
if (liveStreamDetails != null) {
liveStreamingActivity.openFollowAndLeaveBottomSheet(liveStreamDetails);
}
}
public static final void onClicks$lambda$13(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
liveStreamingActivity.getBinding().messageEt.requestFocus();
liveStreamingActivity.openKeyboard();
}
public static final void onClicks$lambda$14(final LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
if (!liveStreamingActivity.getIsStreamer() && liveStreamingActivity.blockCurrentUserLivestreamMessages) {
try {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String string = liveStreamingActivity.getString(2131952181);
Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.live_stream_recharge_message)");
String format = String.format(string, Arrays.copyOf(new Object[0], 0));
Intrinsics.checkNotNullExpressionValue(format, "format(format, *args)");
RechargeDialog rechargeDialog = new RechargeDialog(null, null, null, format, null, new Function0<Unit>() {
public final void m1833invoke() {
}
public Object invoke() {
m1833invoke();
return Unit.INSTANCE;
}
}, new Function0<Unit>() {
{
super(0);
}
public Object invoke() {
m1834invoke();
return Unit.INSTANCE;
}
public final void m1834invoke() {
LiveStreamViewModel viewModel;
viewModel = LiveStreamingActivity.this.getViewModel();
viewModel.getUserDetails();
}
}, 16, null);
rechargeDialog.setCancelable(true);
if (!rechargeDialog.isAdded() && !rechargeDialog.isVisible()) {
rechargeDialog.show(liveStreamingActivity.getSupportFragmentManager(), "RechargeDialog");
return;
}
return;
} catch (Exception unused) {
Activity activity = (Activity) liveStreamingActivity;
String string2 = liveStreamingActivity.getString(2131951993);
Intrinsics.checkNotNullExpressionValue(string2, "getString(R.string.error_unknown)");
ActivityExtKt.toast(activity, string2);
return;
}
}
String obj = liveStreamingActivity.getBinding().messageEt.getText().toString();
if (obj.length() == 0) {
return;
}
liveStreamingActivity.getViewModel().sendLiveStreamMessage(liveStreamingActivity.getIsStreamer(), liveStreamingActivity.liveStreamId, obj);
liveStreamingActivity.getBinding().messageEt.setText("");
EditText editText = liveStreamingActivity.getBinding().messageEt;
Intrinsics.checkNotNullExpressionValue(editText, "binding.messageEt");
ViewExtKt.hideSoftKeyboard(editText);
}
public static final void onClicks$lambda$15(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
try {
EditText editText = liveStreamingActivity.getBinding().messageEt;
Intrinsics.checkNotNullExpressionValue(editText, "binding.messageEt");
ViewExtKt.hideSoftKeyboard(editText);
} catch (Exception e) {
e.printStackTrace();
}
}
public static final void onClicks$lambda$16(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
liveStreamingActivity.openAudienceBottomSheet();
}
public static final void onClicks$lambda$17(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
ImageView imageView = liveStreamingActivity.getBinding().pauseLivestream;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.pauseLivestream");
imageView.setVisibility(8);
ProgressBar progressBar = liveStreamingActivity.getBinding().playPauseDelayProgress;
Intrinsics.checkNotNullExpressionValue(progressBar, "binding.playPauseDelayProgress");
progressBar.setVisibility(0);
liveStreamingActivity.getViewModel().pauseLiveStream();
}
public static final void onClicks$lambda$18(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
ImageView imageView = liveStreamingActivity.getBinding().unPauseLivestream;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.unPauseLivestream");
imageView.setVisibility(8);
ProgressBar progressBar = liveStreamingActivity.getBinding().playPauseDelayProgress;
Intrinsics.checkNotNullExpressionValue(progressBar, "binding.playPauseDelayProgress");
progressBar.setVisibility(0);
liveStreamingActivity.getViewModel().unpauseLiveStream();
}
public static final void onClicks$lambda$19(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
liveStreamingActivity.openGiftBottomSheet();
}
public static final void onClicks$lambda$20(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
liveStreamingActivity.openGamesBottomSheet();
}
public static final void onClicks$lambda$22(LiveStreamingActivity liveStreamingActivity, View view) {
StreamerModel streamerModel;
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
LiveStreamModel liveStreamDetails = liveStreamingActivity.getViewModel().getLiveStreamDetails();
if (liveStreamDetails == null || (streamerModel = liveStreamDetails.getStreamerModel()) == null) {
return;
}
liveStreamingActivity.openCallSheet(streamerModel);
}
public static final void onClicks$lambda$24(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
LiveStreamModel liveStreamDetails = liveStreamingActivity.getViewModel().getLiveStreamDetails();
if (liveStreamDetails != null) {
openCoHostCallSheet$default(liveStreamingActivity, liveStreamDetails, false, 2, null);
}
}
public static final void onClicks$lambda$29(final LiveStreamingActivity liveStreamingActivity, View view) {
final CohostModel cohost;
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
final LiveStreamModel liveStreamDetails = liveStreamingActivity.getViewModel().getLiveStreamDetails();
if (liveStreamDetails != null && (cohost = liveStreamDetails.getCohost()) != null && Intrinsics.areEqual(liveStreamingActivity.localUserId, String.valueOf(cohost.getUserId()))) {
try {
DialogHelper.showReasonDialog((Context) liveStreamingActivity, "", "Do you want to start ludo game?", true, new DialogHelper.ConfirmationListener() {
@Override
public final void onPositiveClick() {
LiveStreamingActivity.onClicks$lambda$29$lambda$27$lambda$26$lambda$25(LiveStreamingActivity.this, liveStreamDetails, cohost);
}
});
return;
} catch (Exception e) {
Timber.e(e);
return;
}
}
LiveStreamModel liveStreamDetails2 = liveStreamingActivity.getViewModel().getLiveStreamDetails();
if (liveStreamDetails2 != null) {
liveStreamingActivity.openCoHostCallSheet(liveStreamDetails2, true);
}
}
public static final void onClicks$lambda$29$lambda$27$lambda$26$lambda$25(LiveStreamingActivity liveStreamingActivity, LiveStreamModel liveStreamModel, CohostModel cohostModel) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
Intrinsics.checkNotNullParameter(liveStreamModel, "$livestreamModel");
Intrinsics.checkNotNullParameter(cohostModel, "$cohostModel");
liveStreamingActivity.getViewModel().createSudGame(liveStreamModel.getId(), Long.valueOf(cohostModel.getId()));
}
public static final void onClicks$lambda$32(final LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
try {
DialogHelper.showReasonDialog((Context) liveStreamingActivity, "", "Are you sure you want to end Co-host?", true, new DialogHelper.ConfirmationListener() {
@Override
public final void onPositiveClick() {
LiveStreamingActivity.onClicks$lambda$32$lambda$31(LiveStreamingActivity.this);
}
});
} catch (Exception e) {
Timber.e(e);
}
}
public static final void onClicks$lambda$32$lambda$31(LiveStreamingActivity liveStreamingActivity) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
liveStreamingActivity.getViewModel().endCohost(liveStreamingActivity.getIsStreamer(), liveStreamingActivity.getViewModel().getCurrentCohostId(), liveStreamingActivity.getViewModel().getCurrentPosition());
}
public static final void onClicks$lambda$36(final LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
final LiveStreamModel liveStreamDetails = liveStreamingActivity.getViewModel().getLiveStreamDetails();
if (liveStreamDetails != null) {
try {
DialogHelper.showReasonDialog((Context) liveStreamingActivity, "", "Are you sure you want to end Co-host?", true, new DialogHelper.ConfirmationListener() {
@Override
public final void onPositiveClick() {
LiveStreamingActivity.onClicks$lambda$36$lambda$35$lambda$34(LiveStreamModel.this, liveStreamingActivity);
}
});
} catch (Exception e) {
Timber.e(e);
}
}
}
public static final void onClicks$lambda$36$lambda$35$lambda$34(LiveStreamModel liveStreamModel, LiveStreamingActivity liveStreamingActivity) {
Intrinsics.checkNotNullParameter(liveStreamModel, "$it");
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
CohostModel cohost = liveStreamModel.getCohost();
if (cohost != null) {
liveStreamingActivity.getViewModel().endCohost(liveStreamingActivity.getIsStreamer(), cohost.getId(), liveStreamingActivity.getViewModel().getCurrentPosition());
}
}
public static final void onClicks$lambda$37(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
liveStreamingActivity.getViewModel().setFaceUnityViewVisible(!liveStreamingActivity.getViewModel().getFaceUnityViewVisible());
View view2 = liveStreamingActivity.getBinding().faceUnityView;
Intrinsics.checkNotNullExpressionValue(view2, "binding.faceUnityView");
view2.setVisibility(liveStreamingActivity.getViewModel().getFaceUnityViewVisible() ? 0 : 8);
ActivityLiveStreamingBinding activityLiveStreamingBinding = liveStreamingActivity._binding;
AppCompatImageView appCompatImageView = activityLiveStreamingBinding != null ? activityLiveStreamingBinding.beautyBtn : null;
if (appCompatImageView == null) {
return;
}
appCompatImageView.setActivated(!liveStreamingActivity.getBinding().beautyBtn.isActivated());
}
public static final void onClicks$lambda$39(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
LiveStreamModel liveStreamDetails = liveStreamingActivity.getViewModel().getLiveStreamDetails();
if (liveStreamDetails != null) {
StreamerDetailActivity.INSTANCE.openScreen((FragmentActivity) liveStreamingActivity, liveStreamDetails.getStreamerId());
}
}
public static final void onClicks$lambda$40(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
ActivityLiveStreamingBinding activityLiveStreamingBinding = liveStreamingActivity._binding;
AppCompatImageView appCompatImageView = activityLiveStreamingBinding != null ? activityLiveStreamingBinding.btnMute : null;
if (appCompatImageView != null) {
appCompatImageView.setActivated(!liveStreamingActivity.getBinding().btnMute.isActivated());
}
RtcManager rtcManager = liveStreamingActivity.rtcManager;
if (rtcManager != null) {
rtcManager.openMicrophone(!liveStreamingActivity.getBinding().btnMute.isActivated());
}
if (liveStreamingActivity.getBinding().btnMute.isActivated()) {
return;
}
liveStreamingActivity.enableMicrophone(true);
}
public static final void onClicks$lambda$43(LiveStreamingActivity liveStreamingActivity, View view) {
CohostModel cohost;
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
if (liveStreamingActivity.getIsStreamer()) {
Intent intent = new Intent(liveStreamingActivity.getApplicationContext(), (Class<?>) UserDetailsActivity.class);
intent.addFlags(805306368);
LiveStreamModel liveStreamDetails = liveStreamingActivity.getViewModel().getLiveStreamDetails();
if (liveStreamDetails != null && (cohost = liveStreamDetails.getCohost()) != null) {
intent.putExtra("userId", cohost.getUserId());
}
liveStreamingActivity.startActivity(intent);
}
}
public static final void onClicks$lambda$45(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
try {
Intent intent = new Intent((Context) liveStreamingActivity, (Class<?>) WalletActivity.class);
intent.addFlags(268435456);
intent.putExtra("video_call_screen", true);
liveStreamingActivity.startActivity(intent);
LiveStreamViewModel.endStream$default(liveStreamingActivity.getViewModel(), liveStreamingActivity.getIsStreamer(), false, 0L, null, 14, null);
liveStreamingActivity.finish();
} catch (Exception unused) {
Activity activity = (Activity) liveStreamingActivity;
String string = liveStreamingActivity.getString(2131951993);
Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.error_unknown)");
ActivityExtKt.toast(activity, string);
}
}
public static final void onClicks$lambda$46(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
LiveStreamViewModel.endStream$default(liveStreamingActivity.getViewModel(), liveStreamingActivity.getIsStreamer(), false, 0L, null, 14, null);
liveStreamingActivity.finish();
}
public static final boolean onClicks$lambda$47(LiveStreamingActivity liveStreamingActivity, View view, MotionEvent motionEvent) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
SharedPref.setBoolean((Context) liveStreamingActivity, PrefKeys.LIVESTREAM_SWIPE_GUIDE_SHOWN, true);
LinearLayout linearLayout = liveStreamingActivity.getBinding().swipeGuide;
Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.swipeGuide");
linearLayout.setVisibility(8);
return true;
}
private final void openFollowAndLeaveBottomSheet(LiveStreamModel liveStreamModel) {
if (getIsStreamer()) {
finish();
return;
}
if (getViewModel().getIsInPictureInPictureMode()) {
LiveStreamViewModel.endStream$default(getViewModel(), getIsStreamer(), false, 0L, null, 14, null);
finish();
return;
}
LiveCoverAdapter liveCoverAdapter = this.liveCoverAdapter;
if (liveCoverAdapter != null && liveCoverAdapter.getLiveAlreadyEnded()) {
LiveStreamersFragment.INSTANCE.setResume(true);
finish();
return;
}
if (!this.liveWatchedFor60Seconds) {
LiveStreamersFragment.INSTANCE.setResume(true);
LiveStreamViewModel.endStream$default(getViewModel(), getIsStreamer(), false, 0L, null, 14, null);
finish();
return;
}
if (liveStreamModel.getCurrentUserFollowingThisUser()) {
LiveStreamViewModel.endStream$default(getViewModel(), getIsStreamer(), false, 0L, null, 14, null);
LiveStreamersFragment.INSTANCE.setResume(true);
finish();
return;
}
try {
StreamerModel streamerModel = liveStreamModel.getStreamerModel();
if (streamerModel != null) {
FollowAndLeaveBottomSheet newInstance = FollowAndLeaveBottomSheet.INSTANCE.newInstance(streamerModel);
this.followAndLeaveBottomSheet = newInstance;
if (newInstance != null) {
newInstance.setListener(this);
}
FollowAndLeaveBottomSheet followAndLeaveBottomSheet = this.followAndLeaveBottomSheet;
if (followAndLeaveBottomSheet != null) {
FragmentManager supportFragmentManager = getSupportFragmentManager();
FollowAndLeaveBottomSheet followAndLeaveBottomSheet2 = this.followAndLeaveBottomSheet;
followAndLeaveBottomSheet.show(supportFragmentManager, followAndLeaveBottomSheet2 != null ? followAndLeaveBottomSheet2.getTag() : null);
}
}
} catch (Exception e) {
Timber.e(e);
LiveStreamViewModel.endStream$default(getViewModel(), getIsStreamer(), false, 0L, null, 14, null);
finish();
}
}
private final void openVerifyNumberBottomSheet() {
VerifyNumberSheet verifyNumberSheet = this.verifyNumberFragment;
if (verifyNumberSheet != null && verifyNumberSheet.isVisible()) {
return;
}
VerifyNumberSheet verifyNumberSheet2 = this.verifyNumberFragment;
if (verifyNumberSheet2 != null && verifyNumberSheet2.isAdded()) {
return;
}
try {
VerifyNumberSheet newInstance = VerifyNumberSheet.INSTANCE.newInstance(true);
this.verifyNumberFragment = newInstance;
if (newInstance != null) {
newInstance.setCancelable(false);
}
VerifyNumberSheet verifyNumberSheet3 = this.verifyNumberFragment;
if (verifyNumberSheet3 != null) {
verifyNumberSheet3.setListener(new VerifyNumberSheet.BottomSheetDialogListener() {
@Override
public void onBottomSheetDismissed() {
LiveStreamingActivity.this.refresh();
}
});
}
VerifyNumberSheet verifyNumberSheet4 = this.verifyNumberFragment;
if (verifyNumberSheet4 != null) {
verifyNumberSheet4.show(getSupportFragmentManager(), "BottomSheet");
}
} catch (Exception e) {
Timber.e(e);
}
}
private final void openGamesBottomSheet() {
try {
GamesBottomSheet newInstance = GamesBottomSheet.INSTANCE.newInstance(true);
this.gamesBottomSheet = newInstance;
if (newInstance != null) {
newInstance.setListener(new GamesBottomSheet.BottomSheetDialogListener() {
@Override
public void onBottomSheetDismissed() {
}
});
}
GamesBottomSheet gamesBottomSheet = this.gamesBottomSheet;
if (gamesBottomSheet != null) {
gamesBottomSheet.show(getSupportFragmentManager(), "carRaceGameRuleInfoSheet");
}
} catch (Exception e) {
Timber.e(e);
}
}
private final void observeKeyboardVisibility() {
Observable listen = new TedRxKeyboardObserver((Activity) this).listen();
final LiveStreamingActivity$observeKeyboardVisibility$1 liveStreamingActivity$observeKeyboardVisibility$1 = new LiveStreamingActivity$observeKeyboardVisibility$1(this);
Consumer consumer = new Consumer() {
public final void accept(Object obj) {
LiveStreamingActivity.observeKeyboardVisibility$lambda$50(liveStreamingActivity$observeKeyboardVisibility$1, obj);
}
};
final LiveStreamingActivity$observeKeyboardVisibility$2 liveStreamingActivity$observeKeyboardVisibility$2 = new Function1<Throwable, Unit>() {
public Object invoke(Object obj) {
invoke((Throwable) obj);
return Unit.INSTANCE;
}
public final void invoke(Throwable th) {
th.printStackTrace();
}
};
listen.subscribe(consumer, new Consumer() {
public final void accept(Object obj) {
LiveStreamingActivity.observeKeyboardVisibility$lambda$51(liveStreamingActivity$observeKeyboardVisibility$2, obj);
}
});
}
public static final void observeKeyboardVisibility$lambda$50(Function1 function1, Object obj) {
Intrinsics.checkNotNullParameter(function1, "$tmp0");
function1.invoke(obj);
}
public static final void observeKeyboardVisibility$lambda$51(Function1 function1, Object obj) {
Intrinsics.checkNotNullParameter(function1, "$tmp0");
function1.invoke(obj);
}
private final void openKeyboard() {
try {
Object systemService = getSystemService("input_method");
Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.view.inputmethod.InputMethodManager");
((InputMethodManager) systemService).showSoftInput(getBinding().messageEt, 1);
} catch (Exception e) {
Timber.e(e);
}
}
private final void openGiftBottomSheet() {
ArrayList gifts = App.Companion.getGifts();
if (gifts == null) {
gifts = new ArrayList();
}
ArrayList arrayList = gifts;
ArrayList giftBrackets = App.Companion.getGiftBrackets();
if (giftBrackets == null) {
giftBrackets = new ArrayList();
}
GiftBottomSheet giftBottomSheet = new GiftBottomSheet(arrayList, giftBrackets, getIsStreamer(), false, new LiveStreamingActivity$openGiftBottomSheet$bottomSheet$1(this), true, Long.valueOf(this.liveStreamId));
if (giftBottomSheet.isAdded() || giftBottomSheet.isVisible()) {
return;
}
giftBottomSheet.show(getSupportFragmentManager(), "GiftBottomSheet");
}
@Override
protected void onStart() {
super.onStart();
registerReceiver();
}
private final Job observeEvent() {
return BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new LiveStreamingActivity$observeEvent$1(this, null), 3, (Object) null);
}
public final void handleLivestreamLockedCase(LivestreamConfig livestreamConfig, final int freeChatDays) {
Integer num;
long duration;
if (getIsStreamer()) {
return;
}
Job job = this.livestreamLockJob;
Unit unit = null;
if (job != null) {
Job.DefaultImpls.cancel$default(job, (CancellationException) null, 1, (Object) null);
}
if (livestreamConfig != null) {
String livestreamLockingStrategy = livestreamConfig.getLivestreamLockingStrategy();
int hashCode = livestreamLockingStrategy.hashCode();
if (hashCode != 2210027) {
if (hashCode != 2402104) {
if (hashCode == 2550826 && livestreamLockingStrategy.equals("SOFT")) {
Context context = (Context) this;
Integer num2 = SharedPref.getInt(context, PrefKeys.LIVESTREAM_LOCKED_SCREEN_SHOW_COUNT, 0);
long j = SharedPref.getLong(context, PrefKeys.LIVESTREAM_LOCKED_LAST_SHOWN_DATE_KEY, 0L);
long currentTimeMillis = System.currentTimeMillis();
if (true ^ isSameDay(j, currentTimeMillis)) {
SharedPref.setInt(context, PrefKeys.LIVESTREAM_LOCKED_SCREEN_SHOW_COUNT, 0);
num = 0;
} else {
num = num2;
}
Intrinsics.checkNotNullExpressionValue(num, "dialogCount");
if (num.intValue() < 3) {
Duration.Companion companion = Duration.Companion;
duration = DurationKt.toDuration(this.LIVESTREAM_LOCKED_DIALOG_THRESHOLD, DurationUnit.SECONDS);
} else {
Duration.Companion companion2 = Duration.Companion;
duration = DurationKt.toDuration(0, DurationUnit.SECONDS);
}
this.livestreamLockJob = BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new LiveStreamingActivity$handleLivestreamLockedCase$1$2(duration, this, num, currentTimeMillis, freeChatDays, null), 3, (Object) null);
}
} else if (livestreamLockingStrategy.equals("NONE")) {
FrameLayout frameLayout = getBinding().livestreamLockedLayout;
Intrinsics.checkNotNullExpressionValue(frameLayout, "binding.livestreamLockedLayout");
frameLayout.setVisibility(8);
}
} else if (livestreamLockingStrategy.equals("HARD")) {
try {
destroyItems$default(this, false, new Function0<Unit>() {
{
super(0);
}
public Object invoke() {
m1831invoke();
return Unit.INSTANCE;
}
public final void m1831invoke() {
LiveStreamViewModel viewModel;
StreamerModel streamerModel;
LiveStreamingActivity liveStreamingActivity = this;
String str = "Please recharge to unlock livestreaming and enjoy unlimited access for " + freeChatDays + " days.";
viewModel = this.getViewModel();
LiveStreamModel liveStreamDetails = viewModel.getLiveStreamDetails();
LiveStreamingActivity.handleLivestreamLockedCase$showLockedLayout(liveStreamingActivity, str, (liveStreamDetails == null || (streamerModel = liveStreamDetails.getStreamerModel()) == null) ? null : streamerModel.getProfilePic());
}
}, 1, null);
} catch (Exception e) {
Timber.e("Error handling hard lock: " + e, new Object[0]);
}
}
unit = Unit.INSTANCE;
}
if (unit == null) {
FrameLayout frameLayout2 = getBinding().livestreamLockedLayout;
Intrinsics.checkNotNullExpressionValue(frameLayout2, "binding.livestreamLockedLayout");
frameLayout2.setVisibility(8);
}
}
public static final void handleLivestreamLockedCase$showLockedLayout(LiveStreamingActivity liveStreamingActivity, String str, String str2) {
liveStreamingActivity.getBinding().livestreamLockedMessage.setText(str);
FrameLayout frameLayout = liveStreamingActivity.getBinding().livestreamLockedLayout;
Intrinsics.checkNotNullExpressionValue(frameLayout, "binding.livestreamLockedLayout");
frameLayout.setVisibility(0);
if (str2 != null) {
Glide.with((FragmentActivity) liveStreamingActivity).load(str2).transform(new Transformation[]{(Transformation) new CenterCrop(), (Transformation) new BlurTransformation(25, 3)}).error(ContextCompat.getDrawable((Context) liveStreamingActivity, 2131101146)).into(liveStreamingActivity.getBinding().lockedStreamerImage);
}
Timber.d("LiveStreaming destroyed", new Object[0]);
}
private final boolean isSameDay(long time1, long time2) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(time1);
Calendar calendar2 = Calendar.getInstance();
calendar2.setTimeInMillis(time2);
return calendar.get(1) == calendar2.get(1) && calendar.get(6) == calendar2.get(6);
}
public final void serverIsNotWorking() {
Job job = this.reconnectionJob;
if (job != null) {
boolean z = false;
if (job != null && !job.isActive()) {
z = true;
}
if (!z) {
return;
}
}
this.reconnectionJob = BuildersKt.launch$default(this.reconnectionScope, (CoroutineContext) null, (CoroutineStart) null, new LiveStreamingActivity$serverIsNotWorking$1(this, null), 3, (Object) null);
}
public final void serverIsWorking() {
reconnectingBox(false);
LocalRtcVideoView localRtcVideoView = this.mPreviewLayout;
if (localRtcVideoView != null) {
ViewExtKt.showOrGone(localRtcVideoView, true);
}
Job job = this.reconnectionJob;
if (job != null) {
Job.DefaultImpls.cancel$default(job, (CancellationException) null, 1, (Object) null);
}
this.reconnectionJob = null;
}
public final void setGameList(ArrayList<String> activeGames) {
ArrayList<String> arrayList = activeGames;
if (arrayList == null || arrayList.isEmpty()) {
return;
}
this.gamesList.addAll(arrayList);
}
public final void sendBroadcastInfo(String action) {
Intent intent = new Intent((Context) this, (Class<?>) LiveStreamBroadcastReceiver.class);
intent.setAction(action);
intent.putExtra(LIVE_STREAM_ID, getViewModel().getLiveStreamId());
intent.putExtra(FROM_LIVE_SCREEN, true);
sendBroadcast(intent);
}
public final void refresh() {
if (getIsStreamer()) {
return;
}
getViewModel().getUserDetails();
getViewModel().getGameMetadata();
retrieveSharedPrefValues();
}
public final void updateValues(LiveStreamModel liveStreamModel) {
Unit unit;
if (this._binding == null) {
return;
}
if (Intrinsics.areEqual(liveStreamModel.getStatus(), "STARTED") && this.isCohostEnabled) {
StreamerUserLivestreamGame streamerUserGame = liveStreamModel.getStreamerUserGame();
if (streamerUserGame != null) {
Timber.d("LUDO_GAME GAME: " + streamerUserGame, new Object[0]);
if (!getIsStreamer()) {
LinearLayout linearLayout = getBinding().playLudo;
Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.playLudo");
linearLayout.setVisibility(8);
}
if (Intrinsics.areEqual(streamerUserGame.getStatus(), "STARTED")) {
if (!getViewModel().getIsInPictureInPictureMode()) {
if (Intrinsics.areEqual(this.localUserId, String.valueOf(getIsStreamer() ? streamerUserGame.getStreamerId() : streamerUserGame.getUserId()))) {
getViewModel().sudGameDetailsPing(liveStreamModel.getId());
}
startSudGame(streamerUserGame);
adjustLudoGameAndHostViewSplit(0.62f);
}
} else {
resetViewsToDefault$default(this, false, 1, null);
}
unit = Unit.INSTANCE;
} else {
unit = null;
}
if (unit == null) {
if (!getIsStreamer()) {
LinearLayout linearLayout2 = getBinding().playLudo;
Intrinsics.checkNotNullExpressionValue(linearLayout2, "binding.playLudo");
linearLayout2.setVisibility(0);
}
resetViewsToDefault$default(this, false, 1, null);
}
if (liveStreamModel.getCohost() != null) {
if (Intrinsics.areEqual(liveStreamModel.getCohost().getStatus(), "STARTED") && !getViewModel().getIsInPictureInPictureMode()) {
if (liveStreamModel.getStreamerUserGame() != null && Intrinsics.areEqual(liveStreamModel.getStreamerUserGame().getStatus(), "STARTED")) {
LinearLayout linearLayout3 = getBinding().cohostProfileParent;
Intrinsics.checkNotNullExpressionValue(linearLayout3, "binding.cohostProfileParent");
linearLayout3.setVisibility(8);
AppCompatTextView appCompatTextView = getBinding().cohostingTimeWithGame;
Intrinsics.checkNotNullExpressionValue(appCompatTextView, "binding.cohostingTimeWithGame");
((View) appCompatTextView).setVisibility(0);
} else {
LinearLayout linearLayout4 = getBinding().cohostProfileParent;
Intrinsics.checkNotNullExpressionValue(linearLayout4, "binding.cohostProfileParent");
linearLayout4.setVisibility(0);
AppCompatTextView appCompatTextView2 = getBinding().cohostingTimeWithGame;
Intrinsics.checkNotNullExpressionValue(appCompatTextView2, "binding.cohostingTimeWithGame");
((View) appCompatTextView2).setVisibility(8);
}
TextView textView = getBinding().streamerMoreOptions;
Intrinsics.checkNotNullExpressionValue(textView, "binding.streamerMoreOptions");
textView.setVisibility(getIsStreamer() ? 0 : 8);
updateCohostUi(liveStreamModel);
RtcManager rtcManager = this.rtcManager;
if (rtcManager != null) {
rtcManager.audioRouteToSpeaker(true);
}
}
} else {
stopCohostServiceFunc();
LinearLayout linearLayout5 = getBinding().cohostTimeLeftUI;
Intrinsics.checkNotNullExpressionValue(linearLayout5, "binding.cohostTimeLeftUI");
linearLayout5.setVisibility(8);
LinearLayout linearLayout6 = getBinding().cohostProfileParent;
Intrinsics.checkNotNullExpressionValue(linearLayout6, "binding.cohostProfileParent");
linearLayout6.setVisibility(8);
AppCompatTextView appCompatTextView3 = getBinding().cohostingTimeWithGame;
Intrinsics.checkNotNullExpressionValue(appCompatTextView3, "binding.cohostingTimeWithGame");
((View) appCompatTextView3).setVisibility(8);
TextView textView2 = getBinding().streamerMoreOptions;
Intrinsics.checkNotNullExpressionValue(textView2, "binding.streamerMoreOptions");
textView2.setVisibility(8);
if (!getIsStreamer()) {
LinearLayout linearLayout7 = getBinding().playLudo;
Intrinsics.checkNotNullExpressionValue(linearLayout7, "binding.playLudo");
linearLayout7.setVisibility(0);
LinearLayout linearLayout8 = getBinding().applyToCohost;
Intrinsics.checkNotNullExpressionValue(linearLayout8, "binding.applyToCohost");
linearLayout8.setVisibility(0);
LinearLayout linearLayout9 = getBinding().endCohostUser;
Intrinsics.checkNotNullExpressionValue(linearLayout9, "binding.endCohostUser");
linearLayout9.setVisibility(8);
} else {
LinearLayout linearLayout10 = getBinding().playLudo;
Intrinsics.checkNotNullExpressionValue(linearLayout10, "binding.playLudo");
linearLayout10.setVisibility(8);
}
}
} else {
if (Intrinsics.areEqual(liveStreamModel.getStatus(), "ENDED")) {
resetViewsToDefault(true);
}
LinearLayout linearLayout11 = getBinding().cohostProfileParent;
Intrinsics.checkNotNullExpressionValue(linearLayout11, "binding.cohostProfileParent");
linearLayout11.setVisibility(8);
AppCompatTextView appCompatTextView4 = getBinding().cohostingTimeWithGame;
Intrinsics.checkNotNullExpressionValue(appCompatTextView4, "binding.cohostingTimeWithGame");
((View) appCompatTextView4).setVisibility(8);
}
ArrayList<LiveStreamParticipant> participants = liveStreamModel.getParticipants();
getBinding().viewCountTv.setText(participants != null ? NumberExtKt.formatNumberToDigit(participants.size()) : null);
LinearLayout linearLayout12 = getBinding().viewCountParent;
Intrinsics.checkNotNullExpressionValue(linearLayout12, "binding.viewCountParent");
linearLayout12.setVisibility(getViewModel().getIsInPictureInPictureMode() ^ true ? 0 : 8);
if (!Intrinsics.areEqual(this.currentStatus, liveStreamModel.getStatus())) {
String status = liveStreamModel.getStatus();
this.currentStatus = status;
if (Intrinsics.areEqual(status, "STARTED")) {
getBinding().overlapingLayout.setDisableSwipe(false);
} else if (Intrinsics.areEqual(this.currentStatus, "PAUSED")) {
if (!getIsStreamer()) {
LinearLayout linearLayout13 = getBinding().applyToCohost;
Intrinsics.checkNotNullExpressionValue(linearLayout13, "binding.applyToCohost");
linearLayout13.setVisibility(this.isCohostEnabled ? 0 : 8);
LinearLayout linearLayout14 = getBinding().endCohostUser;
Intrinsics.checkNotNullExpressionValue(linearLayout14, "binding.endCohostUser");
linearLayout14.setVisibility(8);
}
getBinding().overlapingLayout.setDisableSwipe(true);
getBinding().overlapingLayout.closePanels();
}
}
String status2 = liveStreamModel.getStatus();
int hashCode = status2.hashCode();
if (hashCode != -1941992146) {
if (hashCode != -1179202463) {
if (hashCode == 66114202 && status2.equals("ENDED")) {
LiveStreamersFragment.INSTANCE.setResume(true);
RelativeLayout relativeLayout = getBinding().pauseParent;
Intrinsics.checkNotNullExpressionValue(relativeLayout, "binding.pauseParent");
relativeLayout.setVisibility(8);
View view = getBinding().swipeContentLayout;
Intrinsics.checkNotNullExpressionValue(view, "binding.swipeContentLayout");
view.setVisibility(8);
CoroutineScopeKt.cancel$default(this.scope, (CancellationException) null, 1, (Object) null);
if (getIsStreamer()) {
finish();
} else {
LiveCoverAdapter liveCoverAdapter = this.liveCoverAdapter;
if (liveCoverAdapter != null) {
liveCoverAdapter.streamEnded(liveCoverAdapter.getCurrentPosition());
}
}
}
} else if (status2.equals("STARTED")) {
getViewModel().setPaused(false);
if (getIsStreamer()) {
ImageView imageView = getBinding().pauseLivestream;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.pauseLivestream");
imageView.setVisibility(0);
ImageView imageView2 = getBinding().unPauseLivestream;
Intrinsics.checkNotNullExpressionValue(imageView2, "binding.unPauseLivestream");
imageView2.setVisibility(8);
} else if (!getViewModel().getIsPlaying()) {
getViewModel().setPlaying(true);
loginInRoom();
}
getBinding().messageText.setEnabled(true);
RelativeLayout relativeLayout2 = getBinding().pauseParent;
Intrinsics.checkNotNullExpressionValue(relativeLayout2, "binding.pauseParent");
relativeLayout2.setVisibility(8);
getBinding().micBtnParent.setEnabled(true);
getBinding().messageLayout.setEnabled(true);
}
} else if (status2.equals("PAUSED")) {
getViewModel().setPlaying(false);
if (!getIsStreamer() && !getViewModel().getIsPaused()) {
getViewModel().setPaused(true);
RtcManager rtcManager2 = this.rtcManager;
if (rtcManager2 != null) {
rtcManager2.leaveRtcRoom(null);
}
RtcManager rtcManager3 = this.rtcManager;
if (rtcManager3 != null) {
rtcManager3.disconnectUser(false);
}
}
LiveStreamersFragment.INSTANCE.setResume(true);
if (getIsStreamer()) {
ImageView imageView3 = getBinding().pauseLivestream;
Intrinsics.checkNotNullExpressionValue(imageView3, "binding.pauseLivestream");
imageView3.setVisibility(8);
ImageView imageView4 = getBinding().unPauseLivestream;
Intrinsics.checkNotNullExpressionValue(imageView4, "binding.unPauseLivestream");
imageView4.setVisibility(0);
} else {
NoScrollRecyclerView noScrollRecyclerView = this.liveCoverRecyclerView;
if (noScrollRecyclerView != null) {
noScrollRecyclerView.setScrollEnabled(true);
}
}
RelativeLayout relativeLayout3 = getBinding().pauseParent;
Intrinsics.checkNotNullExpressionValue(relativeLayout3, "binding.pauseParent");
relativeLayout3.setVisibility(0);
getBinding().messageText.setEnabled(false);
getBinding().micBtnParent.setEnabled(false);
getBinding().messageLayout.setEnabled(false);
}
addMessageItems(liveStreamModel);
resetChatRvHeight(liveStreamModel);
}
private final void adjustLudoGameAndHostViewSplit(float ludoGameHeightRatio) {
if (this.isSplitScreenActive) {
return;
}
AppCompatImageView appCompatImageView = getBinding().snowfallAnimation;
Intrinsics.checkNotNullExpressionValue(appCompatImageView, "binding.snowfallAnimation");
((View) appCompatImageView).setVisibility(0);
ImageView imageView = getBinding().ludoBgImg;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.ludoBgImg");
imageView.setVisibility(0);
try {
ViewGroup viewGroup = getBinding().viewParent;
Intrinsics.checkNotNull(viewGroup, "null cannot be cast to non-null type androidx.constraintlayout.widget.ConstraintLayout");
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(viewGroup);
ViewGroup viewGroup2 = getBinding().swipeContentLayout;
Intrinsics.checkNotNull(viewGroup2, "null cannot be cast to non-null type androidx.constraintlayout.widget.ConstraintLayout");
ConstraintSet constraintSet2 = new ConstraintSet();
constraintSet2.clone(viewGroup2);
int i = getResources().getDisplayMetrics().heightPixels;
int i2 = (int) (i * ludoGameHeightRatio);
int i3 = i - i2;
ViewGroup.LayoutParams layoutParams = getBinding().ludoBgImg.getLayoutParams();
layoutParams.height = i3;
getBinding().ludoBgImg.setLayoutParams(layoutParams);
constraintSet.constrainHeight(getBinding().ludoGameView.getId(), i2);
constraintSet.connect(getBinding().ludoGameView.getId(), 3, 0, 3);
constraintSet.connect(getBinding().ludoGameView.getId(), 4, getBinding().hostView.getId(), 3);
constraintSet2.constrainHeight(getBinding().ludoGameViewMain.getId(), i2);
constraintSet2.connect(getBinding().ludoGameViewMain.getId(), 3, 0, 3);
constraintSet2.clear(getBinding().ludoGameViewMain.getId(), 4);
constraintSet.constrainHeight(getBinding().hostView.getId(), i3);
constraintSet.constrainWidth(getBinding().hostView.getId(), (i3 * 5) / 8);
constraintSet.connect(getBinding().hostView.getId(), 3, getBinding().ludoGameView.getId(), 4, 0);
constraintSet.connect(getBinding().hostView.getId(), 4, 0, 4);
constraintSet.connect(getBinding().hostView.getId(), 7, 0, 7);
TransitionManager.beginDelayedTransition(viewGroup);
constraintSet.applyTo(viewGroup);
TransitionManager.beginDelayedTransition(viewGroup2);
constraintSet2.applyTo(viewGroup2);
} catch (Exception e) {
Timber.d("Error: " + e, new Object[0]);
}
this.isSplitScreenActive = true;
}
static void resetViewsToDefault$default(LiveStreamingActivity liveStreamingActivity, boolean z, int i, Object obj) {
if ((i & 1) != 0) {
z = false;
}
liveStreamingActivity.resetViewsToDefault(z);
}
private final void resetViewsToDefault(boolean stopAnim) {
this.sudGameAlreadyStarted = false;
resetHostViewToFullScreen(stopAnim);
this.gameViewModel.destroyMG();
}
static void resetHostViewToFullScreen$default(LiveStreamingActivity liveStreamingActivity, boolean z, int i, Object obj) {
if ((i & 1) != 0) {
z = false;
}
liveStreamingActivity.resetHostViewToFullScreen(z);
}
private final void resetHostViewToFullScreen(boolean stopAnim) {
try {
ViewGroup viewGroup = getBinding().viewParent;
Intrinsics.checkNotNull(viewGroup, "null cannot be cast to non-null type androidx.constraintlayout.widget.ConstraintLayout");
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(viewGroup);
constraintSet.constrainHeight(getBinding().hostView.getId(), -1);
constraintSet.constrainWidth(getBinding().hostView.getId(), -1);
constraintSet.connect(getBinding().hostView.getId(), 3, 0, 3);
constraintSet.connect(getBinding().hostView.getId(), 4, 0, 4);
constraintSet.connect(getBinding().hostView.getId(), 6, 0, 6);
constraintSet.connect(getBinding().hostView.getId(), 7, 0, 7);
if (!stopAnim) {
TransitionManager.beginDelayedTransition(viewGroup);
}
constraintSet.applyTo(viewGroup);
} catch (Exception e) {
Timber.d("Error: " + e, new Object[0]);
}
FrameLayout frameLayout = getBinding().ludoGameView;
Intrinsics.checkNotNullExpressionValue(frameLayout, "binding.ludoGameView");
frameLayout.setVisibility(8);
FrameLayout frameLayout2 = getBinding().ludoGameViewMain;
Intrinsics.checkNotNullExpressionValue(frameLayout2, "binding.ludoGameViewMain");
frameLayout2.setVisibility(8);
AppCompatImageView appCompatImageView = getBinding().snowfallAnimation;
Intrinsics.checkNotNullExpressionValue(appCompatImageView, "binding.snowfallAnimation");
((View) appCompatImageView).setVisibility(8);
ImageView imageView = getBinding().ludoBgImg;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.ludoBgImg");
imageView.setVisibility(8);
this.sudGameAlreadyStarted = false;
this.isSplitScreenActive = false;
}
private final void adjustLudoGameViewSize(float heightRatio) {
ConstraintLayout constraintLayout = getBinding().viewParent;
Intrinsics.checkNotNull(constraintLayout, "null cannot be cast to non-null type androidx.constraintlayout.widget.ConstraintLayout");
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(constraintLayout);
constraintSet.constrainHeight(getBinding().ludoGameView.getId(), (int) (getResources().getDisplayMetrics().heightPixels * heightRatio));
constraintSet.applyTo(constraintLayout);
}
private final void adjustHostViewSize(int widthDp, int heightDp) {
int i = (int) (widthDp * getResources().getDisplayMetrics().density);
int i2 = (int) (heightDp * getResources().getDisplayMetrics().density);
ViewGroup.LayoutParams layoutParams = getBinding().hostView.getLayoutParams();
layoutParams.width = i;
layoutParams.height = i2;
getBinding().hostView.setLayoutParams(layoutParams);
}
private final void updateCohostUi(LiveStreamModel liveStreamModel) {
CohostModel cohost = liveStreamModel.getCohost();
if (cohost != null) {
if (this.currentCoHostId != cohost.getId()) {
this.currentCoHostId = cohost.getId();
User userDetails = cohost.getUserDetails();
if (userDetails != null) {
Glide.with((FragmentActivity) this).load(userDetails.getAvatar()).into(getBinding().cohostProfilePic);
getBinding().cohostName.setText(String.valueOf(userDetails.getName()));
String levelName = userDetails.getLevelName();
if (!(levelName == null || levelName.length() == 0)) {
getBinding().userLevel.setText("Lv" + userDetails.getLevelName());
TextView textView = getBinding().userLevel;
Intrinsics.checkNotNullExpressionValue(textView, "binding.userLevel");
textView.setVisibility(0);
} else {
TextView textView2 = getBinding().userLevel;
Intrinsics.checkNotNullExpressionValue(textView2, "binding.userLevel");
textView2.setVisibility(8);
}
}
}
getBinding().cohostingTime.setStartTime(cohost.getDuration());
getBinding().cohostingTimeWithGame.setStartTime(cohost.getDuration());
if (Intrinsics.areEqual(String.valueOf(cohost.getUserId()), getViewModel().getAccountId())) {
getViewModel().setCurrentCohostId(cohost.getId());
checkForTimeLeftWithUser(cohost.getTimeLeft(), cohost.getDuration());
checkForUserSoundPublish();
if (getIsStreamer()) {
return;
}
LinearLayout linearLayout = getBinding().applyToCohost;
Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.applyToCohost");
linearLayout.setVisibility(8);
LinearLayout linearLayout2 = getBinding().endCohostUser;
Intrinsics.checkNotNullExpressionValue(linearLayout2, "binding.endCohostUser");
linearLayout2.setVisibility(0);
if (liveStreamModel.getStreamerUserGame() == null) {
if (liveStreamModel.getCohost() != null) {
if (Intrinsics.areEqual(String.valueOf(liveStreamModel.getCohost().getUserId()), this.localUserId)) {
LinearLayout linearLayout3 = getBinding().playLudo;
Intrinsics.checkNotNullExpressionValue(linearLayout3, "binding.playLudo");
linearLayout3.setVisibility(0);
return;
} else {
LinearLayout linearLayout4 = getBinding().playLudo;
Intrinsics.checkNotNullExpressionValue(linearLayout4, "binding.playLudo");
linearLayout4.setVisibility(8);
return;
}
}
LinearLayout linearLayout5 = getBinding().playLudo;
Intrinsics.checkNotNullExpressionValue(linearLayout5, "binding.playLudo");
linearLayout5.setVisibility(0);
return;
}
LinearLayout linearLayout6 = getBinding().playLudo;
Intrinsics.checkNotNullExpressionValue(linearLayout6, "binding.playLudo");
linearLayout6.setVisibility(8);
return;
}
if (getIsStreamer()) {
return;
}
LinearLayout linearLayout7 = getBinding().applyToCohost;
Intrinsics.checkNotNullExpressionValue(linearLayout7, "binding.applyToCohost");
linearLayout7.setVisibility(0);
LinearLayout linearLayout8 = getBinding().endCohostUser;
Intrinsics.checkNotNullExpressionValue(linearLayout8, "binding.endCohostUser");
linearLayout8.setVisibility(8);
if (liveStreamModel.getStreamerUserGame() == null) {
if (liveStreamModel.getCohost() != null) {
if (Intrinsics.areEqual(String.valueOf(liveStreamModel.getCohost().getUserId()), this.localUserId)) {
LinearLayout linearLayout9 = getBinding().playLudo;
Intrinsics.checkNotNullExpressionValue(linearLayout9, "binding.playLudo");
linearLayout9.setVisibility(0);
return;
} else {
LinearLayout linearLayout10 = getBinding().playLudo;
Intrinsics.checkNotNullExpressionValue(linearLayout10, "binding.playLudo");
linearLayout10.setVisibility(8);
return;
}
}
LinearLayout linearLayout11 = getBinding().playLudo;
Intrinsics.checkNotNullExpressionValue(linearLayout11, "binding.playLudo");
linearLayout11.setVisibility(0);
return;
}
LinearLayout linearLayout12 = getBinding().playLudo;
Intrinsics.checkNotNullExpressionValue(linearLayout12, "binding.playLudo");
linearLayout12.setVisibility(8);
}
}
private final void checkForUserSoundPublish() {
if (getIsStreamer() || this.soundAlreadyPublishing) {
return;
}
stopCohostServiceFunc();
BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new LiveStreamingActivity$checkForUserSoundPublish$1(this, null), 3, (Object) null);
Timber.i("sound publish started again", new Object[0]);
RtcManager rtcManager = this.rtcManager;
if (rtcManager != null) {
rtcManager.enableCamera(false);
}
getBinding().coHostView.setCoHostUserID(getViewModel().getAccountId());
RtcManager rtcManager2 = this.rtcManager;
if (rtcManager2 != null) {
rtcManager2.openMicrophone(true);
}
NoScrollRecyclerView noScrollRecyclerView = this.liveCoverRecyclerView;
if (noScrollRecyclerView != null) {
noScrollRecyclerView.setScrollEnabled(false);
}
this.soundAlreadyPublishing = true;
}
private final void checkForTimeLeftWithUser(int secondsLeft, int duration) {
TextView textView;
if (secondsLeft < 60 && duration >= 60) {
LinearLayout linearLayout = getBinding().cohostTimeLeftUI;
Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.cohostTimeLeftUI");
linearLayout.setVisibility(0);
if (secondsLeft <= 0) {
LiveStreamViewModel viewModel = getViewModel();
viewModel.endCohost(getIsStreamer(), viewModel.getCurrentCohostId(), viewModel.getCurrentPosition());
return;
}
if (getIsStreamer()) {
ActivityLiveStreamingBinding activityLiveStreamingBinding = this._binding;
LinearLayout linearLayout2 = activityLiveStreamingBinding != null ? activityLiveStreamingBinding.balanceParent : null;
if (linearLayout2 != null) {
linearLayout2.setVisibility(0);
}
String str = getString(2131952564) + ' ' + secondsLeft;
ActivityLiveStreamingBinding activityLiveStreamingBinding2 = this._binding;
textView = activityLiveStreamingBinding2 != null ? activityLiveStreamingBinding2.userSecondLeft : null;
if (textView == null) {
return;
}
textView.setText(str);
return;
}
if (!this.isPopUpShown) {
showLowBalancePopup();
this.isPopUpShown = true;
}
ActivityLiveStreamingBinding activityLiveStreamingBinding3 = this._binding;
TextView textView2 = activityLiveStreamingBinding3 != null ? activityLiveStreamingBinding3.secondsLeft : null;
if (textView2 != null) {
textView2.setVisibility(0);
}
String str2 = getString(2131952564) + ' ' + secondsLeft;
ActivityLiveStreamingBinding activityLiveStreamingBinding4 = this._binding;
textView = activityLiveStreamingBinding4 != null ? activityLiveStreamingBinding4.secondsLeft : null;
if (textView == null) {
return;
}
textView.setText(str2);
return;
}
LinearLayout linearLayout3 = getBinding().cohostTimeLeftUI;
Intrinsics.checkNotNullExpressionValue(linearLayout3, "binding.cohostTimeLeftUI");
linearLayout3.setVisibility(8);
ActivityLiveStreamingBinding activityLiveStreamingBinding5 = this._binding;
LinearLayout linearLayout4 = activityLiveStreamingBinding5 != null ? activityLiveStreamingBinding5.balanceParent : null;
if (linearLayout4 != null) {
linearLayout4.setVisibility(8);
}
ActivityLiveStreamingBinding activityLiveStreamingBinding6 = this._binding;
textView = activityLiveStreamingBinding6 != null ? activityLiveStreamingBinding6.secondsLeft : null;
if (textView == null) {
return;
}
textView.setVisibility(8);
}
private final void showLowBalancePopup() {
try {
Dialog dialog = new Dialog((Context) this);
this.dialog = dialog;
dialog.setContentView(2131558836);
Dialog dialog2 = this.dialog;
ImageView imageView = dialog2 != null ? (ImageView) dialog2.findViewById(2131362585) : null;
if (imageView != null) {
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.showLowBalancePopup$lambda$64(LiveStreamingActivity.this, view);
}
});
}
Dialog dialog3 = this.dialog;
Button button = dialog3 != null ? (Button) dialog3.findViewById(2131364291) : null;
if (button != null) {
button.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.showLowBalancePopup$lambda$66(LiveStreamingActivity.this, view);
}
});
}
Dialog dialog4 = this.dialog;
if (dialog4 != null) {
dialog4.show();
}
Dialog dialog5 = this.dialog;
if (dialog5 != null) {
dialog5.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public final void onDismiss(DialogInterface dialogInterface) {
dialogInterface.dismiss();
}
});
}
} catch (Exception e) {
Timber.e(e);
}
}
public static final void showLowBalancePopup$lambda$64(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
Dialog dialog = liveStreamingActivity.dialog;
if (dialog != null) {
dialog.dismiss();
}
}
public static final void showLowBalancePopup$lambda$66(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
liveStreamingActivity.enablePip();
Dialog dialog = liveStreamingActivity.dialog;
if (dialog != null) {
dialog.dismiss();
}
Intent intent = new Intent(liveStreamingActivity.getApplicationContext(), (Class<?>) WalletActivity.class);
intent.addFlags(268435456);
intent.putExtra("video_call_screen", true);
liveStreamingActivity.startActivity(intent);
}
private final void addMessageItems(LiveStreamModel liveStreamModel) {
LiveStreamMessageAdapter liveStreamMessageAdapter;
List<LiveStreamMessageModel> asReversedMutable;
LiveStreamMessageAdapter liveStreamMessageAdapter2;
ArrayList<LiveStreamMessageModel> messages = liveStreamModel.getMessages();
if (messages != null && (asReversedMutable = CollectionsKt.asReversedMutable(messages)) != null && (liveStreamMessageAdapter2 = this.adapter) != null) {
liveStreamMessageAdapter2.setMessages(asReversedMutable);
}
if (this.adapter == null || !isLastVisible() || (liveStreamMessageAdapter = this.adapter) == null) {
return;
}
BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new LiveStreamingActivity$addMessageItems$2$1(this, liveStreamMessageAdapter.scrollToPosition(), null), 3, (Object) null);
}
private final void enableMicrophone(boolean enableMic) {
try {
if (getPackageManager().hasSystemFeature("android.hardware.microphone")) {
Object systemService = getSystemService("audio");
Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.media.AudioManager");
((AudioManager) systemService).setMicrophoneMute(!enableMic);
}
} catch (Exception e) {
Timber.e(e);
}
}
private final void enablePip() {
UserCohostService userCohostService;
try {
if (!getIsStreamer() && (userCohostService = this.userCohostService) != null && userCohostService != null) {
this.mUserCohostServiceIntent = new Intent((Context) this, userCohostService.getClass());
if (Utils.isMyServiceRunning(userCohostService.getClass(), (Activity) this)) {
Timber.d("Cohost Service stopped!!", new Object[0]);
} else {
Timber.d("Cohost Service is already stopped!!", new Object[0]);
}
}
Rational rational = new Rational(3, 4);
if (Build.VERSION.SDK_INT >= 26) {
if (getPackageManager().hasSystemFeature("android.software.picture_in_picture")) {
Timber.tag("PIP").e("*** Picture-in-Picture ***", new Object[0]);
enterPictureInPictureMode(new PictureInPictureParams.Builder().setAspectRatio(rational).setSourceRectHint(new Rect()).build());
} else {
Timber.tag("PIP").e("*** No support Picture-in-Picture ***", new Object[0]);
}
}
} catch (Exception e) {
Activity activity = (Activity) this;
String message = e.getMessage();
if (message == null) {
message = "";
}
ActivityExtKt.toast(activity, message);
}
}
private final void initValues(Intent intent) {
if (intent != null) {
this.zegoToken = String.valueOf(intent.getStringExtra(ZEGO_TOKEN));
this.roomId = String.valueOf(intent.getStringExtra(ROOM_ID));
this.rtcProvider = String.valueOf(intent.getStringExtra("RTC_PROVIDER"));
this.liveStreamId = intent.getLongExtra(LIVE_STREAM_ID, -1L);
getViewModel().setLiveStreamId(this.liveStreamId);
String stringExtra = intent.getStringExtra(LIVE_STREAM_MODEL);
String str = stringExtra;
if (str == null || StringsKt.isBlank(str)) {
return;
}
getViewModel().setLiveStreamDetails((LiveStreamModel) new Gson().fromJson(stringExtra, LiveStreamModel.class));
setProfileValues(getViewModel().getLiveStreamDetails());
initAndSignInZEGOSDK();
BuildersKt.launch$default(this.scope, (CoroutineContext) null, (CoroutineStart) null, new LiveStreamingActivity$initValues$1$1(this, null), 3, (Object) null);
if (getIsStreamer()) {
return;
}
LiveStreamViewModel.getLiveStreamersList$default(getViewModel(), false, 1, null);
}
}
static void switchStreamer$default(LiveStreamingActivity liveStreamingActivity, LiveStreamModel liveStreamModel, int i, boolean z, int i2, Object obj) {
if ((i2 & 4) != 0) {
z = false;
}
liveStreamingActivity.switchStreamer(liveStreamModel, i, z);
}
public final void switchStreamer(final LiveStreamModel liveStreamModel, final int position, final boolean liveEnded) {
getViewModel().setCurrentPosition(position);
destroyItems$default(this, false, new Function0<Unit>() {
{
super(0);
}
public Object invoke() {
m1854invoke();
return Unit.INSTANCE;
}
public final void m1854invoke() {
CoroutineContext coroutineContext;
LiveCoverAdapter liveCoverAdapter;
LiveStreamViewModel viewModel;
LocalRtcVideoView localRtcVideoView;
ActivityLiveStreamingBinding binding;
LocalRtcVideoView localRtcVideoView2;
LiveStreamViewModel viewModel2;
LiveStreamViewModel viewModel3;
RemoteRtcVideoView remoteRtcVideoView;
RtcManager rtcManager;
ActivityLiveStreamingBinding binding2;
boolean z;
ActivityLiveStreamingBinding binding3;
ActivityLiveStreamingBinding binding4;
ActivityLiveStreamingBinding binding5;
ActivityLiveStreamingBinding binding6;
Queue queue;
LiveStreamGiftAnimationAdapter liveStreamGiftAnimationAdapter;
try {
remoteRtcVideoView = LiveStreamingActivity.this.mCoHostPreviewLayout;
if (remoteRtcVideoView != null) {
remoteRtcVideoView.stopAudioVideo();
}
rtcManager = LiveStreamingActivity.this.rtcManager;
if (rtcManager != null) {
rtcManager.openMicrophone(false);
}
binding2 = LiveStreamingActivity.this.getBinding();
LinearLayout linearLayout = binding2.applyToCohost;
Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.applyToCohost");
LinearLayout linearLayout2 = linearLayout;
z = LiveStreamingActivity.this.isCohostEnabled;
linearLayout2.setVisibility(z ? 0 : 8);
binding3 = LiveStreamingActivity.this.getBinding();
LinearLayout linearLayout3 = binding3.endCohostUser;
Intrinsics.checkNotNullExpressionValue(linearLayout3, "binding.endCohostUser");
linearLayout3.setVisibility(8);
binding4 = LiveStreamingActivity.this.getBinding();
LinearLayout linearLayout4 = binding4.cohostProfileParent;
Intrinsics.checkNotNullExpressionValue(linearLayout4, "binding.cohostProfileParent");
linearLayout4.setVisibility(8);
binding5 = LiveStreamingActivity.this.getBinding();
AppCompatTextView appCompatTextView = binding5.cohostingTimeWithGame;
Intrinsics.checkNotNullExpressionValue(appCompatTextView, "binding.cohostingTimeWithGame");
((View) appCompatTextView).setVisibility(8);
binding6 = LiveStreamingActivity.this.getBinding();
ImageView imageView = binding6.animationView;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.animationView");
imageView.setVisibility(8);
queue = LiveStreamingActivity.this.giftAnimationQueue;
queue.clear();
liveStreamGiftAnimationAdapter = LiveStreamingActivity.this.giftAnimationAdapter;
if (liveStreamGiftAnimationAdapter != null && liveStreamGiftAnimationAdapter.getMessages().size() > 0) {
liveStreamGiftAnimationAdapter.clear();
}
} catch (Exception e) {
Timber.e(e);
}
LiveStreamingActivity.this.job = SupervisorKt.SupervisorJob$default((Job) null, 1, (Object) null);
LiveStreamingActivity liveStreamingActivity = LiveStreamingActivity.this;
MainCoroutineDispatcher main = Dispatchers.getMain();
coroutineContext = LiveStreamingActivity.this.job;
liveStreamingActivity.scope = CoroutineScopeKt.CoroutineScope(main.plus(coroutineContext));
if (!liveEnded) {
viewModel3 = LiveStreamingActivity.this.getViewModel();
boolean isStreamer = LiveStreamingActivity.this.getIsStreamer();
final LiveStreamingActivity liveStreamingActivity2 = LiveStreamingActivity.this;
final LiveStreamModel liveStreamModel2 = liveStreamModel;
final int i = position;
final boolean z2 = liveEnded;
LiveStreamViewModel.endStream$default(viewModel3, isStreamer, true, 0L, new Function0<Unit>() {
{
super(0);
}
public Object invoke() {
m1855invoke();
return Unit.INSTANCE;
}
public final void m1855invoke() {
LiveStreamViewModel viewModel4;
viewModel4 = LiveStreamingActivity.this.getViewModel();
viewModel4.joinLiveStream(liveStreamModel2.getId(), liveStreamModel2.getStreamerModel(), i, String.valueOf(liveStreamModel2.getStreamerId()), z2);
}
}, 4, null);
} else {
liveCoverAdapter = LiveStreamingActivity.this.liveCoverAdapter;
if (liveCoverAdapter != null) {
liveCoverAdapter.updateStreamEnded(position);
}
viewModel = LiveStreamingActivity.this.getViewModel();
viewModel.joinLiveStream(liveStreamModel.getId(), liveStreamModel.getStreamerModel(), position, String.valueOf(liveStreamModel.getStreamerId()), liveEnded);
}
LiveStreamMessageAdapter adapter = LiveStreamingActivity.this.getAdapter();
if (adapter != null) {
adapter.clear();
}
LiveStreamMessageAdapter adapter2 = LiveStreamingActivity.this.getAdapter();
if (adapter2 != null) {
adapter2.setGuidelinesShown(false);
}
localRtcVideoView = LiveStreamingActivity.this.mPreviewLayout;
TextureView textureView = localRtcVideoView != null ? localRtcVideoView.getTextureView() : null;
if (textureView != null) {
textureView.setAlpha(0.0f);
}
binding = LiveStreamingActivity.this.getBinding();
View view = binding.swipeContentLayout;
Intrinsics.checkNotNullExpressionValue(view, "binding.swipeContentLayout");
view.setVisibility(8);
localRtcVideoView2 = LiveStreamingActivity.this.mPreviewLayout;
if (localRtcVideoView2 != null) {
localRtcVideoView2.resetUserId();
}
StringBuilder sb = new StringBuilder();
sb.append("switch currentPosition ");
sb.append(position);
sb.append(" viewModel.currentPosition ");
viewModel2 = LiveStreamingActivity.this.getViewModel();
sb.append(viewModel2.getCurrentPosition());
Timber.e(sb.toString(), new Object[0]);
}
}, 1, null);
}
private final void resetChatRvHeight(LiveStreamModel liveStreamModel) {
if (getIsStreamer() || this.chatHeightAlreadySet || liveStreamModel.getMessages() == null || liveStreamModel.getMessages().size() <= 4) {
return;
}
try {
int dimensionPixelSize = getResources().getDimensionPixelSize(2131166329);
ViewGroup.LayoutParams layoutParams = getBinding().chatRV.getLayoutParams();
layoutParams.height = dimensionPixelSize;
getBinding().chatRV.setLayoutParams(layoutParams);
getBinding().chatRV.requestLayout();
this.chatHeightAlreadySet = true;
} catch (Exception e) {
Timber.e(e.toString(), new Object[0]);
}
}
private final void initAndSignInZEGOSDK() {
RtcManager rtcManager = this.rtcManager;
if (rtcManager != null) {
Application application = getApplication();
Intrinsics.checkNotNullExpressionValue(application, "application");
long j = ZEGOSDKConstants.appID;
String str = ZEGOSDKConstants.appSign;
Intrinsics.checkNotNullExpressionValue(str, "appSign");
rtcManager.initSDKForLiveStream(application, j, str, new SDKInitialise() {
@Override
public final void initialised() {
LiveStreamingActivity.initAndSignInZEGOSDK$lambda$73(LiveStreamingActivity.this);
}
});
}
}
public static final void initAndSignInZEGOSDK$lambda$73(final LiveStreamingActivity liveStreamingActivity) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
liveStreamingActivity.requestPermissionIfNeeded(liveStreamingActivity.permissions, new RequestCallback() {
public final void onResult(boolean z, List list, List list2) {
LiveStreamingActivity.initAndSignInZEGOSDK$lambda$73$lambda$72(LiveStreamingActivity.this, z, list, list2);
}
});
}
public static final void initAndSignInZEGOSDK$lambda$73$lambda$72(LiveStreamingActivity liveStreamingActivity, boolean z, List list, List list2) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
Intrinsics.checkNotNullParameter(list, "<anonymous parameter 1>");
Intrinsics.checkNotNullParameter(list2, "<anonymous parameter 2>");
liveStreamingActivity.initVideo();
}
private final void listenRtcEvents() {
this.rtcEventHandler = new LiveStreamingActivity$listenRtcEvents$1(this);
}
private final void initVideo() {
Unit unit;
enableMicrophone(true);
if (getIsStreamer()) {
RtcManager rtcManager = this.rtcManager;
if (rtcManager != null) {
rtcManager.openMicrophone(true);
}
RtcManager rtcManager2 = this.rtcManager;
if (rtcManager2 != null) {
rtcManager2.audioRouteToSpeaker(true);
}
RtcManager rtcManager3 = this.rtcManager;
if (rtcManager3 != null) {
rtcManager3.enableCamera(true);
}
} else {
RtcManager rtcManager4 = this.rtcManager;
if (rtcManager4 != null) {
rtcManager4.audioRouteToSpeaker(true);
}
}
if (getIsStreamer()) {
RtcManager rtcManager5 = this.rtcManager;
if (rtcManager5 != null && rtcManager5.isIMUserConnected()) {
setupLocalPreview();
RtcManager rtcManager6 = this.rtcManager;
if (rtcManager6 != null) {
rtcManager6.initBeautyService((View) getBinding().faceUnityView, getBinding().hostView.getGlSurfaceView());
}
starServiceFunc();
starServiceFunc();
getViewModel().getGifts();
}
}
if (getIsStreamer()) {
loginInRoom();
} else {
LiveStreamModel liveStreamDetails = getViewModel().getLiveStreamDetails();
if (liveStreamDetails != null) {
if (Intrinsics.areEqual(liveStreamDetails.getStatus(), "STARTED")) {
loginInRoom();
} else if (Intrinsics.areEqual(liveStreamDetails.getStatus(), "PAUSED")) {
getViewModel().setPlaying(false);
getViewModel().setPaused(true);
}
unit = Unit.INSTANCE;
} else {
unit = null;
}
if (unit == null) {
loginInRoom();
}
}
starServiceFunc();
getViewModel().getGifts();
}
private final void loginInRoom() {
Object accountId;
LocalRtcVideoView localRtcVideoView;
StreamerModel streamerModel;
String str = null;
if (getIsStreamer()) {
LiveStreamModel liveStreamDetails = getViewModel().getLiveStreamDetails();
accountId = liveStreamDetails != null ? Long.valueOf(liveStreamDetails.getStreamerId()) : null;
} else {
accountId = getViewModel().getAccountId();
}
LiveStreamModel liveStreamDetails2 = getViewModel().getLiveStreamDetails();
if (liveStreamDetails2 != null && (streamerModel = liveStreamDetails2.getStreamerModel()) != null) {
str = streamerModel.getName();
}
String str2 = str;
if (str2 == null || str2.length() == 0) {
str = "user_" + accountId;
}
Timber.e("USER Id " + accountId, new Object[0]);
Timber.e("USER name " + str, new Object[0]);
if (getIsStreamer()) {
RtcManager rtcManager = this.rtcManager;
if (rtcManager != null) {
rtcManager.useFrontCamera(true);
}
runOnUiThread(new Runnable() {
@Override
public final void run() {
LiveStreamingActivity.loginInRoom$lambda$76(LiveStreamingActivity.this);
}
});
} else {
LiveStreamModel liveStreamDetails3 = getViewModel().getLiveStreamDetails();
if (liveStreamDetails3 != null && (localRtcVideoView = this.mPreviewLayout) != null) {
localRtcVideoView.assignValueToUserId(String.valueOf(liveStreamDetails3.getStreamerId()));
}
}
String str3 = this.roomId;
String str4 = this.zegoToken;
String valueOf = String.valueOf(accountId);
String str5 = str.toString();
LiveStreamModel liveStreamDetails4 = getViewModel().getLiveStreamDetails();
Intrinsics.checkNotNull(liveStreamDetails4);
RtcRoomDetails rtcRoomDetails = new RtcRoomDetails(str3, str4, valueOf, str5, true, liveStreamDetails4.getStreamerId());
RtcManager rtcManager2 = this.rtcManager;
if (rtcManager2 != null) {
rtcManager2.joinRtcRoom(rtcRoomDetails);
}
}
public static final void loginInRoom$lambda$76(LiveStreamingActivity liveStreamingActivity) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
RtcManager rtcManager = liveStreamingActivity.rtcManager;
if (rtcManager != null) {
rtcManager.initBeautyService((View) liveStreamingActivity.getBinding().faceUnityView, liveStreamingActivity.getBinding().hostView.getGlSurfaceView());
}
}
public final void setupLocalPreview() {
LocalRtcVideoView localRtcVideoView;
if (!getIsStreamer() || (localRtcVideoView = this.mPreviewLayout) == null) {
return;
}
LiveStreamModel liveStreamDetails = getViewModel().getLiveStreamDetails();
localRtcVideoView.setUserIDForLiveStream(String.valueOf(liveStreamDetails != null ? Long.valueOf(liveStreamDetails.getStreamerId()) : null), getViewModel().getCurrentSDK());
}
public final void setProfileValues(LiveStreamModel liveStreamDetails) {
String str;
Timber.e("liveStreamDetails " + liveStreamDetails, new Object[0]);
if (getIsStreamer()) {
LinearLayout linearLayout = getBinding().streamerProfileParent;
Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.streamerProfileParent");
linearLayout.setVisibility(8);
} else if (liveStreamDetails != null) {
RequestManager with = Glide.with((FragmentActivity) this);
StreamerModel streamerModel = liveStreamDetails.getStreamerModel();
with.load(streamerModel != null ? StreamerModel.getProfile$default(streamerModel, false, 1, null) : null).into(getBinding().profilePic);
TextView textView = getBinding().streamerName;
StreamerModel streamerModel2 = liveStreamDetails.getStreamerModel();
textView.setText(streamerModel2 != null ? streamerModel2.getName() : null);
StreamerModel streamerModel3 = liveStreamDetails.getStreamerModel();
if (streamerModel3 == null || (str = StreamerModel.getProfile$default(streamerModel3, false, 1, null)) == null) {
str = "";
}
pauseLayout(str);
}
}
private final void pauseLayout(String profile) {
Glide.with((FragmentActivity) this).load(profile).apply(RequestOptions.bitmapTransform(new BlurTransformation(80, 2))).into(getBinding().blurProfile);
}
public final void reconnectingBox(boolean reconnecting) {
ActivityLiveStreamingBinding activityLiveStreamingBinding = this._binding;
LinearLayout linearLayout = activityLiveStreamingBinding != null ? activityLiveStreamingBinding.connectionBreakLayout : null;
if (linearLayout == null) {
return;
}
linearLayout.setVisibility(reconnecting ? 0 : 8);
}
public final void reinitializeStream() {
String str;
LiveStreamModel liveStreamDetails = getViewModel().getLiveStreamDetails();
if (liveStreamDetails == null || (str = liveStreamDetails.getLiveStreamProvider()) == null) {
str = "ZEGO";
}
this.rtcProvider = str;
this.localUserId = getViewModel().getAccountId();
setSdkName(this.rtcProvider);
RtcManagerFactory.createManager$default(null, this.rtcProvider, 1, null);
RtcManager currentRtcInstance = RtcManagerFactory.getCurrentRtcInstance();
this.rtcManager = currentRtcInstance;
if (currentRtcInstance != null) {
currentRtcInstance.setEventHandler(this.rtcEventHandler);
}
LocalRtcVideoView localRtcVideoView = this.mPreviewLayout;
if (localRtcVideoView != null) {
localRtcVideoView.recreateView();
}
RemoteRtcVideoView remoteRtcVideoView = this.mCoHostPreviewLayout;
if (remoteRtcVideoView != null) {
remoteRtcVideoView.recreateView();
}
setStreamerUI();
setUpGameLottieAnimation();
retrieveSharedPrefValues();
initUI();
Intent intent = new Intent();
intent.putExtra(LIVE_STREAM_ID, this.liveStreamId);
intent.putExtra("RTC_PROVIDER", this.rtcProvider);
intent.putExtra(ROOM_ID, this.roomId);
intent.putExtra(ZEGO_TOKEN, this.zegoToken);
LiveStreamModel liveStreamDetails2 = getViewModel().getLiveStreamDetails();
if (liveStreamDetails2 != null) {
intent.putExtra(LIVE_STREAM_MODEL, new Gson().toJson(liveStreamDetails2));
}
initValues(intent);
}
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode, Configuration newConfig) {
Intrinsics.checkNotNullParameter(newConfig, "newConfig");
if (Build.VERSION.SDK_INT >= 26) {
super.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig);
getViewModel().setInPictureInPictureMode(isInPictureInPictureMode);
handlePipModel(isInPictureInPictureMode);
}
}
private final void handlePipModel(boolean inPictureInPictureMode) {
StreamerUserLivestreamGame streamerUserGame;
StreamerUserLivestreamGame streamerUserGame2;
if (inPictureInPictureMode) {
resetHostViewToFullScreen(true);
LinearLayout linearLayout = getBinding().playLudo;
Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.playLudo");
linearLayout.setVisibility(8);
LinearLayout linearLayout2 = getBinding().cohostProfileParent;
Intrinsics.checkNotNullExpressionValue(linearLayout2, "binding.cohostProfileParent");
linearLayout2.setVisibility(8);
AppCompatTextView appCompatTextView = getBinding().cohostingTimeWithGame;
Intrinsics.checkNotNullExpressionValue(appCompatTextView, "binding.cohostingTimeWithGame");
((View) appCompatTextView).setVisibility(8);
TextView textView = getBinding().streamerMoreOptions;
Intrinsics.checkNotNullExpressionValue(textView, "binding.streamerMoreOptions");
textView.setVisibility(8);
LinearLayout linearLayout3 = getBinding().closeStream;
Intrinsics.checkNotNullExpressionValue(linearLayout3, "binding.closeStream");
linearLayout3.setVisibility(8);
LinearLayout linearLayout4 = getBinding().streamerProfileParent;
Intrinsics.checkNotNullExpressionValue(linearLayout4, "binding.streamerProfileParent");
linearLayout4.setVisibility(8);
LinearLayout linearLayout5 = getBinding().viewCountParent;
Intrinsics.checkNotNullExpressionValue(linearLayout5, "binding.viewCountParent");
linearLayout5.setVisibility(8);
RelativeLayout relativeLayout = getBinding().relativeLayout;
Intrinsics.checkNotNullExpressionValue(relativeLayout, "binding.relativeLayout");
relativeLayout.setVisibility(8);
LinearLayout linearLayout6 = getBinding().closeStreamBottomLayout;
Intrinsics.checkNotNullExpressionValue(linearLayout6, "binding.closeStreamBottomLayout");
linearLayout6.setVisibility(8);
ImageView imageView = getBinding().leaveButtonBottomLayout;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.leaveButtonBottomLayout");
imageView.setVisibility(8);
View view = getBinding().faceUnityView;
Intrinsics.checkNotNullExpressionValue(view, "binding.faceUnityView");
view.setVisibility(8);
ImageView imageView2 = getBinding().leaveButton;
Intrinsics.checkNotNullExpressionValue(imageView2, "binding.leaveButton");
imageView2.setVisibility(8);
FrameLayout frameLayout = getBinding().giftBtn;
Intrinsics.checkNotNullExpressionValue(frameLayout, "binding.giftBtn");
frameLayout.setVisibility(8);
if (getIsStreamer()) {
ImageView imageView3 = getBinding().leaveButtonDummy;
Intrinsics.checkNotNullExpressionValue(imageView3, "binding.leaveButtonDummy");
imageView3.setVisibility(8);
return;
} else {
ImageView imageView4 = getBinding().leaveButtonDummy;
Intrinsics.checkNotNullExpressionValue(imageView4, "binding.leaveButtonDummy");
imageView4.setVisibility(4);
return;
}
}
RelativeLayout relativeLayout2 = getBinding().relativeLayout;
Intrinsics.checkNotNullExpressionValue(relativeLayout2, "binding.relativeLayout");
relativeLayout2.setVisibility(0);
FrameLayout frameLayout2 = getBinding().giftBtn;
Intrinsics.checkNotNullExpressionValue(frameLayout2, "binding.giftBtn");
frameLayout2.setVisibility(0);
LinearLayout linearLayout7 = getBinding().viewCountParent;
Intrinsics.checkNotNullExpressionValue(linearLayout7, "binding.viewCountParent");
linearLayout7.setVisibility(0);
if (getIsStreamer()) {
ImageView imageView5 = getBinding().leaveButtonBottomLayout;
Intrinsics.checkNotNullExpressionValue(imageView5, "binding.leaveButtonBottomLayout");
ImageView imageView6 = imageView5;
RelativeLayout relativeLayout3 = getBinding().topLayout;
Intrinsics.checkNotNullExpressionValue(relativeLayout3, "binding.topLayout");
imageView6.setVisibility((relativeLayout3.getVisibility() == 0) ^ true ? 0 : 8);
ImageView imageView7 = getBinding().leaveButton;
Intrinsics.checkNotNullExpressionValue(imageView7, "binding.leaveButton");
imageView7.setVisibility(0);
ActivityLiveStreamingBinding activityLiveStreamingBinding = this._binding;
FrameLayout frameLayout3 = activityLiveStreamingBinding != null ? activityLiveStreamingBinding.beautyBtnParent : null;
if (frameLayout3 != null) {
FrameLayout frameLayout4 = frameLayout3;
RtcManager rtcManager = this.rtcManager;
frameLayout4.setVisibility(rtcManager != null && rtcManager.isAIEffectsEnabled((Context) this) ? 0 : 8);
}
ImageView imageView8 = getBinding().leaveButtonDummy;
Intrinsics.checkNotNullExpressionValue(imageView8, "binding.leaveButtonDummy");
imageView8.setVisibility(4);
LiveStreamModel liveStreamDetails = getViewModel().getLiveStreamDetails();
if ((liveStreamDetails != null ? liveStreamDetails.getStreamerUserGame() : null) != null) {
LiveStreamModel liveStreamDetails2 = getViewModel().getLiveStreamDetails();
if (Intrinsics.areEqual((liveStreamDetails2 == null || (streamerUserGame2 = liveStreamDetails2.getStreamerUserGame()) == null) ? null : streamerUserGame2.getStatus(), "STARTED")) {
LinearLayout linearLayout8 = getBinding().cohostProfileParent;
Intrinsics.checkNotNullExpressionValue(linearLayout8, "binding.cohostProfileParent");
linearLayout8.setVisibility(8);
AppCompatTextView appCompatTextView2 = getBinding().cohostingTimeWithGame;
Intrinsics.checkNotNullExpressionValue(appCompatTextView2, "binding.cohostingTimeWithGame");
((View) appCompatTextView2).setVisibility(0);
TextView textView2 = getBinding().streamerMoreOptions;
Intrinsics.checkNotNullExpressionValue(textView2, "binding.streamerMoreOptions");
textView2.setVisibility(0);
return;
}
}
LiveStreamModel liveStreamDetails3 = getViewModel().getLiveStreamDetails();
if ((liveStreamDetails3 != null ? liveStreamDetails3.getCohost() : null) != null) {
LinearLayout linearLayout9 = getBinding().cohostProfileParent;
Intrinsics.checkNotNullExpressionValue(linearLayout9, "binding.cohostProfileParent");
linearLayout9.setVisibility(0);
AppCompatTextView appCompatTextView3 = getBinding().cohostingTimeWithGame;
Intrinsics.checkNotNullExpressionValue(appCompatTextView3, "binding.cohostingTimeWithGame");
((View) appCompatTextView3).setVisibility(8);
TextView textView3 = getBinding().streamerMoreOptions;
Intrinsics.checkNotNullExpressionValue(textView3, "binding.streamerMoreOptions");
textView3.setVisibility(0);
return;
}
return;
}
LinearLayout linearLayout10 = getBinding().closeStream;
Intrinsics.checkNotNullExpressionValue(linearLayout10, "binding.closeStream");
linearLayout10.setVisibility(0);
LinearLayout linearLayout11 = getBinding().streamerProfileParent;
Intrinsics.checkNotNullExpressionValue(linearLayout11, "binding.streamerProfileParent");
linearLayout11.setVisibility(0);
LinearLayout linearLayout12 = getBinding().closeStreamBottomLayout;
Intrinsics.checkNotNullExpressionValue(linearLayout12, "binding.closeStreamBottomLayout");
LinearLayout linearLayout13 = linearLayout12;
RelativeLayout relativeLayout4 = getBinding().topLayout;
Intrinsics.checkNotNullExpressionValue(relativeLayout4, "binding.topLayout");
linearLayout13.setVisibility((relativeLayout4.getVisibility() == 0) ^ true ? 0 : 8);
LiveStreamModel liveStreamDetails4 = getViewModel().getLiveStreamDetails();
if ((liveStreamDetails4 != null ? liveStreamDetails4.getStreamerUserGame() : null) != null && this.isCohostEnabled) {
LiveStreamModel liveStreamDetails5 = getViewModel().getLiveStreamDetails();
if (Intrinsics.areEqual((liveStreamDetails5 == null || (streamerUserGame = liveStreamDetails5.getStreamerUserGame()) == null) ? null : streamerUserGame.getStatus(), "STARTED")) {
LinearLayout linearLayout14 = getBinding().cohostProfileParent;
Intrinsics.checkNotNullExpressionValue(linearLayout14, "binding.cohostProfileParent");
linearLayout14.setVisibility(8);
AppCompatTextView appCompatTextView4 = getBinding().cohostingTimeWithGame;
Intrinsics.checkNotNullExpressionValue(appCompatTextView4, "binding.cohostingTimeWithGame");
((View) appCompatTextView4).setVisibility(0);
return;
}
}
LiveStreamModel liveStreamDetails6 = getViewModel().getLiveStreamDetails();
if ((liveStreamDetails6 != null ? liveStreamDetails6.getCohost() : null) == null || !this.isCohostEnabled) {
return;
}
LinearLayout linearLayout15 = getBinding().cohostProfileParent;
Intrinsics.checkNotNullExpressionValue(linearLayout15, "binding.cohostProfileParent");
linearLayout15.setVisibility(0);
AppCompatTextView appCompatTextView5 = getBinding().cohostingTimeWithGame;
Intrinsics.checkNotNullExpressionValue(appCompatTextView5, "binding.cohostingTimeWithGame");
((View) appCompatTextView5).setVisibility(8);
}
protected void onUserLeaveHint() {
super.onUserLeaveHint();
if (this.isLivestreamLocked) {
return;
}
enablePip();
}
@Override
protected void onStop() {
super.onStop();
}
public void finish() {
if (getIsStreamer()) {
stopServiceFunc();
}
CoroutineScopeKt.cancel$default(this.scope, (CancellationException) null, 1, (Object) null);
Disposable disposable = this.disposable;
if (disposable != null) {
disposable.dispose();
}
Job job = this.reconnectionJob;
if (job != null) {
Job.DefaultImpls.cancel$default(job, (CancellationException) null, 1, (Object) null);
}
this.reconnectionJob = null;
this.isPopUpShown = false;
this.soundAlreadyPublishing = false;
Timber.d("Finish check = FINISH CALLED", new Object[0]);
moveTaskToBack(true);
finishCoHost();
removeTaskFromRecents();
super.finish();
}
private final void removeTaskFromRecents() {
try {
Object systemService = getSystemService("activity");
Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.app.ActivityManager");
for (ActivityManager.AppTask appTask : ((ActivityManager) systemService).getAppTasks()) {
if (appTask.getTaskInfo().id == getTaskId()) {
appTask.finishAndRemoveTask();
}
}
} catch (Exception e) {
String message = e.getMessage();
if (message == null) {
message = "Error";
}
Timber.e(message, new Object[0]);
finishAndRemoveTask();
}
}
@Override
protected void onDestroy() {
Dialog dialog;
super.onDestroy();
boolean z = false;
try {
if (getIsStreamer()) {
GiftTimerManager.INSTANCE.reset();
}
} catch (Exception e) {
Timber.e("Error: " + e, new Object[0]);
}
this.gameViewModel.destroyMG();
Job job = this.followDialogJob;
if (job != null) {
Job.DefaultImpls.cancel$default(job, (CancellationException) null, 1, (Object) null);
}
isLiveStreamScreenOpen = false;
try {
CallSheet callSheet = this.bottomSheet;
if (callSheet != null) {
callSheet.dismiss();
}
this.bottomSheet = null;
CohostCallSheet cohostCallSheet = this.cohostBottomSheet;
if (cohostCallSheet != null) {
cohostCallSheet.dismiss();
}
this.cohostBottomSheet = null;
VerifyNumberSheet verifyNumberSheet = this.verifyNumberFragment;
if (verifyNumberSheet != null) {
verifyNumberSheet.dismiss();
}
GamesBottomSheet gamesBottomSheet = this.gamesBottomSheet;
if (gamesBottomSheet != null) {
gamesBottomSheet.dismiss();
}
} catch (Exception e2) {
Timber.e(e2);
}
Dialog dialog2 = this.dialog;
if (dialog2 != null) {
if (dialog2 != null && dialog2.isShowing()) {
z = true;
}
if (z && (dialog = this.dialog) != null) {
dialog.dismiss();
}
}
if (isFinishing()) {
destroyItems(true, new Function0<Unit>() {
{
super(0);
}
public Object invoke() {
m1835invoke();
return Unit.INSTANCE;
}
public final void m1835invoke() {
LiveStreamViewModel viewModel;
viewModel = LiveStreamingActivity.this.getViewModel();
LiveStreamViewModel.endStream$default(viewModel, LiveStreamingActivity.this.getIsStreamer(), false, 0L, null, 14, null);
}
});
CustomPagerSnapHelper customPagerSnapHelper = this.pagerSnapHelper;
if (customPagerSnapHelper != null) {
customPagerSnapHelper.onDestroy();
}
stopPublishScreen();
}
unRegisterReceiver();
}
private final void finishCoHost() {
if (getIsStreamer()) {
return;
}
this.soundAlreadyPublishing = false;
if (getViewModel().getCurrentCohostId() != -1 && getViewModel().isCurrentUserCoHost()) {
RemoteRtcVideoView remoteRtcVideoView = this.mCoHostPreviewLayout;
if (remoteRtcVideoView != null) {
remoteRtcVideoView.stopAudioVideo();
}
RtcManager rtcManager = this.rtcManager;
if (rtcManager != null) {
rtcManager.openMicrophone(false);
}
RtcManager rtcManager2 = this.rtcManager;
if (rtcManager2 != null) {
rtcManager2.audioRouteToSpeaker(false);
}
getViewModel().endCohost(getIsStreamer(), getViewModel().getCurrentCohostId(), getViewModel().getCurrentPosition());
LiveStreamViewModel.endStream$default(getViewModel(), getIsStreamer(), false, 0L, null, 14, null);
}
stopCohostServiceFunc();
}
static void destroyItems$default(LiveStreamingActivity liveStreamingActivity, boolean z, Function0 function0, int i, Object obj) {
if ((i & 1) != 0) {
z = false;
}
liveStreamingActivity.destroyItems(z, function0);
}
private final void destroyItems(boolean destroyAll, final Function0<Unit> singOutSuccess) {
if (getIsStreamer()) {
return;
}
CoroutineScopeKt.cancel$default(this.scope, (CancellationException) null, 1, (Object) null);
Disposable disposable = this.disposable;
if (disposable != null) {
disposable.dispose();
}
RtcManager rtcManager = this.rtcManager;
if (rtcManager != null) {
rtcManager.disconnectUser(destroyAll);
}
RtcManager rtcManager2 = this.rtcManager;
if (rtcManager2 != null) {
rtcManager2.leaveRtcRoom(new SignOutListener() {
@Override
public final void signOut() {
LiveStreamingActivity.destroyItems$lambda$81(singOutSuccess);
}
});
}
RtcManager rtcManager3 = this.rtcManager;
if (rtcManager3 != null) {
rtcManager3.setEventHandler(null);
}
}
public static final void destroyItems$lambda$81(Function0 function0) {
Intrinsics.checkNotNullParameter(function0, "$singOutSuccess");
function0.invoke();
}
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Timber.d("Method called - onNewIntent", new Object[0]);
resetStreamer(intent);
}
private final void resetStreamer(final Intent intent) {
if (getIsStreamer()) {
return;
}
final long longExtra = intent != null ? intent.getLongExtra(LIVE_STREAM_ID, -1L) : -1L;
if (longExtra != getViewModel().getLiveStreamId()) {
if (getViewModel().isCurrentUserCoHost()) {
LiveStreamViewModel.endStream$default(getViewModel(), getIsStreamer(), true, longExtra, null, 8, null);
String string = getString(2131951852);
Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.co_host_already_joined_message)");
ActivityExtKt.toast((Activity) this, string);
return;
}
resetViewsToDefault(true);
destroyItems$default(this, false, new Function0<Unit>() {
{
super(0);
}
public Object invoke() {
m1849invoke();
return Unit.INSTANCE;
}
public final void m1849invoke() {
CoroutineContext coroutineContext;
LocalRtcVideoView localRtcVideoView;
LocalRtcVideoView localRtcVideoView2;
LiveStreamViewModel viewModel;
LiveStreamViewModel viewModel2;
LiveStreamViewModel viewModel3;
LiveStreamViewModel viewModel4;
LiveStreamViewModel viewModel5;
LiveStreamViewModel viewModel6;
LiveStreamViewModel viewModel7;
CoroutineScope coroutineScope;
Job job;
LiveStreamViewModel viewModel8;
ActivityLiveStreamingBinding binding;
boolean z;
ActivityLiveStreamingBinding binding2;
ActivityLiveStreamingBinding binding3;
ActivityLiveStreamingBinding binding4;
ActivityLiveStreamingBinding binding5;
Queue queue;
LiveStreamGiftAnimationAdapter liveStreamGiftAnimationAdapter;
LiveStreamViewModel viewModel9;
LiveCoverAdapter liveCoverAdapter;
LiveCoverAdapter liveCoverAdapter2;
NoScrollRecyclerView noScrollRecyclerView;
try {
viewModel8 = LiveStreamingActivity.this.getViewModel();
LiveStreamViewModel.endStream$default(viewModel8, LiveStreamingActivity.this.getIsStreamer(), true, 0L, null, 12, null);
binding = LiveStreamingActivity.this.getBinding();
LinearLayout linearLayout = binding.applyToCohost;
Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.applyToCohost");
LinearLayout linearLayout2 = linearLayout;
z = LiveStreamingActivity.this.isCohostEnabled;
linearLayout2.setVisibility(z ? 0 : 8);
binding2 = LiveStreamingActivity.this.getBinding();
LinearLayout linearLayout3 = binding2.endCohostUser;
Intrinsics.checkNotNullExpressionValue(linearLayout3, "binding.endCohostUser");
linearLayout3.setVisibility(8);
binding3 = LiveStreamingActivity.this.getBinding();
LinearLayout linearLayout4 = binding3.cohostProfileParent;
Intrinsics.checkNotNullExpressionValue(linearLayout4, "binding.cohostProfileParent");
linearLayout4.setVisibility(8);
binding4 = LiveStreamingActivity.this.getBinding();
AppCompatTextView appCompatTextView = binding4.cohostingTimeWithGame;
Intrinsics.checkNotNullExpressionValue(appCompatTextView, "binding.cohostingTimeWithGame");
((View) appCompatTextView).setVisibility(8);
binding5 = LiveStreamingActivity.this.getBinding();
ImageView imageView = binding5.animationView;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.animationView");
imageView.setVisibility(8);
queue = LiveStreamingActivity.this.giftAnimationQueue;
queue.clear();
liveStreamGiftAnimationAdapter = LiveStreamingActivity.this.giftAnimationAdapter;
if (liveStreamGiftAnimationAdapter != null && liveStreamGiftAnimationAdapter.getMessages().size() > 0) {
liveStreamGiftAnimationAdapter.clear();
}
viewModel9 = LiveStreamingActivity.this.getViewModel();
viewModel9.getLiveStreamers().clear();
liveCoverAdapter = LiveStreamingActivity.this.liveCoverAdapter;
if (liveCoverAdapter != null) {
liveCoverAdapter.clear();
}
liveCoverAdapter2 = LiveStreamingActivity.this.liveCoverAdapter;
if (liveCoverAdapter2 != null) {
liveCoverAdapter2.updateCurrentPosition(0);
}
noScrollRecyclerView = LiveStreamingActivity.this.liveCoverRecyclerView;
if (noScrollRecyclerView != null) {
noScrollRecyclerView.setScrollEnabled(true);
}
} catch (Exception e) {
Timber.e(e);
}
LiveStreamingActivity.this.job = SupervisorKt.SupervisorJob$default((Job) null, 1, (Object) null);
LiveStreamingActivity liveStreamingActivity = LiveStreamingActivity.this;
MainCoroutineDispatcher main = Dispatchers.getMain();
coroutineContext = LiveStreamingActivity.this.job;
liveStreamingActivity.scope = CoroutineScopeKt.CoroutineScope(main.plus(coroutineContext));
Intent intent2 = intent;
if (intent2 != null) {
LifecycleOwner lifecycleOwner = LiveStreamingActivity.this;
long j = longExtra;
viewModel2 = lifecycleOwner.getViewModel();
if (viewModel2.getLiveStreamDetails() != null) {
((LiveStreamingActivity) lifecycleOwner).zegoToken = String.valueOf(intent2.getStringExtra(LiveStreamingActivity.ZEGO_TOKEN));
((LiveStreamingActivity) lifecycleOwner).roomId = String.valueOf(intent2.getStringExtra(LiveStreamingActivity.ROOM_ID));
viewModel3 = lifecycleOwner.getViewModel();
viewModel3.setLiveStreamId(j);
((LiveStreamingActivity) lifecycleOwner).liveStreamId = j;
String stringExtra = intent2.getStringExtra(LiveStreamingActivity.LIVE_STREAM_MODEL);
String str = stringExtra;
if (!(str == null || StringsKt.isBlank(str))) {
LiveStreamModel liveStreamModel = (LiveStreamModel) new Gson().fromJson(stringExtra, LiveStreamModel.class);
String zegoToken = liveStreamModel.getZegoToken();
if (zegoToken == null) {
zegoToken = "";
}
((LiveStreamingActivity) lifecycleOwner).zegoToken = zegoToken;
((LiveStreamingActivity) lifecycleOwner).roomId = liveStreamModel.getRoomId();
viewModel4 = lifecycleOwner.getViewModel();
viewModel4.setLiveStreamDetails(liveStreamModel);
viewModel5 = lifecycleOwner.getViewModel();
lifecycleOwner.setProfileValues(viewModel5.getLiveStreamDetails());
viewModel6 = lifecycleOwner.getViewModel();
viewModel6.setPaused(false);
viewModel7 = lifecycleOwner.getViewModel();
viewModel7.setPlaying(true);
lifecycleOwner.reinitializeStream();
coroutineScope = ((LiveStreamingActivity) lifecycleOwner).scope;
BuildersKt.launch$default(coroutineScope, (CoroutineContext) null, (CoroutineStart) null, new LiveStreamingActivity$resetStreamer$1$2$1$1(lifecycleOwner, null), 3, (Object) null);
((LiveStreamingActivity) lifecycleOwner).liveWatchedFor60Seconds = false;
job = ((LiveStreamingActivity) lifecycleOwner).followDialogJob;
if (job != null) {
Job.DefaultImpls.cancel$default(job, (CancellationException) null, 1, (Object) null);
}
((LiveStreamingActivity) lifecycleOwner).followDialogJob = BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope(lifecycleOwner), (CoroutineContext) null, (CoroutineStart) null, new LiveStreamingActivity$resetStreamer$1$2$1$2(lifecycleOwner, null), 3, (Object) null);
}
}
}
LiveStreamMessageAdapter adapter = LiveStreamingActivity.this.getAdapter();
if (adapter != null) {
adapter.clear();
}
LiveStreamMessageAdapter adapter2 = LiveStreamingActivity.this.getAdapter();
if (adapter2 != null) {
adapter2.setGuidelinesShown(false);
}
localRtcVideoView = LiveStreamingActivity.this.mPreviewLayout;
TextureView textureView = localRtcVideoView != null ? localRtcVideoView.getTextureView() : null;
if (textureView != null) {
textureView.setAlpha(0.0f);
}
localRtcVideoView2 = LiveStreamingActivity.this.mPreviewLayout;
if (localRtcVideoView2 != null) {
localRtcVideoView2.resetUserId();
}
viewModel = LiveStreamingActivity.this.getViewModel();
LiveStreamViewModel.getLiveStreamersList$default(viewModel, false, 1, null);
}
}, 1, null);
}
}
private final void stopPublishScreen() {
getIsStreamer();
}
private final boolean isLastVisible() {
try {
if (this._binding == null) {
return true;
}
CustomLinearLayoutManager layoutManager = getBinding().chatRV.getLayoutManager();
Intrinsics.checkNotNull(layoutManager, "null cannot be cast to non-null type app.callpe.common.utils.custom.CustomLinearLayoutManager");
int findLastVisibleItemPosition = layoutManager.findLastVisibleItemPosition();
Timber.i("Last visible position " + findLastVisibleItemPosition, new Object[0]);
if (getBinding().chatRV.getAdapter() == null) {
return false;
}
LiveStreamMessageAdapter liveStreamMessageAdapter = this.adapter;
return findLastVisibleItemPosition >= (liveStreamMessageAdapter != null ? liveStreamMessageAdapter.getItemCount() : 0) + (-2);
} catch (Exception e) {
Timber.e(e);
return false;
}
}
public final void starServiceFunc() {
Intent intent;
try {
if (getIsStreamer()) {
LiveStreamingService liveStreamingService = new LiveStreamingService();
this.liveStreamingService = liveStreamingService;
Intent intent2 = new Intent((Context) this, liveStreamingService.getClass());
this.mServiceIntent = intent2;
intent2.putExtra(ZEGO_TOKEN, this.zegoToken);
Intent intent3 = this.mServiceIntent;
if (intent3 != null) {
intent3.putExtra(LIVE_STREAM_ID, this.liveStreamId);
}
Intent intent4 = this.mServiceIntent;
if (intent4 != null) {
intent4.putExtra("RTC_PROVIDER", this.rtcProvider);
}
Intent intent5 = this.mServiceIntent;
if (intent5 != null) {
intent5.putExtra(ROOM_ID, this.roomId);
}
LiveStreamModel liveStreamDetails = getViewModel().getLiveStreamDetails();
if (liveStreamDetails != null && (intent = this.mServiceIntent) != null) {
intent.putExtra(LIVE_STREAM_MODEL, new Gson().toJson(liveStreamDetails));
}
if (!Utils.isMyServiceRunning(liveStreamingService.getClass(), (Activity) this)) {
startService(this.mServiceIntent);
Timber.d("Service started successfully", new Object[0]);
} else {
Timber.d("Service is already running", new Object[0]);
}
}
} catch (Exception e) {
Timber.e(e);
}
}
public final void stopServiceFunc() {
LiveStreamingService liveStreamingService;
if (getIsStreamer() && (liveStreamingService = this.liveStreamingService) != null) {
this.mServiceIntent = new Intent((Context) this, liveStreamingService.getClass());
if (Utils.isMyServiceRunning(liveStreamingService.getClass(), (Activity) this)) {
stopService(this.mServiceIntent);
Timber.d("Service stopped!!", new Object[0]);
} else {
Timber.d("Service is already stopped!!", new Object[0]);
}
}
}
public final void startCostServiceFunc() {
Intent intent;
try {
if (getIsStreamer() || this.isCohostServiceRunning) {
return;
}
this.isCohostServiceRunning = true;
UserCohostService userCohostService = new UserCohostService();
this.userCohostService = userCohostService;
Intent intent2 = new Intent((Context) this, userCohostService.getClass());
this.mUserCohostServiceIntent = intent2;
intent2.putExtra(ZEGO_TOKEN, this.zegoToken);
Intent intent3 = this.mUserCohostServiceIntent;
if (intent3 != null) {
intent3.putExtra(LIVE_STREAM_ID, this.liveStreamId);
}
Intent intent4 = this.mUserCohostServiceIntent;
if (intent4 != null) {
intent4.putExtra("RTC_PROVIDER", this.rtcProvider);
}
Intent intent5 = this.mUserCohostServiceIntent;
if (intent5 != null) {
intent5.putExtra(ROOM_ID, this.roomId);
}
LiveStreamModel liveStreamDetails = getViewModel().getLiveStreamDetails();
if (liveStreamDetails != null && (intent = this.mUserCohostServiceIntent) != null) {
intent.putExtra(LIVE_STREAM_MODEL, new Gson().toJson(liveStreamDetails));
}
Intent intent6 = this.mUserCohostServiceIntent;
if (intent6 != null) {
intent6.putExtra(COHOST_ID, getViewModel().getCurrentCohostId());
}
if (!Utils.isMyServiceRunning(userCohostService.getClass(), (Activity) this)) {
startService(this.mUserCohostServiceIntent);
Timber.d("Co-host Service started successfully", new Object[0]);
} else {
Timber.d("Co-host Service is already running", new Object[0]);
}
} catch (Exception e) {
Timber.e(e);
}
}
public final void stopCohostServiceFunc() {
if (!getIsStreamer() && this.isCohostServiceRunning) {
this.isCohostServiceRunning = false;
UserCohostService userCohostService = this.userCohostService;
if (userCohostService != null) {
Intent intent = new Intent((Context) this, userCohostService.getClass());
intent.setAction(Constants.END_COHOSTING);
this.mUserCohostServiceIntent = intent;
intent.putExtra(COHOST_ID, getViewModel().getCurrentCohostId());
if (Utils.isMyServiceRunning(userCohostService.getClass(), (Activity) this)) {
stopService(this.mUserCohostServiceIntent);
Timber.d("Cohost Service stopped!!", new Object[0]);
} else {
Timber.d("Cohost Service is already stopped!!", new Object[0]);
}
}
}
}
private final void sendCohostBroadcastInfo(String action) {
Intent intent = new Intent((Context) this, (Class<?>) UserCohostBroadcastReceiver.class);
intent.setAction(action);
intent.putExtra(FROM_LIVE_SCREEN, true);
sendBroadcast(intent);
}
private final void startSudGame(final StreamerUserLivestreamGame streamerUserLivestreamGame) {
if (this.sudGameAlreadyStarted) {
return;
}
String gameRoomId = streamerUserLivestreamGame.getGameRoomId();
Context context = (Context) this;
this.gameViewModel.sessionToken = SharedPref.getString(context, PrefKeys.AUTH_TOKEN);
this.gameViewModel.userId = String.valueOf(streamerUserLivestreamGame.getUserId());
this.gameViewModel.gameViewLiveData.observe((LifecycleOwner) this, new LiveStreamingActivity$sam$androidx_lifecycle_Observer$0(new Function1<View, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke((View) obj);
return Unit.INSTANCE;
}
public final void invoke(View view) {
ActivityLiveStreamingBinding binding;
ActivityLiveStreamingBinding binding2;
ActivityLiveStreamingBinding binding3;
ActivityLiveStreamingBinding binding4;
ActivityLiveStreamingBinding binding5;
ActivityLiveStreamingBinding binding6;
ActivityLiveStreamingBinding binding7;
ActivityLiveStreamingBinding binding8;
ActivityLiveStreamingBinding binding9;
ActivityLiveStreamingBinding binding10;
ActivityLiveStreamingBinding binding11;
ActivityLiveStreamingBinding binding12;
if (view == null) {
binding11 = LiveStreamingActivity.this.getBinding();
binding11.ludoGameView.removeAllViews();
binding12 = LiveStreamingActivity.this.getBinding();
binding12.ludoGameViewMain.removeAllViews();
return;
}
binding = LiveStreamingActivity.this.getBinding();
binding.ludoGameView.removeAllViews();
binding2 = LiveStreamingActivity.this.getBinding();
binding2.ludoGameViewMain.removeAllViews();
int streamerId = LiveStreamingActivity.this.getIsStreamer() ? streamerUserLivestreamGame.getStreamerId() : streamerUserLivestreamGame.getUserId();
if (LiveStreamingActivity.this.getIsStreamer() || Intrinsics.areEqual(LiveStreamingActivity.this.getLocalUserId(), String.valueOf(streamerId))) {
binding3 = LiveStreamingActivity.this.getBinding();
binding3.ludoGameView.setVisibility(4);
binding4 = LiveStreamingActivity.this.getBinding();
binding4.ludoGameViewMain.setVisibility(0);
binding5 = LiveStreamingActivity.this.getBinding();
binding5.overlapingLayout.setDisableSwipe(true);
binding6 = LiveStreamingActivity.this.getBinding();
binding6.ludoGameViewMain.addView(view, -1, -1);
return;
}
binding7 = LiveStreamingActivity.this.getBinding();
binding7.ludoGameViewMain.setVisibility(4);
binding8 = LiveStreamingActivity.this.getBinding();
binding8.ludoGameView.setVisibility(0);
binding9 = LiveStreamingActivity.this.getBinding();
binding9.overlapingLayout.setDisableSwipe(false);
binding10 = LiveStreamingActivity.this.getBinding();
binding10.ludoGameView.addView(view, -1, -1);
}
}));
GameViewInfoModel.GameViewRectModel gameViewRectModel = new GameViewInfoModel.GameViewRectModel();
gameViewRectModel.left = 0;
gameViewRectModel.top = DensityUtils.dp2px(context, 54.0f);
gameViewRectModel.right = 0;
gameViewRectModel.bottom = DensityUtils.dp2px(context, 54.0f);
this.gameViewModel.gameViewRectModel = gameViewRectModel;
GameConfigModel gameConfigModel = this.gameViewModel.getGameConfigModel();
Intrinsics.checkNotNullExpressionValue(gameConfigModel, "gameViewModel.getGameConfigModel()");
gameConfigModel.viewScale = 0.8f;
gameConfigModel.ui.ping.hide = true;
gameConfigModel.ui.ob_pnl.hide = true;
gameConfigModel.ui.version.hide = true;
gameConfigModel.ui.game_selected_tips.hide = true;
gameConfigModel.ui.game_settle_again_btn.hide = true;
gameConfigModel.ui.game_settle_close_btn.hide = true;
gameConfigModel.ui.game_managed_image.hide = true;
this.gameViewModel.languageCode = SystemUtils.getLanguageCode(context);
this.gameViewModel.setDataCallback(new DataCallback() {
public final void onDataChanged(Object obj) {
LiveStreamingActivity.startSudGame$lambda$91(LiveStreamingActivity.this, obj);
}
});
this.gameViewModel.switchGame((Activity) this, gameRoomId, 1468180338417074177L);
this.gameViewModel.addPauseAsyncMgId(1468180338417074177L);
this.sudGameAlreadyStarted = true;
}
public static final void startSudGame$lambda$91(LiveStreamingActivity liveStreamingActivity, Object obj) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
Intrinsics.checkNotNullParameter(obj, "data");
if (obj instanceof SudMGPMGState.MGCommonGameSettle) {
liveStreamingActivity.gameViewModel.handler.postDelayed(new Runnable() {
@Override
public final void run() {
LiveStreamingActivity.startSudGame$lambda$91$lambda$90();
}
}, 3000L);
} else if (obj instanceof LoadingScreen) {
((LoadingScreen) obj).isShow();
}
}
public static final void startSudGame$lambda$91$lambda$90() {
Timber.i("Game finished", new Object[0]);
}
@Override
protected void onResume() {
super.onResume();
Timber.d("Method called - onResume", new Object[0]);
refresh();
if (!getIsStreamer() && !this.firstRecharge) {
this.firstRecharge = SharedPref.getBoolean((Context) this, PrefKeys.FIRST_RECHARGE_DONE);
}
RtcManager rtcManager = this.rtcManager;
if (rtcManager != null) {
rtcManager.onResume();
}
}
public final CallSheet getBottomSheet() {
return this.bottomSheet;
}
public final void setBottomSheet(CallSheet callSheet) {
this.bottomSheet = callSheet;
}
private final void openCallSheet(StreamerModel streamer) {
CallSheet callSheet;
try {
CallSheet callSheet2 = new CallSheet(getViewModel().getBalance(), streamer, new LiveStreamingActivity$openCallSheet$1(streamer, this), new Function1<Boolean, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke(((Boolean) obj).booleanValue());
return Unit.INSTANCE;
}
public final void invoke(boolean z) {
try {
String string = LiveStreamingActivity.this.getString(2131952498);
LiveStreamingActivity$openCallSheet$2$bottomSheet$1 liveStreamingActivity$openCallSheet$2$bottomSheet$1 = new Function0<Unit>() {
public final void m1841invoke() {
}
public Object invoke() {
m1841invoke();
return Unit.INSTANCE;
}
};
final LiveStreamingActivity liveStreamingActivity = LiveStreamingActivity.this;
RechargeDialog rechargeDialog = new RechargeDialog(null, null, null, string, null, liveStreamingActivity$openCallSheet$2$bottomSheet$1, new Function0<Unit>() {
{
super(0);
}
public Object invoke() {
m1842invoke();
return Unit.INSTANCE;
}
public final void m1842invoke() {
LiveStreamViewModel viewModel;
viewModel = LiveStreamingActivity.this.getViewModel();
viewModel.getUserDetails();
}
});
rechargeDialog.setCancelable(true);
if (!rechargeDialog.isAdded() && !rechargeDialog.isVisible()) {
rechargeDialog.show(LiveStreamingActivity.this.getSupportFragmentManager(), "RechargeDialog");
}
} catch (Exception unused) {
LiveStreamingActivity liveStreamingActivity2 = LiveStreamingActivity.this;
Activity activity = (Activity) liveStreamingActivity2;
String string2 = liveStreamingActivity2.getString(2131951993);
Intrinsics.checkNotNullExpressionValue(string2, "getString(R.string.error_unknown)");
ActivityExtKt.toast(activity, string2);
}
}
});
this.bottomSheet = callSheet2;
boolean isAdded = callSheet2.isAdded();
boolean z = false;
if (isAdded) {
return;
}
CallSheet callSheet3 = this.bottomSheet;
if (callSheet3 != null && callSheet3.isVisible()) {
z = true;
}
if (z || (callSheet = this.bottomSheet) == null) {
return;
}
callSheet.show(getSupportFragmentManager(), "bottomSheet");
} catch (Exception e) {
Timber.e(e);
}
}
static void openCoHostCallSheet$default(LiveStreamingActivity liveStreamingActivity, LiveStreamModel liveStreamModel, boolean z, int i, Object obj) {
if ((i & 2) != 0) {
z = false;
}
liveStreamingActivity.openCoHostCallSheet(liveStreamModel, z);
}
private final void openCoHostCallSheet(final LiveStreamModel liveStreamModel, final boolean forLudo) {
CohostCallSheet cohostCallSheet;
try {
CohostCallSheet cohostCallSheet2 = new CohostCallSheet(liveStreamModel, this.hideStreamerCallRate, forLudo, new Function1<Boolean, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke(((Boolean) obj).booleanValue());
return Unit.INSTANCE;
}
public final void invoke(boolean z) {
LiveStreamViewModel viewModel;
double cohostUserRate;
LiveStreamViewModel viewModel2;
LiveStreamViewModel viewModel3;
LiveStreamViewModel viewModel4;
LiveStreamViewModel viewModel5;
LiveStreamViewModel viewModel6;
LiveStreamViewModel viewModel7;
String format;
LiveStreamViewModel viewModel8;
String string;
if (z) {
if (!LiveStreamingActivity.this.getHideStreamerCallRate() || LiveStreamingActivity.this.getFirstRechargeDone()) {
try {
viewModel = LiveStreamingActivity.this.getViewModel();
if (viewModel.getIsVip()) {
cohostUserRate = liveStreamModel.getCohostUserRate();
} else {
cohostUserRate = liveStreamModel.getCohostUserRate();
}
viewModel2 = LiveStreamingActivity.this.getViewModel();
if (viewModel2.getBalance() != null) {
viewModel7 = LiveStreamingActivity.this.getViewModel();
Balance balance = viewModel7.getBalance();
Intrinsics.checkNotNull(balance);
if (balance.getBalance() < cohostUserRate) {
try {
if (forLudo) {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String string2 = LiveStreamingActivity.this.getString(2131952504);
Intrinsics.checkNotNullExpressionValue(string2, "getString(R.string.recha…ssage_with_rate_for_ludo)");
format = String.format(string2, Arrays.copyOf(new Object[]{NumberExtKt.formatByNumberRupee$default(cohostUserRate, false, 1, (Object) null)}, 1));
Intrinsics.checkNotNullExpressionValue(format, "format(format, *args)");
} else {
StringCompanionObject stringCompanionObject2 = StringCompanionObject.INSTANCE;
String string3 = LiveStreamingActivity.this.getString(2131952503);
Intrinsics.checkNotNullExpressionValue(string3, "getString(R.string.recharge_message_with_rate)");
format = String.format(string3, Arrays.copyOf(new Object[]{NumberExtKt.formatByNumberRupee$default(cohostUserRate, false, 1, (Object) null)}, 1));
Intrinsics.checkNotNullExpressionValue(format, "format(format, *args)");
}
viewModel8 = LiveStreamingActivity.this.getViewModel();
Balance balance2 = viewModel8.getBalance();
Intrinsics.checkNotNull(balance2);
Double valueOf = Double.valueOf(cohostUserRate);
LiveStreamingActivity$openCoHostCallSheet$1$bottomSheet$3 liveStreamingActivity$openCoHostCallSheet$1$bottomSheet$3 = new Function0<Unit>() {
public final void m1845invoke() {
}
public Object invoke() {
m1845invoke();
return Unit.INSTANCE;
}
};
final LiveStreamingActivity liveStreamingActivity = LiveStreamingActivity.this;
RechargeDialog rechargeDialog = new RechargeDialog(null, balance2, null, format, valueOf, liveStreamingActivity$openCoHostCallSheet$1$bottomSheet$3, new Function0<Unit>() {
{
super(0);
}
public Object invoke() {
m1846invoke();
return Unit.INSTANCE;
}
public final void m1846invoke() {
LiveStreamViewModel viewModel9;
viewModel9 = LiveStreamingActivity.this.getViewModel();
viewModel9.getUserDetails();
}
});
rechargeDialog.setCancelable(true);
if (!rechargeDialog.isAdded() && !rechargeDialog.isVisible()) {
rechargeDialog.show(LiveStreamingActivity.this.getSupportFragmentManager(), "RechargeDialog");
return;
}
return;
} catch (Exception unused) {
LiveStreamingActivity liveStreamingActivity2 = LiveStreamingActivity.this;
Activity activity = (Activity) liveStreamingActivity2;
String string4 = liveStreamingActivity2.getString(2131951993);
Intrinsics.checkNotNullExpressionValue(string4, "getString(R.string.error_unknown)");
ActivityExtKt.toast(activity, string4);
return;
}
}
}
CohostModel cohost = liveStreamModel.getCohost();
if (cohost != null) {
LiveStreamingActivity liveStreamingActivity3 = LiveStreamingActivity.this;
String valueOf2 = String.valueOf(cohost.getUserId());
viewModel6 = liveStreamingActivity3.getViewModel();
if (Intrinsics.areEqual(valueOf2, viewModel6.getAccountId())) {
return;
}
}
if (forLudo) {
viewModel5 = LiveStreamingActivity.this.getViewModel();
long id = liveStreamModel.getId();
CohostModel cohost2 = liveStreamModel.getCohost();
viewModel5.createSudGame(id, cohost2 != null ? Long.valueOf(cohost2.getId()) : null);
return;
}
viewModel3 = LiveStreamingActivity.this.getViewModel();
long id2 = liveStreamModel.getId();
viewModel4 = LiveStreamingActivity.this.getViewModel();
LiveStreamViewModel.initiateCohostRequest$default(viewModel3, id2, viewModel4.getCurrentPosition(), false, 4, null);
return;
} catch (Exception e) {
Timber.e(e);
return;
}
}
try {
if (forLudo) {
string = LiveStreamingActivity.this.getString(2131952499);
} else {
string = LiveStreamingActivity.this.getString(2131952498);
}
String str = string;
Intrinsics.checkNotNullExpressionValue(str, "if (forLudo) {\n … }");
LiveStreamingActivity$openCoHostCallSheet$1$bottomSheet$1 liveStreamingActivity$openCoHostCallSheet$1$bottomSheet$1 = new Function0<Unit>() {
public final void m1843invoke() {
}
public Object invoke() {
m1843invoke();
return Unit.INSTANCE;
}
};
final LiveStreamingActivity liveStreamingActivity4 = LiveStreamingActivity.this;
RechargeDialog rechargeDialog2 = new RechargeDialog(null, null, null, str, null, liveStreamingActivity$openCoHostCallSheet$1$bottomSheet$1, new Function0<Unit>() {
{
super(0);
}
public Object invoke() {
m1844invoke();
return Unit.INSTANCE;
}
public final void m1844invoke() {
LiveStreamViewModel viewModel9;
viewModel9 = LiveStreamingActivity.this.getViewModel();
viewModel9.getUserDetails();
}
});
rechargeDialog2.setCancelable(true);
if (!rechargeDialog2.isAdded() && !rechargeDialog2.isVisible()) {
rechargeDialog2.show(LiveStreamingActivity.this.getSupportFragmentManager(), "RechargeDialog");
}
} catch (Exception unused2) {
LiveStreamingActivity liveStreamingActivity5 = LiveStreamingActivity.this;
Activity activity2 = (Activity) liveStreamingActivity5;
String string5 = liveStreamingActivity5.getString(2131951993);
Intrinsics.checkNotNullExpressionValue(string5, "getString(R.string.error_unknown)");
ActivityExtKt.toast(activity2, string5);
}
}
}
});
this.cohostBottomSheet = cohostCallSheet2;
boolean z = false;
if (cohostCallSheet2.isAdded()) {
return;
}
CohostCallSheet cohostCallSheet3 = this.cohostBottomSheet;
if (cohostCallSheet3 != null && cohostCallSheet3.isVisible()) {
z = true;
}
if (z || (cohostCallSheet = this.cohostBottomSheet) == null) {
return;
}
cohostCallSheet.show(getSupportFragmentManager(), "bottomSheet");
} catch (Exception e) {
Timber.e(e);
}
}
private final void openCoHostMoreOption(final LiveStreamModel liveStreamModel) {
if (LoginActivity.INSTANCE.isVitok()) {
StreamerMoreOptionDialogLayoutBinding inflate = StreamerMoreOptionDialogLayoutBinding.inflate(getLayoutInflater());
Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
LinearLayout root = inflate.getRoot();
Intrinsics.checkNotNullExpressionValue(root, "binding.root");
AlertDialog.Builder builder = new AlertDialog.Builder((Context) this);
builder.setView(root);
final AlertDialog create = builder.create();
Intrinsics.checkNotNullExpressionValue(create, "alertDialogBuilder.create()");
create.show();
inflate.btnKickUser.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.openCoHostMoreOption$lambda$94(create, this, liveStreamModel, view);
}
});
}
}
public static final void openCoHostMoreOption$lambda$94(AlertDialog alertDialog, final LiveStreamingActivity liveStreamingActivity, final LiveStreamModel liveStreamModel, View view) {
Intrinsics.checkNotNullParameter(alertDialog, "$alertDialog");
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
Intrinsics.checkNotNullParameter(liveStreamModel, "$liveStreamModel");
alertDialog.dismiss();
try {
DialogHelper.showReasonDialog((Context) liveStreamingActivity, "", "Are you sure you want to end Co-host?", true, new DialogHelper.ConfirmationListener() {
@Override
public final void onPositiveClick() {
LiveStreamingActivity.openCoHostMoreOption$lambda$94$lambda$93(LiveStreamModel.this, liveStreamingActivity);
}
});
} catch (Exception e) {
Timber.e(e);
}
}
public static final void openCoHostMoreOption$lambda$94$lambda$93(LiveStreamModel liveStreamModel, LiveStreamingActivity liveStreamingActivity) {
Intrinsics.checkNotNullParameter(liveStreamModel, "$liveStreamModel");
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
CohostModel cohost = liveStreamModel.getCohost();
if (cohost != null) {
liveStreamingActivity.getViewModel().endCohost(liveStreamingActivity.getIsStreamer(), cohost.getId(), liveStreamingActivity.getViewModel().getCurrentPosition());
}
}
private final void requestPermissionIfNeeded(final List<String> permissions, final RequestCallback requestCallback) {
Iterator<String> it = permissions.iterator();
boolean z = true;
while (it.hasNext()) {
if (ContextCompat.checkSelfPermission((Context) this, it.next()) != 0) {
z = false;
}
}
if (!z) {
PermissionX.init((FragmentActivity) this).permissions(permissions).onExplainRequestReason(new ExplainReasonCallback() {
public final void onExplainReason(ExplainScope explainScope, List list) {
LiveStreamingActivity.requestPermissionIfNeeded$lambda$95(permissions, this, explainScope, list);
}
}).onForwardToSettings(new ForwardToSettingsCallback() {
public final void onForwardToSettings(ForwardScope forwardScope, List list) {
LiveStreamingActivity.requestPermissionIfNeeded$lambda$96(permissions, this, forwardScope, list);
}
}).request(new RequestCallback() {
public final void onResult(boolean z2, List list, List list2) {
LiveStreamingActivity.requestPermissionIfNeeded$lambda$97(requestCallback, z2, list, list2);
}
});
} else if (requestCallback != null) {
requestCallback.onResult(true, permissions, new ArrayList());
}
}
public static final void requestPermissionIfNeeded$lambda$95(List list, LiveStreamingActivity liveStreamingActivity, ExplainScope explainScope, List list2) {
String string;
Intrinsics.checkNotNullParameter(list, "$permissions");
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
Intrinsics.checkNotNullParameter(explainScope, "scope");
Intrinsics.checkNotNullParameter(list2, "deniedList");
if (list.size() == 1) {
if (list2.contains("android.permission.CAMERA")) {
string = liveStreamingActivity.getString(2131952423);
Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callp…ermission_explain_camera)");
} else {
if (list2.contains("android.permission.RECORD_AUDIO")) {
string = liveStreamingActivity.getString(2131952425);
Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callp…g.permission_explain_mic)");
}
string = "";
}
} else if (list2.size() == 1) {
if (list2.contains("android.permission.CAMERA")) {
string = liveStreamingActivity.getString(2131952423);
Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callp…ermission_explain_camera)");
} else {
if (list2.contains("android.permission.RECORD_AUDIO")) {
string = liveStreamingActivity.getString(2131952425);
Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callp…g.permission_explain_mic)");
}
string = "";
}
} else {
string = liveStreamingActivity.getString(2131952424);
Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callp…ssion_explain_camera_mic)");
}
String string2 = liveStreamingActivity.getString(2131952377);
Intrinsics.checkNotNullExpressionValue(string2, "getString(app.callpe.R.string.ok)");
ExplainScope.showRequestReasonDialog$default(explainScope, list2, string, string2, (String) null, 8, (Object) null);
}
public static final void requestPermissionIfNeeded$lambda$96(List list, LiveStreamingActivity liveStreamingActivity, ForwardScope forwardScope, List list2) {
String string;
Intrinsics.checkNotNullParameter(list, "$permissions");
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
Intrinsics.checkNotNullParameter(forwardScope, "scope");
Intrinsics.checkNotNullParameter(list2, "deniedList");
if (list.size() == 1) {
if (list2.contains("android.permission.CAMERA")) {
string = liveStreamingActivity.getString(2131952580);
Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callp…R.string.settings_camera)");
} else {
if (list2.contains("android.permission.RECORD_AUDIO")) {
string = liveStreamingActivity.getString(2131952582);
Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callpe.R.string.settings_mic)");
}
string = "";
}
} else if (list2.size() == 1) {
if (list2.contains("android.permission.CAMERA")) {
string = liveStreamingActivity.getString(2131952580);
Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callp…R.string.settings_camera)");
} else {
if (list2.contains("android.permission.RECORD_AUDIO")) {
string = liveStreamingActivity.getString(2131952582);
Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callpe.R.string.settings_mic)");
}
string = "";
}
} else {
string = liveStreamingActivity.getString(2131952581);
Intrinsics.checkNotNullExpressionValue(string, "this.getString(app.callp…ring.settings_camera_mic)");
}
String string2 = liveStreamingActivity.getString(2131952579);
Intrinsics.checkNotNullExpressionValue(string2, "getString(app.callpe.R.string.settings)");
ForwardScope.showForwardToSettingsDialog$default(forwardScope, list2, string, string2, (String) null, 8, (Object) null);
}
public static final void requestPermissionIfNeeded$lambda$97(RequestCallback requestCallback, boolean z, List list, List list2) {
Intrinsics.checkNotNullParameter(list, "grantedList");
Intrinsics.checkNotNullParameter(list2, "deniedList");
if (requestCallback != null) {
requestCallback.onResult(z, list, list2);
}
}
private final void registerReceiver() {
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance((Context) this);
Intrinsics.checkNotNullExpressionValue(localBroadcastManager, "getInstance(this)");
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Constants.GIFT_REQUEST);
intentFilter.addAction(Constants.GIFT_RECEIVE);
intentFilter.addAction(GIFT_RECEIVE_LIVESTREAM);
intentFilter.addAction(COHOST_END);
intentFilter.addAction(ZegoVideoCallActivity.STREAMER_USER_GAME_JOIN_REQUEST);
intentFilter.addAction(COHOST_REQUEST_REJECT);
intentFilter.addAction(COHOST_REQUEST_ACCEPT);
intentFilter.addAction(ZegoVideoCallActivity.STREAMER_USER_GAME_REQUEST_REJECT);
intentFilter.addAction(ZegoVideoCallActivity.STREAMER_USER_GAME_REQUEST_ACCEPT);
intentFilter.addAction(COHOST_JOIN_REQUEST);
intentFilter.addAction(Constants.LIVESTREAM_KILL_SCREEN);
localBroadcastManager.registerReceiver(this.broadcastReceiver, intentFilter);
}
private final void unRegisterReceiver() {
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance((Context) this);
Intrinsics.checkNotNullExpressionValue(localBroadcastManager, "getInstance(this)");
localBroadcastManager.unregisterReceiver(this.broadcastReceiver);
}
public final void showGameRequestPopup(VideoCallGameRequestModel model) {
try {
Dialog dialog = this.alertDialog;
if (dialog != null) {
if (dialog == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog = null;
}
dialog.dismiss();
}
GameRequestDialog newInstance = GameRequestDialog.INSTANCE.newInstance(model);
this.gameRequestDialog = newInstance;
if (newInstance != null) {
newInstance.setListener(this);
}
GameRequestDialog gameRequestDialog = this.gameRequestDialog;
if (gameRequestDialog != null) {
FragmentManager supportFragmentManager = getSupportFragmentManager();
GameRequestDialog gameRequestDialog2 = this.gameRequestDialog;
gameRequestDialog.show(supportFragmentManager, gameRequestDialog2 != null ? gameRequestDialog2.getTag() : null);
}
} catch (Exception e) {
Timber.e(e);
}
}
public final void showGiftRequestDialog(final GiftRequestModel model) {
Intrinsics.checkNotNullParameter(model, "model");
try {
Dialog dialog = this.alertDialog;
Dialog dialog2 = null;
if (dialog != null) {
if (dialog == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog = null;
}
if (dialog.isShowing()) {
return;
}
}
Integer num = SharedPref.getInt((Context) this, PrefKeys.RUPEE_TO_BEAN, 1);
this.alertDialog = new Dialog((Context) this);
GiftPopupBinding inflate = GiftPopupBinding.inflate(LayoutInflater.from((Context) this));
Intrinsics.checkNotNullExpressionValue(inflate, "inflate(\n … )\n )");
Dialog dialog3 = this.alertDialog;
if (dialog3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog3 = null;
}
dialog3.setContentView(inflate.getRoot());
Dialog dialog4 = this.alertDialog;
if (dialog4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog4 = null;
}
dialog4.setCancelable(false);
ImageView imageView = inflate.popupClose;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.popupClose");
imageView.setVisibility(8);
inflate.popupClose.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.showGiftRequestDialog$lambda$99(LiveStreamingActivity.this, view);
}
});
Glide.with((FragmentActivity) this).load(model.getGift().getUrl()).into(inflate.giftImage);
CircularTimerView circularTimerView = inflate.progressCircular;
Intrinsics.checkNotNullExpressionValue(circularTimerView, "binding.progressCircular");
circularTimerView.setProgress(0.0f);
circularTimerView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.showGiftRequestDialog$lambda$100(LiveStreamingActivity.this, view);
}
});
circularTimerView.setCircularTimerListener(new CircularTimerListener() {
public String updateDataOnTick(long remainingTimeInMs) {
return "X";
}
public void onTimerFinished() {
Dialog dialog5;
dialog5 = LiveStreamingActivity.this.alertDialog;
if (dialog5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog5 = null;
}
dialog5.dismiss();
}
}, 15L, TimeFormatEnum.SECONDS, 10L);
circularTimerView.startTimer();
inflate.coinPrice.setText(NumberExtKt.formatByNumberRupee$default(model.getGift().getAmount(), false, 1, (Object) null));
if (getIsStreamer()) {
inflate.coinPrice.setText(String.valueOf(num.intValue() * model.getGift().getStreamerAmount()));
ImageView imageView2 = inflate.beanIcon;
Intrinsics.checkNotNullExpressionValue(imageView2, "binding.beanIcon");
imageView2.setVisibility(0);
}
inflate.sendGift.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.showGiftRequestDialog$lambda$102(LiveStreamingActivity.this, model, view);
}
});
Dialog dialog5 = this.alertDialog;
if (dialog5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog5 = null;
}
Window window = (Window) Objects.requireNonNull(dialog5.getWindow());
if (window != null) {
window.clearFlags(131080);
}
Dialog dialog6 = this.alertDialog;
if (dialog6 == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog6 = null;
}
dialog6.show();
Dialog dialog7 = this.alertDialog;
if (dialog7 == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
} else {
dialog2 = dialog7;
}
Window window2 = dialog2.getWindow();
Intrinsics.checkNotNull(window2);
window2.setBackgroundDrawable(new ColorDrawable(0));
} catch (Exception e) {
Timber.e(e, "", new Object[0]);
}
}
public static final void showGiftRequestDialog$lambda$99(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
Dialog dialog = liveStreamingActivity.alertDialog;
if (dialog == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog = null;
}
dialog.dismiss();
}
public static final void showGiftRequestDialog$lambda$100(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
Dialog dialog = liveStreamingActivity.alertDialog;
if (dialog == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog = null;
}
dialog.dismiss();
}
public static final void showGiftRequestDialog$lambda$102(final LiveStreamingActivity liveStreamingActivity, final GiftRequestModel giftRequestModel, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
Intrinsics.checkNotNullParameter(giftRequestModel, "$model");
try {
Dialog dialog = liveStreamingActivity.alertDialog;
if (dialog == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog = null;
}
dialog.dismiss();
if (!liveStreamingActivity.firstRechargeDone) {
try {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String string = liveStreamingActivity.getString(2131952179);
Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.live_…am_gift_recharge_message)");
String format = String.format(string, Arrays.copyOf(new Object[0], 0));
Intrinsics.checkNotNullExpressionValue(format, "format(format, *args)");
RechargeDialog rechargeDialog = new RechargeDialog(null, null, null, format, null, new Function0<Unit>() {
public final void m1852invoke() {
}
public Object invoke() {
m1852invoke();
return Unit.INSTANCE;
}
}, new Function0<Unit>() {
{
super(0);
}
public Object invoke() {
m1853invoke();
return Unit.INSTANCE;
}
public final void m1853invoke() {
LiveStreamViewModel viewModel;
viewModel = LiveStreamingActivity.this.getViewModel();
viewModel.getUserDetails();
}
}, 16, null);
rechargeDialog.setCancelable(true);
if (!rechargeDialog.isAdded() && !rechargeDialog.isVisible()) {
rechargeDialog.show(liveStreamingActivity.getSupportFragmentManager(), "RechargeDialog");
return;
}
return;
} catch (Exception unused) {
Activity activity = (Activity) liveStreamingActivity;
String string2 = liveStreamingActivity.getString(2131951993);
Intrinsics.checkNotNullExpressionValue(string2, "getString(R.string.error_unknown)");
ActivityExtKt.toast(activity, string2);
return;
}
}
final GiftModel gift = giftRequestModel.getGift();
DialogHelper.showReasonDialog((Context) liveStreamingActivity, "", "This gift will cost " + Helper.getSign$default(false, 1, null) + NumberExtKt.formatByNumberDecimalAndRemoveTrailingZeros(gift.getAmount()) + ". Do you want to continue?", true, new DialogHelper.ConfirmationListener() {
@Override
public final void onPositiveClick() {
LiveStreamingActivity.showGiftRequestDialog$lambda$102$lambda$101(LiveStreamingActivity.this, gift, giftRequestModel);
}
});
} catch (Exception e) {
Timber.e(e);
}
}
public static final void showGiftRequestDialog$lambda$102$lambda$101(final LiveStreamingActivity liveStreamingActivity, GiftModel giftModel, GiftRequestModel giftRequestModel) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
Intrinsics.checkNotNullParameter(giftModel, "$gift");
Intrinsics.checkNotNullParameter(giftRequestModel, "$model");
if (liveStreamingActivity.getViewModel().getBalance() == null) {
return;
}
Balance balance = liveStreamingActivity.getViewModel().getBalance();
Dialog dialog = null;
Double valueOf = balance != null ? Double.valueOf(balance.getBalance()) : null;
Intrinsics.checkNotNull(valueOf);
if (valueOf.doubleValue() <= giftModel.getAmount()) {
try {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String string = liveStreamingActivity.getString(2131952179);
Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.live_…am_gift_recharge_message)");
String format = String.format(string, Arrays.copyOf(new Object[0], 0));
Intrinsics.checkNotNullExpressionValue(format, "format(format, *args)");
RechargeDialog rechargeDialog = new RechargeDialog(null, null, null, format, null, new Function0<Unit>() {
public final void m1850invoke() {
}
public Object invoke() {
m1850invoke();
return Unit.INSTANCE;
}
}, new Function0<Unit>() {
{
super(0);
}
public Object invoke() {
m1851invoke();
return Unit.INSTANCE;
}
public final void m1851invoke() {
LiveStreamViewModel viewModel;
viewModel = LiveStreamingActivity.this.getViewModel();
viewModel.getUserDetails();
}
}, 16, null);
rechargeDialog.setCancelable(true);
if (!rechargeDialog.isAdded() && !rechargeDialog.isVisible()) {
rechargeDialog.show(liveStreamingActivity.getSupportFragmentManager(), "RechargeDialog");
return;
}
return;
} catch (Exception unused) {
Activity activity = (Activity) liveStreamingActivity;
String string2 = liveStreamingActivity.getString(2131951993);
Intrinsics.checkNotNullExpressionValue(string2, "getString(R.string.error_unknown)");
ActivityExtKt.toast(activity, string2);
return;
}
}
liveStreamingActivity.getViewModel().sendGift(giftModel.getId(), Long.valueOf(liveStreamingActivity.liveStreamId), giftRequestModel.getCount() != 0 ? giftRequestModel.getCount() : 1);
Dialog dialog2 = liveStreamingActivity.alertDialog;
if (dialog2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
} else {
dialog = dialog2;
}
dialog.dismiss();
}
public final void showCohostRequestPopup(CohostRequestModel model) {
if (getIsStreamer()) {
try {
CohostRequestBottomSheet newInstance = CohostRequestBottomSheet.INSTANCE.newInstance(model);
this.cohostRequestBottomSheet = newInstance;
if (newInstance != null) {
newInstance.setListener(this);
}
CohostRequestBottomSheet cohostRequestBottomSheet = this.cohostRequestBottomSheet;
if (cohostRequestBottomSheet != null) {
FragmentManager supportFragmentManager = getSupportFragmentManager();
CohostRequestBottomSheet cohostRequestBottomSheet2 = this.cohostRequestBottomSheet;
cohostRequestBottomSheet.show(supportFragmentManager, cohostRequestBottomSheet2 != null ? cohostRequestBottomSheet2.getTag() : null);
}
} catch (Exception e) {
Timber.e(e);
}
}
}
public final void addToGiftQueue(GiftRequestModel giftModel) {
Intrinsics.checkNotNullParameter(giftModel, "giftModel");
Timber.e("giftReceivedQueue " + this.giftReceivedQueue.size(), new Object[0]);
if (!this.giftReceivedQueue.isEmpty()) {
this.giftReceivedQueue.add(giftModel);
return;
}
this.giftReceivedQueue.add(giftModel);
GiftRequestModel peek = this.giftReceivedQueue.peek();
if (peek != null) {
showGiftReceivedDialog(peek);
}
}
public final void addToGiftAnimationQueue(GiftRequestModel giftModel) {
Timber.e("giftAnimationQueue " + this.giftAnimationQueue.size(), new Object[0]);
if (!(!this.giftAnimationQueue.isEmpty()) && !this.bigAnimation) {
if (giftModel != null) {
this.giftAnimationQueue.add(giftModel);
addGitAnimatedItem();
return;
}
return;
}
LiveStreamGiftAnimationAdapter liveStreamGiftAnimationAdapter = this.giftAnimationAdapter;
if (liveStreamGiftAnimationAdapter != null) {
if (this.bigAnimation) {
if (giftModel != null) {
this.giftAnimationQueue.add(giftModel);
}
} else if (liveStreamGiftAnimationAdapter.getMessages().size() >= 2) {
if (giftModel != null) {
this.giftAnimationQueue.add(giftModel);
}
} else {
if (giftModel != null) {
this.giftAnimationQueue.poll();
this.giftAnimationQueue.add(giftModel);
}
addGitAnimatedItem();
}
}
}
private final void addGitAnimatedItem() {
GiftRequestModel peek = this.giftAnimationQueue.peek();
if (peek != null) {
BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new LiveStreamingActivity$addGitAnimatedItem$1$1(this, peek, null), 3, (Object) null);
}
}
private final void showGiftReceivedDialog(final GiftRequestModel model) {
try {
Integer num = SharedPref.getInt((Context) this, PrefKeys.RUPEE_TO_BEAN, 1);
this.alertDialog = new Dialog((Context) this);
GiftReceivedPopupLivestreamBinding inflate = GiftReceivedPopupLivestreamBinding.inflate(LayoutInflater.from((Context) this));
Intrinsics.checkNotNullExpressionValue(inflate, "inflate(\n … )\n )");
Dialog dialog = this.alertDialog;
Dialog dialog2 = null;
if (dialog == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog = null;
}
dialog.setContentView(inflate.getRoot());
Dialog dialog3 = this.alertDialog;
if (dialog3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog3 = null;
}
dialog3.setCancelable(false);
inflate.circularProgressBarCross.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.showGiftReceivedDialog$lambda$111(LiveStreamingActivity.this, view);
}
});
inflate.cancel.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.showGiftReceivedDialog$lambda$112(LiveStreamingActivity.this, view);
}
});
inflate.followUser.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.showGiftReceivedDialog$lambda$113(LiveStreamingActivity.this, model, view);
}
});
if (model.getGift().getAnimationUrl() != null) {
Glide.with((FragmentActivity) this).load(model.getGift().getAnimationUrl()).into(inflate.giftImage);
} else {
Glide.with((FragmentActivity) this).load(model.getGift().getUrl()).into(inflate.giftImage);
}
inflate.coinPrice.setText(NumberExtKt.formatByNumberRupee$default(model.getGift().getAmount(), false, 1, (Object) null));
CircularTimerView circularTimerView = inflate.progressCircular;
Intrinsics.checkNotNullExpressionValue(circularTimerView, "binding.progressCircular");
final CircularProgressBar circularProgressBar = inflate.circularProgressBarCross;
Intrinsics.checkNotNullExpressionValue(circularProgressBar, "binding.circularProgressBarCross");
circularTimerView.setProgress(0.0f);
circularTimerView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LiveStreamingActivity.showGiftReceivedDialog$lambda$114(LiveStreamingActivity.this, view);
}
});
circularTimerView.setCircularTimerListener(new CircularTimerListener() {
private final int totalDurationInMs = 5000;
private final int updateIntervalInMs = 10;
private final float maxProgress = 100.0f;
private final float progressDelta = 100.0f / (5000 / 10);
public String updateDataOnTick(long remainingTimeInMs) {
circularProgressBar.setProgress(this.maxProgress - ((this.progressDelta * remainingTimeInMs) / this.updateIntervalInMs));
return "X";
}
public void onTimerFinished() {
Dialog dialog4;
circularProgressBar.setProgress(0.0f);
dialog4 = this.alertDialog;
if (dialog4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog4 = null;
}
dialog4.dismiss();
}
}, 5L, TimeFormatEnum.SECONDS, 10L);
circularTimerView.startTimer();
if (getIsStreamer()) {
int intValue = num.intValue() * model.getGift().getStreamerAmount();
if (model.getCount() > 1) {
inflate.coinPrice.setText((num.intValue() * model.getGift().getStreamerAmount()) + " x " + model.getCount() + " = " + (num.intValue() * model.getGift().getStreamerAmount() * model.getCount()));
} else {
inflate.coinPrice.setText(String.valueOf(intValue));
}
ImageView imageView = inflate.beanIcon;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.beanIcon");
imageView.setVisibility(0);
inflate.streamerRequest.setText(model.getUserName());
}
Dialog dialog4 = this.alertDialog;
if (dialog4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog4 = null;
}
dialog4.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public final void onDismiss(DialogInterface dialogInterface) {
LiveStreamingActivity.showGiftReceivedDialog$lambda$115(LiveStreamingActivity.this, dialogInterface);
}
});
Dialog dialog5 = this.alertDialog;
if (dialog5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog5 = null;
}
Window window = dialog5.getWindow();
WindowManager.LayoutParams attributes = window != null ? window.getAttributes() : null;
if (attributes != null) {
attributes.windowAnimations = 2132017515;
}
Dialog dialog6 = this.alertDialog;
if (dialog6 == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog6 = null;
}
Window window2 = (Window) Objects.requireNonNull(dialog6.getWindow());
if (window2 != null) {
window2.clearFlags(131080);
}
Dialog dialog7 = this.alertDialog;
if (dialog7 == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog7 = null;
}
dialog7.show();
Dialog dialog8 = this.alertDialog;
if (dialog8 == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
} else {
dialog2 = dialog8;
}
Window window3 = dialog2.getWindow();
Intrinsics.checkNotNull(window3);
window3.setBackgroundDrawable(new ColorDrawable(0));
} catch (Exception e) {
Timber.e(e, "showChangePasswordDialog ", new Object[0]);
}
}
public static final void showGiftReceivedDialog$lambda$111(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
Dialog dialog = liveStreamingActivity.alertDialog;
if (dialog == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog = null;
}
dialog.dismiss();
}
public static final void showGiftReceivedDialog$lambda$112(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
Dialog dialog = liveStreamingActivity.alertDialog;
if (dialog == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog = null;
}
dialog.dismiss();
}
public static final void showGiftReceivedDialog$lambda$113(LiveStreamingActivity liveStreamingActivity, GiftRequestModel giftRequestModel, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
Intrinsics.checkNotNullParameter(giftRequestModel, "$model");
liveStreamingActivity.getViewModel().followUser(true, giftRequestModel.getUserId());
Dialog dialog = liveStreamingActivity.alertDialog;
if (dialog == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog = null;
}
dialog.dismiss();
ActivityExtKt.toast((Activity) liveStreamingActivity, giftRequestModel.getUserName() + " added to your favorite list");
}
public static final void showGiftReceivedDialog$lambda$114(LiveStreamingActivity liveStreamingActivity, View view) {
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
Dialog dialog = liveStreamingActivity.alertDialog;
if (dialog == null) {
Intrinsics.throwUninitializedPropertyAccessException("alertDialog");
dialog = null;
}
dialog.dismiss();
}
public static final void showGiftReceivedDialog$lambda$115(LiveStreamingActivity liveStreamingActivity, DialogInterface dialogInterface) {
GiftRequestModel peek;
Intrinsics.checkNotNullParameter(liveStreamingActivity, "this$0");
if (!liveStreamingActivity.giftReceivedQueue.isEmpty()) {
liveStreamingActivity.giftReceivedQueue.poll();
if (liveStreamingActivity.giftReceivedQueue.peek() != null && (peek = liveStreamingActivity.giftReceivedQueue.peek()) != null) {
liveStreamingActivity.showGiftReceivedDialog(peek);
}
}
liveStreamingActivity.timer = null;
}
public final void startImageUploadLoop(long streamId, long egressFrequency, String source) {
if (this.imageUploadJob != null) {
return;
}
this.imageUploadJob = BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new LiveStreamingActivity$startImageUploadLoop$1(this, source, egressFrequency, streamId, null), 3, (Object) null);
}
public final void stopImageUploadLoop() {
Job job = this.imageUploadJob;
if (job != null) {
Job.DefaultImpls.cancel$default(job, (CancellationException) null, 1, (Object) null);
}
this.imageUploadJob = null;
}
@Metadata(d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\t\n\u0002\u0010\t\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\b\u0086\u0003\u0018\u00002\u00020\u0001:\u0001 B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J:\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u0019\u001a\u00020\u001a2\u0006\u0010\u001b\u001a\u00020\u000e2\u0006\u0010\u001c\u001a\u00020\u00042\u0006\u0010\u001d\u001a\u00020\u00042\u0006\u0010\u001e\u001a\u00020\u00042\n\b\u0002\u0010\u001f\u001a\u0004\u0018\u00010\u0004R\u000e\u0010\u0003\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u000eX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u001a\u0010\u0012\u001a\u00020\u0013X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0012\u0010\u0014\"\u0004\b\u0015\u0010\u0016¨\u0006!"}, d2 = {"Lapp/callpe/ui/livestreaming/LiveStreamingActivity$Companion;", "", "()V", LiveStreamingActivity.COHOST_END, "", LiveStreamingActivity.COHOST_ID, LiveStreamingActivity.COHOST_JOIN_REQUEST, LiveStreamingActivity.COHOST_REQUEST_ACCEPT, LiveStreamingActivity.COHOST_REQUEST_REJECT, LiveStreamingActivity.FROM_LIVE_SCREEN, LiveStreamingActivity.GIFT_RECEIVE_LIVESTREAM, LiveStreamingActivity.LIVE_STREAM_ID, LiveStreamingActivity.LIVE_STREAM_MODEL, "RECONNECT_DELAY", "", LiveStreamingActivity.ROOM_ID, "RTC_PROVIDER", "ZEGO_TOKEN", "isLiveStreamScreenOpen", "", "()Z", "setLiveStreamScreenOpen", "(Z)V", "createOrJoinLiveStream", "", "activity", "Landroidx/fragment/app/FragmentActivity;", "liveStreamId", "roomId", "zegoToken", "liveStreamModel", "rtcProvider", "LiveStreamStatus", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public static final class Companion {
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0007\b\u0086\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002j\u0002\b\u0003j\u0002\b\u0004j\u0002\b\u0005j\u0002\b\u0006j\u0002\b\u0007¨\u0006\b"}, d2 = {"Lapp/callpe/ui/livestreaming/LiveStreamingActivity$Companion$LiveStreamStatus;", "", "(Ljava/lang/String;I)V", "STARTED", "PAUSED", "ENDED", "BUSY", "OFFLINE", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public enum LiveStreamStatus {
STARTED,
PAUSED,
ENDED,
BUSY,
OFFLINE
}
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final boolean isLiveStreamScreenOpen() {
return LiveStreamingActivity.isLiveStreamScreenOpen;
}
public final void setLiveStreamScreenOpen(boolean z) {
LiveStreamingActivity.isLiveStreamScreenOpen = z;
}
public final void createOrJoinLiveStream(FragmentActivity activity, long liveStreamId, String roomId, String zegoToken, String liveStreamModel, String rtcProvider) {
Intrinsics.checkNotNullParameter(activity, "activity");
Intrinsics.checkNotNullParameter(roomId, "roomId");
Intrinsics.checkNotNullParameter(zegoToken, "zegoToken");
Intrinsics.checkNotNullParameter(liveStreamModel, "liveStreamModel");
Intent rtcLiveStreamScreenIntent = RtcScreenHandler.getRtcLiveStreamScreenIntent((Context) activity, RtcScreenHandler.getRtcScreenType(true));
rtcLiveStreamScreenIntent.putExtra(LiveStreamingActivity.LIVE_STREAM_ID, liveStreamId);
rtcLiveStreamScreenIntent.putExtra("RTC_PROVIDER", rtcProvider);
rtcLiveStreamScreenIntent.putExtra(LiveStreamingActivity.ROOM_ID, roomId);
rtcLiveStreamScreenIntent.putExtra(LiveStreamingActivity.ZEGO_TOKEN, zegoToken);
rtcLiveStreamScreenIntent.putExtra(LiveStreamingActivity.LIVE_STREAM_MODEL, liveStreamModel);
if (rtcProvider == null) {
rtcProvider = "ZEGO";
}
RtcManagerFactory.createManager$default(null, rtcProvider, 1, null);
activity.startActivity(rtcLiveStreamScreenIntent);
}
}
@Override
public void onGameRequestAccepted(VideoCallGameRequestModel requestModel) {
CohostModel cohost;
Intrinsics.checkNotNullParameter(requestModel, "requestModel");
LiveStreamModel liveStreamDetails = getViewModel().getLiveStreamDetails();
Long l = null;
if (liveStreamDetails != null && (cohost = liveStreamDetails.getCohost()) != null && Intrinsics.areEqual(cohost.getStatus(), "STARTED")) {
l = Long.valueOf(cohost.getId());
}
getViewModel().joinSudGame(requestModel.getStreamerUserGameId(), requestModel.getEntityId(), GameUtils.GameNames.LUDO, l);
}
@Override
public void onGameRequestRejected(VideoCallGameRequestModel requestModel) {
CohostModel cohost;
Intrinsics.checkNotNullParameter(requestModel, "requestModel");
LiveStreamModel liveStreamDetails = getViewModel().getLiveStreamDetails();
Long l = null;
if (liveStreamDetails != null && (cohost = liveStreamDetails.getCohost()) != null && Intrinsics.areEqual(cohost.getStatus(), "STARTED")) {
l = Long.valueOf(cohost.getId());
}
getViewModel().rejectSudGame(requestModel.getStreamerUserGameId(), GameUtils.GameNames.LUDO, l);
}
@Override
public void onCohostRequestAccepted(CohostRequestModel cohostRequestModel) {
Intrinsics.checkNotNullParameter(cohostRequestModel, "cohostRequestModel");
getViewModel().acceptCohostRequest(cohostRequestModel.getCohostId(), getViewModel().getCurrentPosition());
}
@Override
public void onCohostRequestRejected(CohostRequestModel cohostRequestModel) {
Intrinsics.checkNotNullParameter(cohostRequestModel, "cohostRequestModel");
getViewModel().rejectCohostRequest(cohostRequestModel.getCohostId(), getViewModel().getCurrentPosition());
}
@Override
public void onFollowAndLeaveClicked() {
LiveStreamModel liveStreamDetails = getViewModel().getLiveStreamDetails();
StreamerModel streamerModel = liveStreamDetails != null ? liveStreamDetails.getStreamerModel() : null;
if (streamerModel != null) {
getViewModel().followStreamer(true, streamerModel.getId());
}
LiveStreamViewModel.endStream$default(getViewModel(), getIsStreamer(), false, 0L, null, 14, null);
LiveStreamersFragment.INSTANCE.setResume(true);
finish();
}
@Override
public void onLeaveClicked() {
LiveStreamViewModel.endStream$default(getViewModel(), getIsStreamer(), false, 0L, null, 14, null);
LiveStreamersFragment.INSTANCE.setResume(true);
finish();
}
}