mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 09:20:19 +01:00
Improve notification channel consistency checks with Android Conversations.
This commit is contained in:
@@ -25,6 +25,7 @@ import org.thoughtcrime.securesms.groups.MembershipNotSuitableForV2Exception;
|
||||
import org.thoughtcrime.securesms.groups.SelectionLimits;
|
||||
import org.thoughtcrime.securesms.groups.ui.GroupChangeErrorCallback;
|
||||
import org.thoughtcrime.securesms.groups.ui.GroupChangeFailureReason;
|
||||
import org.thoughtcrime.securesms.notifications.NotificationChannels;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientUtil;
|
||||
@@ -148,6 +149,15 @@ final class ManageGroupRepository {
|
||||
});
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
boolean hasCustomNotifications(Recipient recipient) {
|
||||
if (recipient.getNotificationChannel() != null || !NotificationChannels.supported()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return NotificationChannels.updateWithShortcutBasedChannel(context, recipient);
|
||||
}
|
||||
|
||||
static final class GroupStateResult {
|
||||
|
||||
private final long threadId;
|
||||
|
||||
@@ -36,7 +36,6 @@ import org.thoughtcrime.securesms.groups.ui.GroupMemberEntry;
|
||||
import org.thoughtcrime.securesms.groups.ui.addmembers.AddMembersActivity;
|
||||
import org.thoughtcrime.securesms.groups.ui.managegroup.dialogs.GroupMentionSettingDialog;
|
||||
import org.thoughtcrime.securesms.groups.v2.GroupLinkUrlAndStatus;
|
||||
import org.thoughtcrime.securesms.notifications.NotificationChannels;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientUtil;
|
||||
@@ -120,8 +119,7 @@ public class ManageGroupViewModel extends ViewModel {
|
||||
this.canAddMembers = liveGroup.selfCanAddMembers();
|
||||
this.muteState = Transformations.map(this.groupRecipient,
|
||||
recipient -> new MuteState(recipient.getMuteUntil(), recipient.isMuted()));
|
||||
this.hasCustomNotifications = Transformations.map(this.groupRecipient,
|
||||
recipient -> recipient.getNotificationChannel() != null || !NotificationChannels.supported());
|
||||
this.hasCustomNotifications = LiveDataUtil.mapAsync(this.groupRecipient, manageGroupRepository::hasCustomNotifications);
|
||||
this.canLeaveGroup = liveGroup.isActive();
|
||||
this.canBlockGroup = Transformations.map(this.groupRecipient, recipient -> RecipientUtil.isBlockable(recipient) && !recipient.isBlocked());
|
||||
this.canUnblockGroup = Transformations.map(this.groupRecipient, Recipient::isBlocked);
|
||||
|
||||
Reference in New Issue
Block a user