导航菜单

页面标题

页面副标题

Clean Center v0.5.5 - NotificationUtil.java 源代码

正在查看: Clean Center v0.5.5 应用的 NotificationUtil.java JAVA 源代码文件

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


package com.lambda.push.utils;

import android.app.Application;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.os.Bundle;
import android.widget.RemoteViews;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.gson.Gson;
import com.lambda.common.utils.utilcode.util.ImageUtils;
import com.lambda.common.utils.utilcode.util.LogUtils;
import com.lambda.common.utils.utilcode.util.SPUtils;
import com.lambda.push.Constants;
import com.lambda.push.LambdaPush;
import com.lambda.push.R;
import com.lambda.push.core.LambdaUrl;
import com.lambda.push.model.Beacon;
import com.lambda.push.model.Events;
import com.lambda.push.model.Item;
import com.lambda.push.model.NotiConfig;
import com.lambda.push.model.Params;
import com.lambda.push.model.Placements;
import com.lambda.push.model.PushConfig;
import com.lambda.push.model.SourceType;
import com.lambda.push.model.TaboolaResponse;
import com.lambda.push.model.Thumbnail;
import com.lambda.push.ui.LambdaWebViewActivity;
import com.lambda.push.utils.NotificationUtil;
import java.io.Closeable;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.List;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.io.CloseableKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
import kotlin.random.Random;
import kotlin.text.StringsKt;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.GlobalScope;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.json.cr;
import org.json.v8;

