导航菜单

页面标题

页面副标题

Rilo v2.0.21 - StreamerProfileStatusActivity.java 源代码

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

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


package app.callpe.ui.onboarding;

import android.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Toast;
import androidx.activity.ComponentActivity;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContract;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import app.callpe.common.utils.Helper;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.databinding.ActivityStreamerProfileStatusBinding;
import app.callpe.service.jobs.JobPriority;
import app.callpe.ui.home.BaseActivity;
import app.callpe.ui.user.UserViewModel;
import com.birjuvachhani.locus.Constants;
import com.facebook.internal.NativeProtocol;
import com.google.android.material.snackbar.Snackbar;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.Iterator;
import kotlin.Deprecated;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.ArrayIteratorKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import timber.log.Timber;

@Metadata(d1 = {"\u0000d\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0015\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0007\b\u0007\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0003J\b\u0010\u0014\u001a\u00020\u0015H\u0002J\b\u0010\u0016\u001a\u00020\u0015H\u0002J\u0010\u0010\u0017\u001a\u00020\u00022\u0006\u0010\u0018\u001a\u00020\u0019H\u0016J\"\u0010\u001a\u001a\u00020\u00152\u0006\u0010\u001b\u001a\u00020\t2\u0006\u0010\u001c\u001a\u00020\t2\b\u0010\u001d\u001a\u0004\u0018\u00010\u001eH\u0015J\b\u0010\u001f\u001a\u00020\u0015H\u0002J\u0012\u0010 \u001a\u00020\u00152\b\u0010!\u001a\u0004\u0018\u00010\"H\u0014J+\u0010#\u001a\u00020\u00152\u0006\u0010\u001b\u001a\u00020\t2\f\u0010$\u001a\b\u0012\u0004\u0012\u00020\u00060\u00052\u0006\u0010%\u001a\u00020&H\u0016¢\u0006\u0002\u0010'J\u001d\u0010(\u001a\u00020)2\u000e\u0010$\u001a\n\u0012\u0004\u0012\u00020\u0006\u0018\u00010\u0005H\u0002¢\u0006\u0002\u0010*J\u0010\u0010+\u001a\u00020)2\u0006\u0010,\u001a\u00020\u0006H\u0002J\u0010\u0010-\u001a\u00020\u00152\u0006\u0010.\u001a\u00020\tH\u0002J\b\u0010/\u001a\u00020\u0015H\u0002R\u0016\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00060\u0005X\u0082\u000e¢\u0006\u0004\n\u0002\u0010\u0007R\u000e\u0010\b\u001a\u00020\tX\u0082D¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\tX\u0082D¢\u0006\u0002\n\u0000R\u001c\u0010\u000b\u001a\u0010\u0012\f\u0012\n \r*\u0004\u0018\u00010\u00060\u00060\fX\u0082\u0004¢\u0006\u0002\n\u0000R\u001b\u0010\u000e\u001a\u00020\u000f8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0012\u0010\u0013\u001a\u0004\b\u0010\u0010\u0011¨\u00060"}, d2 = {"Lapp/callpe/ui/onboarding/StreamerProfileStatusActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityStreamerProfileStatusBinding;", "()V", "PERMISSIONS", "", "", "[Ljava/lang/String;", "PERMISSION_REQ_FORWARD", "", "PERMISSION_REQ_STAY", "requestPermissionLauncher", "Landroidx/activity/result/ActivityResultLauncher;", "kotlin.jvm.PlatformType", "viewModel", "Lapp/callpe/ui/user/UserViewModel;", "getViewModel", "()Lapp/callpe/ui/user/UserViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "checkPermissions", "", "goToOnBoardActivity", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "onActivityResult", "requestCode", "resultCode", "data", "Landroid/content/Intent;", "onClicks", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onRequestPermissionsResult", NativeProtocol.RESULT_ARGS_PERMISSIONS, "grantResults", "", "(I[Ljava/lang/String;[I)V", "permissionArrayGranted", "", "([Ljava/lang/String;)Z", "permissionGranted", "permission", "requestPermissions", Constants.INTENT_EXTRA_CONFIGURATION, "toastNeedPermissions", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class StreamerProfileStatusActivity extends BaseActivity<ActivityStreamerProfileStatusBinding> {
    private final ActivityResultLauncher<String> requestPermissionLauncher;

    private final Lazy viewModel;
    private final int PERMISSION_REQ_FORWARD = 1010;
    private final int PERMISSION_REQ_STAY = 1011;
    private String[] PERMISSIONS = {"android.permission.RECORD_AUDIO", "android.permission.CAMERA", "android.permission.CALL_PHONE", "android.permission.READ_PHONE_STATE", "android.permission.READ_EXTERNAL_STORAGE"};

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

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

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

            public final CreationExtras m2060invoke() {
                CreationExtras creationExtras;
                Function0 function02 = function0;
                return (function02 == null || (creationExtras = (CreationExtras) function02.invoke()) == null) ? componentActivity.getDefaultViewModelCreationExtras() : creationExtras;
            }
        });
        ActivityResultLauncher<String> registerForActivityResult = registerForActivityResult((ActivityResultContract) new ActivityResultContracts.RequestPermission(), new ActivityResultCallback() {
            public final void onActivityResult(Object obj) {
                StreamerProfileStatusActivity.requestPermissionLauncher$lambda$1(StreamerProfileStatusActivity.this, ((Boolean) obj).booleanValue());
            }
        });
        Intrinsics.checkNotNullExpressionValue(registerForActivityResult, "registerForActivityResul… }.show()\n        }\n    }");
        this.requestPermissionLauncher = registerForActivityResult;
    }

    private final UserViewModel getViewModel() {
        return (UserViewModel) this.viewModel.getValue();
    }

    public static final void requestPermissionLauncher$lambda$1(final StreamerProfileStatusActivity streamerProfileStatusActivity, boolean z) {
        Intrinsics.checkNotNullParameter(streamerProfileStatusActivity, "this$0");
        if (z) {
            Timber.d("Permission granted", new Object[0]);
            if (streamerProfileStatusActivity.permissionArrayGranted(streamerProfileStatusActivity.PERMISSIONS)) {
                return;
            }
            streamerProfileStatusActivity.requestPermissions(streamerProfileStatusActivity.PERMISSION_REQ_FORWARD);
            return;
        }
        Snackbar.make(streamerProfileStatusActivity.getBinding().getRoot(), "Notification blocked", -2).setAction(streamerProfileStatusActivity.getString(2131952579), new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                StreamerProfileStatusActivity.requestPermissionLauncher$lambda$1$lambda$0(StreamerProfileStatusActivity.this, view);
            }
        }).show();
    }

    public static final void requestPermissionLauncher$lambda$1$lambda$0(StreamerProfileStatusActivity streamerProfileStatusActivity, View view) {
        Intrinsics.checkNotNullParameter(streamerProfileStatusActivity, "this$0");
        Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
        intent.addFlags(268435456);
        Uri fromParts = Uri.fromParts("package", streamerProfileStatusActivity.getPackageName(), null);
        Intrinsics.checkNotNullExpressionValue(fromParts, "fromParts(\"package\", packageName, null)");
        intent.setData(fromParts);
        streamerProfileStatusActivity.startActivity(intent);
        streamerProfileStatusActivity.finish();
    }

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

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        SharedPref.setBoolean((Context) this, PrefKeys.APP_ACCESS, false);
        if (getIntent().getBooleanExtra("status_created", false)) {
            String string = getString(2131952467);
            Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.profile_waiting_message)");
            ((ActivityStreamerProfileStatusBinding) getBinding()).profileStatus.setText(string);
        } else if (getIntent().getBooleanExtra("status_rejected", false)) {
            String string2 = getString(2131952612);
            Intrinsics.checkNotNullExpressionValue(string2, "getString(R.string.streamer_reject_message)");
            ((ActivityStreamerProfileStatusBinding) getBinding()).profileStatus.setText(string2);
            View view = ((ActivityStreamerProfileStatusBinding) getBinding()).applyBtn;
            Intrinsics.checkNotNullExpressionValue(view, "binding.applyBtn");
            view.setVisibility(0);
            View view2 = ((ActivityStreamerProfileStatusBinding) getBinding()).goToHomeScreen;
            Intrinsics.checkNotNullExpressionValue(view2, "binding.goToHomeScreen");
            view2.setVisibility(0);
        }
        if (Build.VERSION.SDK_INT < 30) {
            this.PERMISSIONS = new String[]{"android.permission.RECORD_AUDIO", "android.permission.CAMERA", "android.permission.CALL_PHONE", "android.permission.READ_PHONE_STATE", "android.permission.READ_EXTERNAL_STORAGE"};
        } else if (Build.VERSION.SDK_INT >= 33) {
            this.PERMISSIONS = new String[]{"android.permission.RECORD_AUDIO", "android.permission.CAMERA", "android.permission.CALL_PHONE", "android.permission.READ_PHONE_STATE"};
        }
        checkPermissions();
        onClicks();
        ((ActivityStreamerProfileStatusBinding) getBinding()).userIdTv.setText(getString(2131952136) + ": " + BaseActivity.INSTANCE.getAccountId());
    }

    private final void onClicks() {
        getBinding().goToHomeScreen.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                StreamerProfileStatusActivity.onClicks$lambda$2(StreamerProfileStatusActivity.this, view);
            }
        });
        getBinding().applyBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                StreamerProfileStatusActivity.onClicks$lambda$3(StreamerProfileStatusActivity.this, view);
            }
        });
    }

    public static final void onClicks$lambda$2(StreamerProfileStatusActivity streamerProfileStatusActivity, View view) {
        Intrinsics.checkNotNullParameter(streamerProfileStatusActivity, "this$0");
        Helper.signOut$default((Context) streamerProfileStatusActivity, null, 2, null);
    }

    public static final void onClicks$lambda$3(StreamerProfileStatusActivity streamerProfileStatusActivity, View view) {
        Intrinsics.checkNotNullParameter(streamerProfileStatusActivity, "this$0");
        streamerProfileStatusActivity.goToOnBoardActivity();
    }

    private final void goToOnBoardActivity() {
        Context context = (Context) this;
        Intent intent = new Intent(context, (Class<?>) OnboardActivity.class);
        SharedPref.setBoolean(context, PrefKeys.APP_ACCESS, false);
        intent.putExtra("user", getIntent().getStringExtra("user"));
        startActivity(intent);
        overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
    }

    private final void checkPermissions() {
        if (Build.VERSION.SDK_INT >= 33) {
            this.requestPermissionLauncher.launch("android.permission.POST_NOTIFICATIONS");
        } else {
            if (permissionArrayGranted(this.PERMISSIONS)) {
                return;
            }
            requestPermissions(this.PERMISSION_REQ_FORWARD);
        }
    }

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

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

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

    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
        Intrinsics.checkNotNullParameter(permissions, NativeProtocol.RESULT_ARGS_PERMISSIONS);
        Intrinsics.checkNotNullParameter(grantResults, "grantResults");
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        if (requestCode == this.PERMISSION_REQ_FORWARD || requestCode == this.PERMISSION_REQ_STAY) {
            boolean permissionArrayGranted = permissionArrayGranted(permissions);
            if ((permissionArrayGranted && requestCode == this.PERMISSION_REQ_FORWARD) || permissionArrayGranted) {
                return;
            }
            toastNeedPermissions();
        }
    }

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

    @Deprecated(message = "Deprecated in Java")
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 500) {
            checkPermissions();
        }
    }
}