导航菜单

页面标题

页面副标题

bbinstant v6.24.0 - PermissionActivity.java 源代码

正在查看: bbinstant v6.24.0 应用的 PermissionActivity.java JAVA 源代码文件

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


package com.moengage.pushbase.internal.activity;

import android.content.Context;
import android.os.Bundle;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.AppCompatActivity;
import com.moengage.core.internal.logger.f;
import kotlin.jvm.internal.v;
import kotlin.jvm.internal.w;

public final class PermissionActivity extends AppCompatActivity {
    private final ActivityResultLauncher<String> requestNotificationPermissionLauncher;
    private final String tag = "PushBase_6.8.1_PermissionActivity";

    static final class a extends w implements kotlin.jvm.functions.a {
        a() {
            super(0);
        }

        public final String invoke() {
            return v.stringPlus(PermissionActivity.this.tag, " onCreate() : ");
        }
    }

    static final class b extends w implements kotlin.jvm.functions.a {
        b() {
            super(0);
        }

        public final String invoke() {
            return v.stringPlus(PermissionActivity.this.tag, " onPause() : ");
        }
    }

    static final class c extends w implements kotlin.jvm.functions.a {
        c() {
            super(0);
        }

        public final String invoke() {
            return v.stringPlus(PermissionActivity.this.tag, " onResume() : ");
        }
    }

    static final class d extends w implements kotlin.jvm.functions.a {
        d() {
            super(0);
        }

        public final String invoke() {
            return v.stringPlus(PermissionActivity.this.tag, " onStart() : ");
        }
    }

    static final class e extends w implements kotlin.jvm.functions.a {
        e() {
            super(0);
        }

        public final String invoke() {
            return v.stringPlus(PermissionActivity.this.tag, " onStop() : ");
        }
    }

    static final class f extends w implements kotlin.jvm.functions.a {
        f() {
            super(0);
        }

        public final String invoke() {
            return v.stringPlus(PermissionActivity.this.tag, " requestNotificationPermission() : Requesting permission");
        }
    }

    static final class g extends w implements kotlin.jvm.functions.a {
        g() {
            super(0);
        }

        public final String invoke() {
            return v.stringPlus(PermissionActivity.this.tag, " requestNotificationPermission() : ");
        }
    }

    static final class h extends w implements kotlin.jvm.functions.a {
        h() {
            super(0);
        }

        public final String invoke() {
            return v.stringPlus(PermissionActivity.this.tag, " requestNotificationPermissionLauncher : Permission Granted.");
        }
    }

    static final class i extends w implements kotlin.jvm.functions.a {
        i() {
            super(0);
        }

        public final String invoke() {
            return v.stringPlus(PermissionActivity.this.tag, " requestNotificationPermissionLauncher : Permission Denied.");
        }
    }

    static final class j extends w implements kotlin.jvm.functions.a {
        j() {
            super(0);
        }

        public final String invoke() {
            return v.stringPlus(PermissionActivity.this.tag, " requestNotificationPermissionLauncher : Finishing activity.");
        }
    }

    static final class k extends w implements kotlin.jvm.functions.a {
        k() {
            super(0);
        }

        public final String invoke() {
            return v.stringPlus(PermissionActivity.this.tag, " () : ");
        }
    }

    public PermissionActivity() {
        ActivityResultLauncher<String> registerForActivityResult = registerForActivityResult(new ActivityResultContracts.RequestPermission(), new androidx.activity.result.a() {
            public final void onActivityResult(Object obj) {
                PermissionActivity.m1080requestNotificationPermissionLauncher$lambda0(PermissionActivity.this, ((Boolean) obj).booleanValue());
            }
        });
        v.checkNotNullExpressionValue(registerForActivityResult, "registerForActivityResul…}\n            }\n        }");
        this.requestNotificationPermissionLauncher = registerForActivityResult;
    }

    private final void requestNotificationPermission() {
        try {
            f.a.print$default(com.moengage.core.internal.logger.f.Companion, 0, null, new f(), 3, null);
            this.requestNotificationPermissionLauncher.launch("android.permission.POST_NOTIFICATIONS");
        } catch (Throwable th) {
            com.moengage.core.internal.logger.f.Companion.print(1, th, new g());
        }
    }

    public static final void m1080requestNotificationPermissionLauncher$lambda0(PermissionActivity permissionActivity, boolean z) {
        v.checkNotNullParameter(permissionActivity, "this$0");
        try {
            com.moengage.pushbase.internal.permission.e.notifyListeners(z);
            if (z) {
                f.a.print$default(com.moengage.core.internal.logger.f.Companion, 0, null, permissionActivity.new h(), 3, null);
                Context applicationContext = permissionActivity.getApplicationContext();
                v.checkNotNullExpressionValue(applicationContext, "applicationContext");
                com.moengage.pushbase.internal.permission.e.onPermissionGranted(applicationContext, permissionActivity.getIntent().getExtras());
            } else {
                f.a.print$default(com.moengage.core.internal.logger.f.Companion, 0, null, permissionActivity.new i(), 3, null);
                Context applicationContext2 = permissionActivity.getApplicationContext();
                v.checkNotNullExpressionValue(applicationContext2, "applicationContext");
                com.moengage.pushbase.internal.permission.e.onPermissionDenied(applicationContext2, permissionActivity.getIntent().getExtras());
            }
            f.a.print$default(com.moengage.core.internal.logger.f.Companion, 0, null, permissionActivity.new j(), 3, null);
            permissionActivity.finish();
        } catch (Throwable th) {
            com.moengage.core.internal.logger.f.Companion.print(1, th, permissionActivity.new k());
        }
    }

    protected void onCreate(Bundle bundle) {
        super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
        f.a.print$default(com.moengage.core.internal.logger.f.Companion, 0, null, new a(), 3, null);
        requestNotificationPermission();
    }

    protected void onPause() {
        super/*androidx.fragment.app.FragmentActivity*/.onPause();
        f.a.print$default(com.moengage.core.internal.logger.f.Companion, 0, null, new b(), 3, null);
    }

    protected void onResume() {
        super/*androidx.fragment.app.FragmentActivity*/.onResume();
        f.a.print$default(com.moengage.core.internal.logger.f.Companion, 0, null, new c(), 3, null);
    }

    protected void onStart() {
        super.onStart();
        f.a.print$default(com.moengage.core.internal.logger.f.Companion, 0, null, new d(), 3, null);
    }

    protected void onStop() {
        super.onStop();
        f.a.print$default(com.moengage.core.internal.logger.f.Companion, 0, null, new e(), 3, null);
    }
}