@Metadata(d1 = {"\u0000p\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0006\n\u0002\u0010 \n\u0002\b\u0003\n\u0002\u0010\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\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0002\bÆ\u0002\u0018\u00002\u00020\u0001:\u0001@B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0006\u0010\u0011\u001a\u00020\u0012J\u0016\u0010\u0013\u001a\u0004\u0018\u00010\u00142\n\b\u0002\u0010\u0015\u001a\u0004\u0018\u00010\u0016H\u0002J*\u0010\u0017\u001a\u0004\u0018\u00010\u00142\u0006\u0010\u0018\u001a\u00020\u00072\u0006\u0010\u0019\u001a\u00020\u00072\u0006\u0010\u001a\u001a\u00020\u001b2\u0006\u0010\u001c\u001a\u00020\u001dH\u0002J\u001e\u0010\u001e\u001a\u00020\u00072\u0006\u0010\u001f\u001a\u00020\u00072\u0006\u0010 \u001a\u00020\u00072\u0006\u0010!\u001a\u00020\u0004J\u0014\u0010\"\u001a\u0004\u0018\u00010\u001b2\b\u0010#\u001a\u0004\u0018\u00010\u0007H\u0002J:\u0010$\u001a\u00020\u00122\b\u0010\u0018\u001a\u0004\u0018\u00010\u00072\b\u0010\u0019\u001a\u0004\u0018\u00010\u00072\b\u0010\u001a\u001a\u0004\u0018\u00010\u00072\u0012\u0010%\u001a\u000e\u0012\u0004\u0012\u00020'\u0012\u0004\u0012\u00020\u00120&H\u0002J2\u0010(\u001a\u0004\u0018\u00010\u001d2\u0006\u0010)\u001a\u00020\u00072\u0006\u0010*\u001a\u00020\u00072\u0006\u0010+\u001a\u00020\u00042\u0006\u0010,\u001a\u00020\u00072\u0006\u0010-\u001a\u00020\u0007H\u0002J\u0018\u0010.\u001a\u00020/2\u0006\u00100\u001a\u0002012\u0006\u0010\u001f\u001a\u00020\u0007H\u0003J&\u00102\u001a\u00020\u00122\u0006\u0010*\u001a\u00020\u00072\u0006\u0010+\u001a\u00020\u00042\u0006\u0010,\u001a\u00020\u00072\u0006\u0010\u0019\u001a\u00020\u0007J\u001a\u00103\u001a\u00020\u00122\u0006\u00104\u001a\u00020\u00072\b\u0010*\u001a\u0004\u0018\u00010\u0007H\u0002J \u00105\u001a\u00020\u00122\u0006\u0010*\u001a\u00020\u00072\u0006\u0010,\u001a\u00020\u00072\u0006\u0010\u0019\u001a\u00020\u0007H\u0002J\u0010\u00106\u001a\u00020\u00122\u0006\u00107\u001a\u000208H\u0002J\u001c\u00109\u001a\u00020/2\b\b\u0002\u0010:\u001a\u00020\u00072\n\b\u0002\u0010*\u001a\u0004\u0018\u00010\u0007J\u0018\u0010;\u001a\u00020\u00122\u0006\u0010<\u001a\u00020\u00142\u0006\u0010\u001c\u001a\u00020\u001dH\u0002J`\u0010=\u001a\u00020\u00122\u0006\u0010>\u001a\u00020/2\b\u0010\u0018\u001a\u0004\u0018\u00010\u00072\b\u0010\u0019\u001a\u0004\u0018\u00010\u00072\b\u0010\u001a\u001a\u0004\u0018\u00010\u00072\u0006\u0010)\u001a\u00020\u00072\u0006\u0010*\u001a\u00020\u00072\u0006\u0010+\u001a\u00020\u00042\u0018\u0010%\u001a\u0014\u0012\u0004\u0012\u00020\u0007\u0012\u0004\u0012\u00020\u0007\u0012\u0004\u0012\u00020\u00120?H\u0002R\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\u0007X\u0082D¢\u0006\u0002\n\u0000R\u001c\u0010\b\u001a\u0004\u0018\u00010\u0007X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\t\u0010\n\"\u0004\b\u000b\u0010\fR\u0014\u0010\r\u001a\b\u0012\u0004\u0012\u00020\u00040\u000eX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u000f\u001a\b\u0012\u0004\u0012\u00020\u00040\u000eX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0010\u001a\b\u0012\u0004\u0012\u00020\u00040\u000eX\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006A"}, d2 = {"Lcom/lambda/push/utils/NotificationUtil;", "", "()V", "NOTIFY_ID", "", "NOTIFY_ID_FSI", "TAG", "", "currentTaboolaClickValue", "getCurrentTaboolaClickValue", "()Ljava/lang/String;", "setCurrentTaboolaClickValue", "(Ljava/lang/String;)V", "localContent", "", "localIcon", "localTitle", "cancelNotify", "", "createCustomNotificationBuilder", "Landroidx/core/app/NotificationCompat$Builder;", "contentRemoteView", "Landroid/widget/RemoteViews;", "createNotificationBuilder", "t", "c", "i", "Landroid/graphics/Bitmap;", "pi", "Landroid/app/PendingIntent;", "createNotificationChannel", "channelId", "channelName", FirebaseAnalytics.Param.LEVEL, "getBitmapFromImageURL", "strURL", "getNtfContent", "callback", "Lkotlin/Function1;", "Lcom/lambda/push/utils/NotificationUtil$NtfContent;", "getPendingIntentToWebView", "url", "source", v8.a.s, v8.h.D0, FirebaseAnalytics.Param.CONTENT, "isChannelExist", "", "notificationManager", "Landroid/app/NotificationManager;", "logClick", "logFailed", "reason", "logView", "sendNotify", "notification", "Landroid/app/Notification;", "sendRewardNotify", "mEntry", "setFsi", "nb", "showNotify", "isCustom", "Lkotlin/Function2;", "NtfContent", "lib_release"}, k = 1, mv = {1, 9, 0}, xi = 48)
public final class NotificationUtil {
    public static final int NOTIFY_ID = 1151;
    public static final int NOTIFY_ID_FSI = 1151;
    private static String currentTaboolaClickValue;
    public static final NotificationUtil INSTANCE = new NotificationUtil();
    private static final String TAG = "mpush";
    private static final List<Integer> localTitle = CollectionsKt.listOf(new Integer[]{Integer.valueOf(R.string.notify_reward_title1), Integer.valueOf(R.string.notify_reward_title2), Integer.valueOf(R.string.notify_reward_title3), Integer.valueOf(R.string.notify_reward_title4)});
    private static final List<Integer> localContent = CollectionsKt.listOf(new Integer[]{Integer.valueOf(R.string.notify_reward_content1), Integer.valueOf(R.string.notify_reward_content2), Integer.valueOf(R.string.notify_reward_content3)});
    private static final List<Integer> localIcon = CollectionsKt.listOf(new Integer[]{Integer.valueOf(R.drawable.ic_ntf_facebook), Integer.valueOf(R.drawable.ic_ntf_gmail), Integer.valueOf(R.drawable.ic_ntf_ins), Integer.valueOf(R.drawable.ic_ntf_tiktok), Integer.valueOf(R.drawable.ic_ntf_whatsapp)});

    public final String getCurrentTaboolaClickValue() {
        return currentTaboolaClickValue;
    }

    public final void setCurrentTaboolaClickValue(String str) {
        currentTaboolaClickValue = str;
    }

