mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Update notification on profile name fetch or change.
This commit is contained in:
@@ -34,6 +34,7 @@ import org.thoughtcrime.securesms.jobmanager.Job;
|
||||
import org.thoughtcrime.securesms.jobmanager.JobManager;
|
||||
import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
import org.thoughtcrime.securesms.notifications.v2.ConversationId;
|
||||
import org.thoughtcrime.securesms.profiles.ProfileName;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
@@ -462,12 +463,12 @@ public class RetrieveProfileJob extends BaseJob {
|
||||
String remoteDisplayName = remoteProfileName.toString();
|
||||
String localDisplayName = localProfileName.toString();
|
||||
|
||||
if (!recipient.isBlocked() &&
|
||||
!recipient.isGroup() &&
|
||||
!recipient.isSelf() &&
|
||||
!localDisplayName.isEmpty() &&
|
||||
!remoteDisplayName.equals(localDisplayName))
|
||||
{
|
||||
boolean writeChangeEvent = !recipient.isBlocked() &&
|
||||
!recipient.isGroup() &&
|
||||
!recipient.isSelf() &&
|
||||
!localDisplayName.isEmpty() &&
|
||||
!remoteDisplayName.equals(localDisplayName);
|
||||
if (writeChangeEvent) {
|
||||
Log.i(TAG, "Writing a profile name change event for " + recipient.getId());
|
||||
SignalDatabase.messages().insertProfileNameChangeMessages(recipient, remoteDisplayName, localDisplayName);
|
||||
} else {
|
||||
@@ -475,6 +476,13 @@ public class RetrieveProfileJob extends BaseJob {
|
||||
recipient.isBlocked(), recipient.isGroup(), recipient.isSelf(), localDisplayName.isEmpty(), !remoteDisplayName.equals(localDisplayName)));
|
||||
}
|
||||
|
||||
if (writeChangeEvent || localDisplayName.isEmpty()) {
|
||||
Long threadId = SignalDatabase.threads().getThreadIdFor(recipient.getId());
|
||||
if (threadId != null) {
|
||||
ApplicationDependencies.getMessageNotifier().updateNotification(context, ConversationId.forConversation(threadId));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} catch (InvalidCiphertextException e) {
|
||||
|
||||
Reference in New Issue
Block a user