package com.qualtrics.digital;

import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import androidx.core.app.m;
import java.util.UUID;

/* loaded from: classes3.dex */
public class QualtricsNotificationManager extends BroadcastReceiver {
    /* JADX INFO: Access modifiers changed from: package-private */
    public static void a(Context context) {
        String string = context.getResources().getString(em.c.f17221b);
        String string2 = context.getResources().getString(em.c.f17220a);
        NotificationChannel notificationChannel = new NotificationChannel("qualtrics_notification_channel", string, 3);
        notificationChannel.setDescription(string2);
        ((NotificationManager) context.getSystemService(NotificationManager.class)).createNotificationChannel(notificationChannel);
    }

    private static void b(Context context, String str, String str2, String str3, String str4, String str5, String str6, boolean z10) {
        String uuid = UUID.randomUUID().toString();
        int i10 = em.b.f17218a;
        int a10 = i0.d(context).a();
        if (a10 != 0) {
            i10 = a10;
        }
        Intent flags = new Intent(context, (Class<?>) QualtricsSurveyActivity.class).putExtra("targetURL", str3).putExtra("interceptID", str4).putExtra("creativeID", str5).putExtra("actionSetID", str6).setData(Uri.parse(uuid)).setFlags(874512384);
        flags.putExtra("autoCloseAtEndOfSurvey", z10);
        PendingIntent activity = PendingIntent.getActivity(context, 0, flags, 67108864);
        m.e e10 = new m.e(context, "qualtrics_notification_channel").v(i10).j(str).i(str2).t(0).o(uuid).e(true);
        if (str3 != null) {
            e10.h(activity);
        }
        androidx.core.app.p.b(context).d(uuid, 0, e10.b());
    }

    @Override // android.content.BroadcastReceiver
    public void onReceive(Context context, Intent intent) {
        try {
            Bundle extras = intent.getExtras();
            b(context, extras.getString("title"), extras.getString("description"), extras.getString("targetURL"), extras.getString("interceptID"), extras.getString("creativeID"), extras.getString("actionSetID"), extras.getBoolean("autoCloseAtEndOfSurvey"));
        } catch (Throwable th2) {
            g.a(th2);
        }
    }
}