    private NotificationUtil() {
    }

    public static boolean sendRewardNotify$default(NotificationUtil notificationUtil, String str, String str2, int i, Object obj) {
        if ((i & 1) != 0) {
            str = "timer";
        }
        if ((i & 2) != 0) {
            str2 = null;
        }
        return notificationUtil.sendRewardNotify(str, str2);
    }

    public final boolean sendRewardNotify(String mEntry, String source) {
        String api_key;
        Params params;
        String source2;
        List<String> icons;
        List<String> contents;
        List<String> titles;
        Long noti_show_interval_in_sec;
        Intrinsics.checkNotNullParameter(mEntry, "mEntry");
        final NotiConfig notiConfig = RemoteConfigUtils.INSTANCE.getNotiConfig(source);
        String str = TAG;
        LogUtils.d(str, "sendRewardNotify(" + mEntry + ", " + source + "): " + notiConfig);
        if (notiConfig == null) {
            logFailed("cap_limited", null);
            return false;
        }
        final String source3 = notiConfig.getSource();
        Application mApp = LambdaPush.getMApp();
        if (mApp == null) {
            return false;
        }
        if (!NotificationManagerCompat.from(mApp).areNotificationsEnabled()) {
            logFailed("notifications_disabled", source3);
            return false;
        }
        PushConfig mPushConfig = RemoteConfigUtils.INSTANCE.getMPushConfig();
        if (mPushConfig != null && Intrinsics.areEqual(mPushConfig.getNoti_enable(), false)) {
            logFailed("disabled", source3);
            return false;
        }
        long j = SPUtils.getInstance("LambdaPush").getLong(Constants.SpConfig.NOTI_SHOW_VIEW_TIME);
        PushConfig mPushConfig2 = RemoteConfigUtils.INSTANCE.getMPushConfig();
        if (System.currentTimeMillis() - j < ((mPushConfig2 == null || (noti_show_interval_in_sec = mPushConfig2.getNoti_show_interval_in_sec()) == null) ? 3600L : noti_show_interval_in_sec.longValue()) * 1000) {
            logFailed("show_interval_in_sec", source3);
            if (!LambdaPush.INSTANCE.getMIsDebug()) {
                return false;
            }
            LogUtils.d(str, "show_interval_in_sec in debug mode");
        }
        String url = notiConfig.getUrl();
        if (url == null || StringsKt.isBlank(url)) {
            logFailed("invalid url", source3);
            return false;
        }
        String source4 = notiConfig.getSource();
        if (source4 == null) {
            return true;
        }
        int hashCode = source4.hashCode();
        if (hashCode == -1552805782) {
            if (!source4.equals(SourceType.TABOOLA)) {
                return true;
            }
            Params params2 = notiConfig.getParams();
            String api_key2 = params2 != null ? params2.getApi_key() : null;
            if (api_key2 == null || StringsKt.isBlank(api_key2)) {
                logFailed("invalid api_key", source3);
                return false;
            }
            HttpHelper httpHelper = HttpHelper.INSTANCE;
            String url2 = notiConfig.getUrl();
            HttpHelper httpHelper2 = HttpHelper.INSTANCE;
            Params params3 = notiConfig.getParams();
            if (params3 == null || (api_key = params3.getApi_key()) == null || (params = notiConfig.getParams()) == null || (source2 = params.getSource()) == null) {
                return false;
            }
            httpHelper.requestTaboola(url2, httpHelper2.createTaboolaRequest(api_key, source2), new Callback() {
                public void onFailure(Call call, IOException e) {
                    String str2;
                    Intrinsics.checkNotNullParameter(call, "call");
                    Intrinsics.checkNotNullParameter(e, "e");
                    str2 = NotificationUtil.TAG;
                    LogUtils.d(str2, "taboola_request_fail(e = " + e.getMessage() + ')');
                    Function2<String, Bundle, Unit> mEventCallback = LambdaPush.INSTANCE.getMEventCallback();
                    if (mEventCallback != null) {
                        Bundle bundle = new Bundle();
                        bundle.putString("e", e.getMessage());
                        Unit unit = Unit.INSTANCE;
                        mEventCallback.invoke("taboola_request_fail", bundle);
                    }
                    NotificationUtil.INSTANCE.logFailed("request_fail", source3);
                }

                public void onResponse(Call call, Response response) {
                    Events events;
                    String available;
                    List<Item> list;
                    Intrinsics.checkNotNullParameter(call, "call");
                    Intrinsics.checkNotNullParameter(response, cr.n);
                    Response response2 = (Closeable) response;
                    final NotiConfig notiConfig2 = notiConfig;
                    try {
                        Response response3 = response2;
                        if (!response.isSuccessful()) {
                            onFailure(call, new IOException(response.message()));
                            CloseableKt.closeFinally(response2, (Throwable) null);
                            return;
                        }
                        ResponseBody body = response.body();
                        String string = body != null ? body.string() : null;
                        String str2 = string;
                        if (str2 != null && str2.length() != 0) {
                            LogUtils.iTag("tower", "taboolaResponse: " + string);
                            TaboolaResponse taboolaResponse = (TaboolaResponse) new Gson().fromJson(string, TaboolaResponse.class);
                            final Ref.ObjectRef objectRef = new Ref.ObjectRef();
                            List<Placements> placements = taboolaResponse.getPlacements();
                            objectRef.element = placements != null ? (Placements) CollectionsKt.firstOrNull(placements) : null;
                            final Ref.ObjectRef objectRef2 = new Ref.ObjectRef();
                            Placements placements2 = (Placements) objectRef.element;
                            objectRef2.element = (placements2 == null || (list = placements2.getList()) == null) ? null : (Item) CollectionsKt.firstOrNull(list);
                            if (objectRef2.element == null) {
                                onFailure(call, new IOException("invalid placement"));
                                CloseableKt.closeFinally(response2, (Throwable) null);
                                return;
                            }
                            NotificationUtil notificationUtil = NotificationUtil.INSTANCE;
                            String name = ((Item) objectRef2.element).getName();
                            String description = ((Item) objectRef2.element).getDescription();
                            Thumbnail thumbnail = (Thumbnail) CollectionsKt.firstOrNull(((Item) objectRef2.element).getThumbnail());
                            notificationUtil.showNotify(false, name, description, thumbnail != null ? thumbnail.getUrl() : null, ((Item) objectRef2.element).getUrl(), notiConfig2.getSource(), notiConfig2.getMode(), new Function2<String, String, Unit>() {
                                {
                                    super(2);
                                }

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

                                public final void invoke(String str3, String str4) {
                                    Events events2;
                                    String visible;
                                    Intrinsics.checkNotNullParameter(str3, "t");
                                    Intrinsics.checkNotNullParameter(str4, "c");
                                    NotificationUtil.INSTANCE.logView(NotiConfig.this.getSource(), str3, str4);
                                    Placements placements3 = (Placements) objectRef.element;
                                    if (placements3 != null && (events2 = placements3.getEvents()) != null && (visible = events2.getVisible()) != null) {
                                        HttpHelper.INSTANCE.requestByGet(visible);
                                    }
                                    List<Beacon> beacons = ((Item) objectRef2.element).getBeacons();
                                    if (beacons != null) {
                                        for (Beacon beacon : beacons) {
                                            if (Intrinsics.areEqual(beacon.getOnEvent(), "VISIBLE")) {
                                                if (Intrinsics.areEqual(beacon.getType(), "PIXEL")) {
                                                    HttpHelper.INSTANCE.requestByGet(beacon.getValue());
                                                }
                                            } else if (Intrinsics.areEqual(beacon.getOnEvent(), "CLICK") && Intrinsics.areEqual(beacon.getType(), "PIXEL")) {
                                                NotificationUtil.INSTANCE.setCurrentTaboolaClickValue(beacon.getValue());
                                            }
                                        }
                                    }
                                }
                            });
                            Placements placements3 = (Placements) objectRef.element;
                            if (placements3 != null && (events = placements3.getEvents()) != null && (available = events.getAvailable()) != null) {
                                HttpHelper.INSTANCE.requestByGet(available);
                            }
                            List<Beacon> beacons = ((Item) objectRef2.element).getBeacons();
                            if (beacons != null) {
                                for (Beacon beacon : beacons) {
                                    if (Intrinsics.areEqual(beacon.getOnEvent(), "AVAILABLE") && Intrinsics.areEqual(beacon.getType(), "PIXEL")) {
                                        HttpHelper.INSTANCE.requestByGet(beacon.getValue());
                                    }
                                }
                                Unit unit = Unit.INSTANCE;
                            }
                            CloseableKt.closeFinally(response2, (Throwable) null);
                            return;
                        }
                        onFailure(call, new IOException("empty response"));
                        CloseableKt.closeFinally(response2, (Throwable) null);
                    } catch (Throwable th) {
                        try {
                            throw th;
                        } catch (Throwable th2) {
                            CloseableKt.closeFinally(response2, th);
                            throw th2;
                        }
                    }
                }
            });
            return true;
        }
        if (hashCode != -1014777826) {
            if (hashCode != 3277 || !source4.equals(SourceType.H5)) {
                return true;
            }
        } else if (!source4.equals(SourceType.OKSPIN)) {
            return true;
        }
        LambdaUrl.INSTANCE.load(notiConfig.getUrl());
        Params params4 = notiConfig.getParams();
        String str2 = (params4 == null || (titles = params4.getTitles()) == null) ? null : (String) CollectionsKt.random(titles, Random.Default);
        Params params5 = notiConfig.getParams();
        String str3 = (params5 == null || (contents = params5.getContents()) == null) ? null : (String) CollectionsKt.random(contents, Random.Default);
        Params params6 = notiConfig.getParams();
        if (params6 != null && (icons = params6.getIcons()) != null) {
            r12 = (String) CollectionsKt.random(icons, Random.Default);
        }
        showNotify(false, str2, str3, r12, notiConfig.getUrl(), notiConfig.getSource(), notiConfig.getMode(), new Function2<String, String, Unit>() {
            {
                super(2);
            }

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

            public final void invoke(String str4, String str5) {
                Intrinsics.checkNotNullParameter(str4, "t");
                Intrinsics.checkNotNullParameter(str5, "c");
                NotificationUtil.INSTANCE.logView(NotiConfig.this.getSource(), str4, str5);
            }
        });
        return true;
    }

