Switch logic order for detecting conversation channel changes.
This commit is contained in:
parent
4af078007e
commit
f4dd80c929
1 changed files with 6 additions and 6 deletions
|
@ -550,12 +550,9 @@ public class NotificationChannels {
|
||||||
Set<String> existingChannelIds = Stream.of(notificationManager.getNotificationChannels()).map(NotificationChannel::getId).collect(Collectors.toSet());
|
Set<String> existingChannelIds = Stream.of(notificationManager.getNotificationChannels()).map(NotificationChannel::getId).collect(Collectors.toSet());
|
||||||
|
|
||||||
for (NotificationChannel existingChannel : notificationManager.getNotificationChannels()) {
|
for (NotificationChannel existingChannel : notificationManager.getNotificationChannels()) {
|
||||||
if (existingChannel.getId().startsWith(CONTACT_PREFIX) && !customChannelIds.contains(existingChannel.getId())) {
|
if ((existingChannel.getId().startsWith(CONTACT_PREFIX) || existingChannel.getId().startsWith(MESSAGES_PREFIX)) &&
|
||||||
Log.i(TAG, "Consistency: Deleting channel '"+ existingChannel.getId() + "' because the DB has no record of it.");
|
Build.VERSION.SDK_INT >= CONVERSATION_SUPPORT_VERSION &&
|
||||||
notificationManager.deleteNotificationChannel(existingChannel.getId());
|
existingChannel.getConversationId() != null)
|
||||||
} else if (existingChannel.getId().startsWith(MESSAGES_PREFIX) &&
|
|
||||||
Build.VERSION.SDK_INT >= CONVERSATION_SUPPORT_VERSION &&
|
|
||||||
existingChannel.getConversationId() != null)
|
|
||||||
{
|
{
|
||||||
if (customChannelIds.contains(existingChannel.getId())) {
|
if (customChannelIds.contains(existingChannel.getId())) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -569,6 +566,9 @@ public class NotificationChannels {
|
||||||
Log.i(TAG, "Consistency: Conversation channel created outside of app with no matching recipient, deleting channel '" + existingChannel.getId() + "'");
|
Log.i(TAG, "Consistency: Conversation channel created outside of app with no matching recipient, deleting channel '" + existingChannel.getId() + "'");
|
||||||
notificationManager.deleteNotificationChannel(existingChannel.getId());
|
notificationManager.deleteNotificationChannel(existingChannel.getId());
|
||||||
}
|
}
|
||||||
|
} else if (existingChannel.getId().startsWith(CONTACT_PREFIX) && !customChannelIds.contains(existingChannel.getId())) {
|
||||||
|
Log.i(TAG, "Consistency: Deleting channel '"+ existingChannel.getId() + "' because the DB has no record of it.");
|
||||||
|
notificationManager.deleteNotificationChannel(existingChannel.getId());
|
||||||
} else if (existingChannel.getId().startsWith(MESSAGES_PREFIX) && !existingChannel.getId().equals(getMessagesChannel(context))) {
|
} else if (existingChannel.getId().startsWith(MESSAGES_PREFIX) && !existingChannel.getId().equals(getMessagesChannel(context))) {
|
||||||
Log.i(TAG, "Consistency: Deleting channel '" + existingChannel.getId() + "' because it's out of date.");
|
Log.i(TAG, "Consistency: Deleting channel '" + existingChannel.getId() + "' because it's out of date.");
|
||||||
notificationManager.deleteNotificationChannel(existingChannel.getId());
|
notificationManager.deleteNotificationChannel(existingChannel.getId());
|
||||||
|
|
Loading…
Add table
Reference in a new issue