Fix instrumentation tests by forcing channel id usage to init channels.

This commit is contained in:
Cody Henthorne
2022-12-08 12:15:17 -05:00
parent 51015dc898
commit fb0aa55cbb
23 changed files with 49 additions and 48 deletions

View File

@@ -66,17 +66,17 @@ public class NotificationChannels {
private static final String CONTACT_PREFIX = "contact_";
private static final String MESSAGES_PREFIX = "messages_";
public static final String CALLS = "calls_v3";
public static final String FAILURES = "failures";
public static final String APP_UPDATES = "app_updates";
public static final String BACKUPS = "backups_v2";
public static final String LOCKED_STATUS = "locked_status_v2";
public static final String OTHER = "other_v3";
public static final String VOICE_NOTES = "voice_notes";
public static final String JOIN_EVENTS = "join_events";
public static final String BACKGROUND = "background_connection";
public static final String CALL_STATUS = "call_status";
public static final String APP_ALERTS = "app_alerts";
public final String CALLS = "calls_v3";
public final String FAILURES = "failures";
public final String APP_UPDATES = "app_updates";
public final String BACKUPS = "backups_v2";
public final String LOCKED_STATUS = "locked_status_v2";
public final String OTHER = "other_v3";
public final String VOICE_NOTES = "voice_notes";
public final String JOIN_EVENTS = "join_events";
public final String BACKGROUND = "background_connection";
public final String CALL_STATUS = "call_status";
public final String APP_ALERTS = "app_alerts";
private static volatile NotificationChannels instance;
@@ -658,7 +658,7 @@ public class NotificationChannels {
}
@TargetApi(26)
private static int getDefaultBackgroundChannelImportance(NotificationManager notificationManager) {
private int getDefaultBackgroundChannelImportance(NotificationManager notificationManager) {
NotificationChannel existingOther = notificationManager.getNotificationChannel(OTHER);
if (existingOther != null && existingOther.getImportance() != NotificationManager.IMPORTANCE_LOW) {

View File

@@ -101,7 +101,7 @@ data class NotificationConversation(
fun getChannelId(context: Context): String {
return if (isOnlyContactJoinedEvent) {
NotificationChannels.JOIN_EVENTS
NotificationChannels.getInstance().JOIN_EVENTS
} else {
recipient.notificationChannel ?: NotificationChannels.getInstance().messagesChannel
}

View File

@@ -323,7 +323,7 @@ object NotificationFactory {
setContentIntent(NotificationPendingIntentHelper.getActivity(context, 0, intent, PendingIntentFlags.mutable()))
setAutoCancel(true)
setAlarms(recipient)
setChannelId(NotificationChannels.FAILURES)
setChannelId(NotificationChannels.getInstance().FAILURES)
}
NotificationManagerCompat.from(context).safelyNotify(context, recipient, NotificationIds.getNotificationIdForMessageDeliveryFailed(thread), builder.build())
@@ -353,7 +353,7 @@ object NotificationFactory {
setOnlyAlertOnce(true)
setAutoCancel(true)
setAlarms(recipient)
setChannelId(NotificationChannels.FAILURES)
setChannelId(NotificationChannels.getInstance().FAILURES)
}
NotificationManagerCompat.from(context).safelyNotify(context, recipient, NotificationIds.getNotificationIdForMessageDeliveryFailed(thread), builder.build())