    @Metadata(d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u000b\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\b\u0086\b\u0018\u00002\u00020\u0001B\u001d\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003\u0012\u0006\u0010\u0005\u001a\u00020\u0006¢\u0006\u0002\u0010\u0007J\t\u0010\r\u001a\u00020\u0003HÆ\u0003J\t\u0010\u000e\u001a\u00020\u0003HÆ\u0003J\t\u0010\u000f\u001a\u00020\u0006HÆ\u0003J'\u0010\u0010\u001a\u00020\u00002\b\b\u0002\u0010\u0002\u001a\u00020\u00032\b\b\u0002\u0010\u0004\u001a\u00020\u00032\b\b\u0002\u0010\u0005\u001a\u00020\u0006HÆ\u0001J\u0013\u0010\u0011\u001a\u00020\u00122\b\u0010\u0013\u001a\u0004\u0018\u00010\u0001HÖ\u0003J\t\u0010\u0014\u001a\u00020\u0015HÖ\u0001J\t\u0010\u0016\u001a\u00020\u0003HÖ\u0001R\u0011\u0010\u0004\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\tR\u0011\u0010\u0005\u001a\u00020\u0006¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u000bR\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\f\u0010\t¨\u0006\u0017"}, d2 = {"Lcom/lambda/push/utils/NotificationUtil$NtfContent;", "", v8.h.D0, "", "description", v8.h.H0, "Landroid/graphics/Bitmap;", "(Ljava/lang/String;Ljava/lang/String;Landroid/graphics/Bitmap;)V", "getDescription", "()Ljava/lang/String;", "getIcon", "()Landroid/graphics/Bitmap;", "getTitle", "component1", "component2", "component3", "copy", "equals", "", "other", "hashCode", "", "toString", "lib_release"}, k = 1, mv = {1, 9, 0}, xi = 48)
    public static final class NtfContent {
        private final String description;
        private final Bitmap icon;
        private final String title;

        public static NtfContent copy$default(NtfContent ntfContent, String str, String str2, Bitmap bitmap, int i, Object obj) {
            if ((i & 1) != 0) {
                str = ntfContent.title;
            }
            if ((i & 2) != 0) {
                str2 = ntfContent.description;
            }
            if ((i & 4) != 0) {
                bitmap = ntfContent.icon;
            }
            return ntfContent.copy(str, str2, bitmap);
        }

        public final String getTitle() {
            return this.title;
        }

        public final String getDescription() {
            return this.description;
        }

        public final Bitmap getIcon() {
            return this.icon;
        }

        public final NtfContent copy(String title, String description, Bitmap icon) {
            Intrinsics.checkNotNullParameter(title, v8.h.D0);
            Intrinsics.checkNotNullParameter(description, "description");
            Intrinsics.checkNotNullParameter(icon, v8.h.H0);
            return new NtfContent(title, description, icon);
        }

        public boolean equals(Object other) {
            if (this == other) {
                return true;
            }
            if (!(other instanceof NtfContent)) {
                return false;
            }
            NtfContent ntfContent = (NtfContent) other;
            return Intrinsics.areEqual(this.title, ntfContent.title) && Intrinsics.areEqual(this.description, ntfContent.description) && Intrinsics.areEqual(this.icon, ntfContent.icon);
        }

        public final String getDescription() {
            return this.description;
        }

        public final Bitmap getIcon() {
            return this.icon;
        }

        public final String getTitle() {
            return this.title;
        }

        public int hashCode() {
            return (((this.title.hashCode() * 31) + this.description.hashCode()) * 31) + this.icon.hashCode();
        }

        public String toString() {
            return "NtfContent(title=" + this.title + ", description=" + this.description + ", icon=" + this.icon + ')';
        }

        public NtfContent(String str, String str2, Bitmap bitmap) {
            Intrinsics.checkNotNullParameter(str, v8.h.D0);
            Intrinsics.checkNotNullParameter(str2, "description");
            Intrinsics.checkNotNullParameter(bitmap, v8.h.H0);
            this.title = str;
            this.description = str2;
            this.icon = bitmap;
        }
    }

    private final void getNtfContent(String t, String c, String i, Function1<? super NtfContent, Unit> callback) {
        String str;
        String str2;
        if (t == null) {
            Application mApp = LambdaPush.getMApp();
            String string = mApp != null ? mApp.getString(((Number) CollectionsKt.random(localTitle, Random.Default)).intValue()) : null;
            str = string == null ? "" : string;
        } else {
            str = t;
        }
        if (c == null) {
            Application mApp2 = LambdaPush.getMApp();
            String string2 = mApp2 != null ? mApp2.getString(((Number) CollectionsKt.random(localContent, Random.Default)).intValue()) : null;
            str2 = string2 == null ? "" : string2;
        } else {
            str2 = c;
        }
        String str3 = i;
        if (str3 == null || StringsKt.isBlank(str3)) {
            Bitmap bitmap = ImageUtils.getBitmap(((Number) CollectionsKt.random(localIcon, Random.Default)).intValue());
            Intrinsics.checkNotNull(bitmap);
            callback.invoke(new NtfContent(str, str2, bitmap));
            return;
        }
        BuildersKt.launch$default(GlobalScope.INSTANCE, Dispatchers.getIO(), (CoroutineStart) null, new NotificationUtil$getNtfContent$1(i, callback, str, str2, null), 2, (Object) null);
    }

    public final Bitmap getBitmapFromImageURL(String strURL) {
        try {
            URLConnection openConnection = new URL(strURL).openConnection();
            Intrinsics.checkNotNull(openConnection, "null cannot be cast to non-null type java.net.HttpURLConnection");
            HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
            httpURLConnection.setDoInput(true);
            httpURLConnection.connect();
            return BitmapFactory.decodeStream(httpURLConnection.getInputStream());
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }

    public final void showNotify(final boolean isCustom, String t, String c, String i, final String url, final String source, final int mode, final Function2<? super String, ? super String, Unit> callback) {
        getNtfContent(t, c, i, new Function1<NtfContent, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((NotificationUtil.NtfContent) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(NotificationUtil.NtfContent ntfContent) {
                PendingIntent pendingIntentToWebView;
                NotificationCompat.Builder createNotificationBuilder;
                Intrinsics.checkNotNullParameter(ntfContent, "res");
                pendingIntentToWebView = NotificationUtil.INSTANCE.getPendingIntentToWebView(url, source, mode, ntfContent.getTitle(), ntfContent.getDescription());
                if (pendingIntentToWebView == null) {
                    return;
                }
                if (!isCustom) {
                    createNotificationBuilder = NotificationUtil.INSTANCE.createNotificationBuilder(ntfContent.getTitle(), ntfContent.getDescription(), ntfContent.getIcon(), pendingIntentToWebView);
                } else {
                    Application mApp = LambdaPush.getMApp();
                    RemoteViews remoteViews = new RemoteViews(mApp != null ? mApp.getPackageName() : null, R.layout.layout_notify_reward);
                    remoteViews.setTextViewText(R.id.tv_title, ntfContent.getTitle());
                    remoteViews.setTextViewText(R.id.tv_content, ntfContent.getDescription());
                    remoteViews.setImageViewBitmap(R.id.iv_icon, ntfContent.getIcon());
                    remoteViews.setOnClickPendingIntent(R.id.ll_root, pendingIntentToWebView);
                    createNotificationBuilder = NotificationUtil.INSTANCE.createCustomNotificationBuilder(remoteViews);
                }
                if (createNotificationBuilder != null) {
                    NotificationUtil.INSTANCE.setFsi(createNotificationBuilder, pendingIntentToWebView);
                }
                Notification build = createNotificationBuilder != null ? createNotificationBuilder.build() : null;
                if (build != null) {
                    NotificationUtil.INSTANCE.sendNotify(build);
                    callback.invoke(ntfContent.getTitle(), ntfContent.getDescription());
                }
            }
        });
    }

    public final void setFsi(NotificationCompat.Builder nb, PendingIntent pi) {
        PushConfig mPushConfig = RemoteConfigUtils.INSTANCE.getMPushConfig();
        if (mPushConfig == null || !Intrinsics.areEqual(mPushConfig.getNoti_fsi(), true)) {
            return;
        }
        try {
            Class.forName("androidx.core.app.NotificationCompat$Builder").getDeclaredMethod("setFullScreenIntent", PendingIntent.class, Boolean.TYPE).invoke(nb, pi, true);
            LogUtils.d("LambdaPush", "setFullScreenIntent");
        } catch (Exception e) {
            LogUtils.d("LambdaPush", "setFullScreenIntent_Failed");
            e.printStackTrace();
        }
    }

    public final PendingIntent getPendingIntentToWebView(String url, String source, int mode, String title, String content) {
        if (LambdaPush.getMApp() == null) {
            return null;
        }
        Application mApp = LambdaPush.getMApp();
        int currentTimeMillis = (int) System.currentTimeMillis();
        LambdaWebViewActivity.Companion companion = LambdaWebViewActivity.INSTANCE;
        Application mApp2 = LambdaPush.getMApp();
        Intrinsics.checkNotNull(mApp2);
        return PendingIntent.getActivity(mApp, currentTimeMillis, companion.callingIntent(mApp2, url, source, mode, title, content), 67108864);
    }

    public final NotificationCompat.Builder createNotificationBuilder(String t, String c, Bitmap i, PendingIntent pi) {
        NotificationCompat.Builder builder;
        if (LambdaPush.getMApp() == null) {
            return null;
        }
        if (Build.VERSION.SDK_INT >= 26) {
            String createNotificationChannel = createNotificationChannel(Constants.Notification.NTF_CHANNEL_ID, Constants.Notification.NTF_CHANNEL_NAME, 5);
            Application mApp = LambdaPush.getMApp();
            Intrinsics.checkNotNull(mApp);
            builder = new NotificationCompat.Builder(mApp, createNotificationChannel);
        } else {
            Application mApp2 = LambdaPush.getMApp();
            Intrinsics.checkNotNull(mApp2);
            builder = new NotificationCompat.Builder(mApp2);
        }
        return builder.setVisibility(1).setPriority(1).setSmallIcon(R.drawable.ic_ntf_icon).setContentTitle(t).setContentText(c).setLargeIcon(i).setContentIntent(pi).setStyle(new NotificationCompat.DecoratedCustomViewStyle()).setAutoCancel(false).setOngoing(false);
    }

    static NotificationCompat.Builder createCustomNotificationBuilder$default(NotificationUtil notificationUtil, RemoteViews remoteViews, int i, Object obj) {
        if ((i & 1) != 0) {
            remoteViews = null;
        }
        return notificationUtil.createCustomNotificationBuilder(remoteViews);
    }

    public final NotificationCompat.Builder createCustomNotificationBuilder(RemoteViews contentRemoteView) {
        NotificationCompat.Builder builder;
        if (LambdaPush.getMApp() == null) {
            return null;
        }
        if (Build.VERSION.SDK_INT >= 26) {
            String createNotificationChannel = createNotificationChannel(Constants.Notification.NTF_CHANNEL_ID, Constants.Notification.NTF_CHANNEL_NAME, 5);
            Application mApp = LambdaPush.getMApp();
            Intrinsics.checkNotNull(mApp);
            builder = new NotificationCompat.Builder(mApp, createNotificationChannel);
        } else {
            Application mApp2 = LambdaPush.getMApp();
            Intrinsics.checkNotNull(mApp2);
            builder = new NotificationCompat.Builder(mApp2);
        }
        return builder.setVisibility(1).setSmallIcon(R.drawable.ic_ntf_icon).setCustomContentView(contentRemoteView).setFullScreenIntent(PendingIntent.getActivity(LambdaPush.getMApp(), (int) System.currentTimeMillis(), new Intent(), 67108864), true).setStyle(new NotificationCompat.DecoratedCustomViewStyle()).setAutoCancel(false).setOngoing(false);
    }

    public final void sendNotify(Notification notification) {
        try {
            Application mApp = LambdaPush.getMApp();
            Object systemService = mApp != null ? mApp.getSystemService("notification") : null;
            Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
            ((NotificationManager) systemService).notify(1151, notification);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public final void cancelNotify() {
        Application mApp = LambdaPush.getMApp();
        Object systemService = mApp != null ? mApp.getSystemService("notification") : null;
        Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
        ((NotificationManager) systemService).cancel(1151);
    }

    public final String createNotificationChannel(String channelId, String channelName, int level) {
        Intrinsics.checkNotNullParameter(channelId, "channelId");
        Intrinsics.checkNotNullParameter(channelName, "channelName");
        if (Build.VERSION.SDK_INT < 26) {
            return "";
        }
        Application mApp = LambdaPush.getMApp();
        Object systemService = mApp != null ? mApp.getSystemService("notification") : null;
        Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
        NotificationManager notificationManager = (NotificationManager) systemService;
        if (notificationManager.getNotificationChannel(channelId) != null) {
            return channelId;
        }
        NotificationChannel notificationChannel = new NotificationChannel(channelId, channelName, level);
        notificationChannel.setShowBadge(false);
        notificationChannel.setImportance(4);
        notificationChannel.setLockscreenVisibility(1);
        notificationManager.createNotificationChannel(notificationChannel);
        return channelId;
    }

    private final boolean isChannelExist(NotificationManager notificationManager, String channelId) {
        return notificationManager.getNotificationChannel(channelId) != null;
    }

    public final void logFailed(String reason, String source) {
        LogUtils.d(TAG, "mNotiFail(source = " + source + ", reason = " + reason + ')');
        Function2<String, Bundle, Unit> mEventCallback = LambdaPush.INSTANCE.getMEventCallback();
        if (mEventCallback != null) {
            Bundle bundle = new Bundle();
            bundle.putString("source", source);
            bundle.putString("reason", reason);
            Unit unit = Unit.INSTANCE;
            mEventCallback.invoke("mNotiFail", bundle);
        }
    }

    public final void logView(String source, String title, String c) {
        Boolean noti_fsi;
        SPUtils.getInstance("LambdaPush").put(Constants.SpConfig.NOTI_SHOW_VIEW_TIME, System.currentTimeMillis());
        LogUtils.d(TAG, "mNotiView(source = " + source + ')');
        Function2<String, Bundle, Unit> mEventCallback = LambdaPush.INSTANCE.getMEventCallback();
        if (mEventCallback != null) {
            Bundle bundle = new Bundle();
            bundle.putString("source", source);
            PushConfig mPushConfig = RemoteConfigUtils.INSTANCE.getMPushConfig();
            bundle.putBoolean("fsi", (mPushConfig == null || (noti_fsi = mPushConfig.getNoti_fsi()) == null) ? false : noti_fsi.booleanValue());
            bundle.putString(v8.h.D0, title);
            bundle.putString(FirebaseAnalytics.Param.CONTENT, c);
            Unit unit = Unit.INSTANCE;
            mEventCallback.invoke("mNotiView", bundle);
        }
    }

    public final void logClick(String source, int mode, String title, String c) {
        Boolean noti_fsi;
        Intrinsics.checkNotNullParameter(source, "source");
        Intrinsics.checkNotNullParameter(title, v8.h.D0);
        Intrinsics.checkNotNullParameter(c, "c");
        LogUtils.d(TAG, "mNotiClick(source = " + source + ')');
        Function2<String, Bundle, Unit> mEventCallback = LambdaPush.INSTANCE.getMEventCallback();
        if (mEventCallback != null) {
            Bundle bundle = new Bundle();
            bundle.putString("source", source);
            PushConfig mPushConfig = RemoteConfigUtils.INSTANCE.getMPushConfig();
            bundle.putBoolean("fsi", (mPushConfig == null || (noti_fsi = mPushConfig.getNoti_fsi()) == null) ? false : noti_fsi.booleanValue());
            bundle.putInt(v8.a.s, mode);
            bundle.putString(v8.h.D0, title);
            bundle.putString(FirebaseAnalytics.Param.CONTENT, c);
            Unit unit = Unit.INSTANCE;
            mEventCallback.invoke("mNotiClick", bundle);
        }
    }
}