package com.firemint.realracing; import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.Context; import android.media.AudioAttributes; import android.util.Log; /* loaded from: classes2.dex */ public class NotificationChannelHelper { private String CHANNEL_ID_CARS; private String CHANNEL_ID_DOWNLOADS; private String CHANNEL_ID_GENERAL; private String CHANNEL_ID_SPECIAL_EVENTS; public NotificationChannelHelper(Context context) { InitialiseNotificationChannels(context); } private void CacheChannelNames(Context context) { this.CHANNEL_ID_GENERAL = context.getString(R.string.NOTIFICATION_CHANNEL_GENERAL_ID); this.CHANNEL_ID_CARS = context.getString(R.string.NOTIFICATION_CHANNEL_CARS_ID); this.CHANNEL_ID_SPECIAL_EVENTS = context.getString(R.string.NOTIFICATION_CHANNEL_SPECIAL_EVENTS_ID); this.CHANNEL_ID_DOWNLOADS = context.getString(R.string.NOTIFICATION_CHANNEL_DOWNLOADS_ID); } public class NotificationChannelContainer { private String m_id; private int m_importance; private String m_localisedName; private NotificationChannelContainer(String str, String str2, int i) { this.m_id = str; this.m_localisedName = str2; this.m_importance = i; } public void CreateNotificationChannel(NotificationManager notificationManager, Context context) { NotificationChannel notificationChannel = new NotificationChannel(this.m_id, this.m_localisedName, this.m_importance); boolean z = this.m_importance > 2; notificationChannel.setShowBadge(z); notificationChannel.enableLights(z); notificationChannel.enableVibration(z); notificationChannel.setLightColor(context.getResources().getColor(R.color.NotificationColor)); notificationChannel.setSound(DelayedNotificationService.GetNotificationSoundUri(context), new AudioAttributes.Builder().setUsage(5).setContentType(4).build()); notificationManager.createNotificationChannel(notificationChannel); } } public String NotificationToChannelId(int i) { switch (i) { case -2: case 7: case 9: case 10: return this.CHANNEL_ID_GENERAL; case -1: case 0: case 12: default: Log.e("RR3_Notif_Channel_Mgr", "Failed to find a channel for id: " + i); return this.CHANNEL_ID_GENERAL; case 1: case 2: return this.CHANNEL_ID_DOWNLOADS; case 3: case 8: case 11: return this.CHANNEL_ID_SPECIAL_EVENTS; case 4: case 5: case 6: case 13: case 14: return this.CHANNEL_ID_CARS; } } private void InitialiseNotificationChannels(Context context) { if (MainActivity.IsAtLeastAPI(26)) { CacheChannelNames(context); CreateNotificationChannels((NotificationManager) context.getSystemService("notification"), context); } } private void CreateNotificationChannels(NotificationManager notificationManager, Context context) { int i = 3; NotificationChannelContainer[] notificationChannelContainerArr = {new NotificationChannelContainer(this.CHANNEL_ID_GENERAL, context.getString(R.string.NOTIFICATION_CHANNEL_GENERAL_TITLE), i), new NotificationChannelContainer(this.CHANNEL_ID_CARS, context.getString(R.string.NOTIFICATION_CHANNEL_CARS_TITLE), i), new NotificationChannelContainer(this.CHANNEL_ID_SPECIAL_EVENTS, context.getString(R.string.NOTIFICATION_CHANNEL_SPECIAL_EVENTS_TITLE), i), new NotificationChannelContainer(this.CHANNEL_ID_DOWNLOADS, context.getString(R.string.NOTIFICATION_CHANNEL_DOWNLOADS), 2)}; for (int i2 = 0; i2 < 4; i2++) { notificationChannelContainerArr[i2].CreateNotificationChannel(notificationManager, context); } } }