mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 18:00:02 +01:00
Implement group story notifications.
This commit is contained in:
committed by
Cody Henthorne
parent
01543dd52b
commit
a03c49e12c
@@ -20,7 +20,7 @@ import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
import org.thoughtcrime.securesms.notifications.NotificationIds;
|
||||
import org.thoughtcrime.securesms.notifications.v2.NotificationFactory;
|
||||
import org.thoughtcrime.securesms.notifications.v2.NotificationThread;
|
||||
import org.thoughtcrime.securesms.notifications.v2.ConversationId;
|
||||
import org.thoughtcrime.securesms.preferences.widgets.NotificationPrivacyPreference;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
@@ -76,12 +76,12 @@ public final class BubbleUtil {
|
||||
*/
|
||||
public static void displayAsBubble(@NonNull Context context, @NonNull RecipientId recipientId, long threadId) {
|
||||
if (Build.VERSION.SDK_INT >= CONVERSATION_SUPPORT_VERSION) {
|
||||
NotificationThread notificationThread = NotificationThread.forConversation(threadId);
|
||||
ConversationId conversationId = ConversationId.forConversation(threadId);
|
||||
SignalExecutors.BOUNDED.execute(() -> {
|
||||
if (canBubble(context, recipientId, threadId)) {
|
||||
NotificationManager notificationManager = ServiceUtil.getNotificationManager(context);
|
||||
StatusBarNotification[] notifications = notificationManager.getActiveNotifications();
|
||||
int threadNotificationId = NotificationIds.getNotificationIdForThread(notificationThread);
|
||||
int threadNotificationId = NotificationIds.getNotificationIdForThread(conversationId);
|
||||
Notification activeThreadNotification = Stream.of(notifications)
|
||||
.filter(n -> n.getId() == threadNotificationId)
|
||||
.findFirst()
|
||||
@@ -89,7 +89,7 @@ public final class BubbleUtil {
|
||||
.orElse(null);
|
||||
|
||||
if (activeThreadNotification != null && activeThreadNotification.deleteIntent != null) {
|
||||
ApplicationDependencies.getMessageNotifier().updateNotification(context, notificationThread, BubbleState.SHOWN);
|
||||
ApplicationDependencies.getMessageNotifier().updateNotification(context, conversationId, BubbleState.SHOWN);
|
||||
} else {
|
||||
Recipient recipient = Recipient.resolved(recipientId);
|
||||
NotificationFactory.notifyToBubbleConversation(context, recipient, threadId);
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.thoughtcrime.securesms.database.MessageDatabase.InsertResult;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.database.model.IdentityRecord;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.notifications.v2.NotificationThread;
|
||||
import org.thoughtcrime.securesms.notifications.v2.ConversationId;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
import org.thoughtcrime.securesms.sms.IncomingIdentityDefaultMessage;
|
||||
@@ -141,7 +141,7 @@ public final class IdentityUtil {
|
||||
Optional<InsertResult> insertResult = smsDatabase.insertMessageInbox(individualUpdate);
|
||||
|
||||
if (insertResult.isPresent()) {
|
||||
ApplicationDependencies.getMessageNotifier().updateNotification(context, NotificationThread.forConversation(insertResult.get().getThreadId()));
|
||||
ApplicationDependencies.getMessageNotifier().updateNotification(context, ConversationId.forConversation(insertResult.get().getThreadId()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class PagingMappingAdapter<Key> extends MappingAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable MappingModel<?> getItem(int position) {
|
||||
public @Nullable MappingModel<?> getItem(int position) {
|
||||
if (pagingController != null) {
|
||||
pagingController.onDataNeededAroundIndex(position);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user