mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-24 10:51:27 +01:00
Integrate contact hiding with message requests.
This commit is contained in:
@@ -115,6 +115,7 @@ public class Recipient {
|
||||
private final String profileAvatar;
|
||||
private final ProfileAvatarFileDetails profileAvatarFileDetails;
|
||||
private final boolean profileSharing;
|
||||
private final boolean isHidden;
|
||||
private final long lastProfileFetch;
|
||||
private final String notificationChannel;
|
||||
private final UnidentifiedAccessMode unidentifiedAccessMode;
|
||||
@@ -412,6 +413,7 @@ public class Recipient {
|
||||
this.profileAvatar = null;
|
||||
this.profileAvatarFileDetails = ProfileAvatarFileDetails.NO_DETAILS;
|
||||
this.profileSharing = false;
|
||||
this.isHidden = false;
|
||||
this.lastProfileFetch = 0;
|
||||
this.notificationChannel = null;
|
||||
this.unidentifiedAccessMode = UnidentifiedAccessMode.DISABLED;
|
||||
@@ -466,6 +468,7 @@ public class Recipient {
|
||||
this.profileAvatar = details.profileAvatar;
|
||||
this.profileAvatarFileDetails = details.profileAvatarFileDetails;
|
||||
this.profileSharing = details.profileSharing;
|
||||
this.isHidden = details.isHidden;
|
||||
this.lastProfileFetch = details.lastProfileFetch;
|
||||
this.notificationChannel = details.notificationChannel;
|
||||
this.unidentifiedAccessMode = details.unidentifiedAccessMode;
|
||||
@@ -833,6 +836,10 @@ public class Recipient {
|
||||
return profileSharing;
|
||||
}
|
||||
|
||||
public boolean isHidden() {
|
||||
return isHidden;
|
||||
}
|
||||
|
||||
public long getLastProfileFetchTime() {
|
||||
return lastProfileFetch;
|
||||
}
|
||||
@@ -1290,6 +1297,7 @@ public class Recipient {
|
||||
expireMessages == other.expireMessages &&
|
||||
Objects.equals(profileAvatarFileDetails, other.profileAvatarFileDetails) &&
|
||||
profileSharing == other.profileSharing &&
|
||||
isHidden == other.isHidden &&
|
||||
forceSmsSelection == other.forceSmsSelection &&
|
||||
Objects.equals(serviceId, other.serviceId) &&
|
||||
Objects.equals(username, other.username) &&
|
||||
|
||||
@@ -63,6 +63,7 @@ public class RecipientDetails {
|
||||
final String profileAvatar;
|
||||
final ProfileAvatarFileDetails profileAvatarFileDetails;
|
||||
final boolean profileSharing;
|
||||
final boolean isHidden;
|
||||
final long lastProfileFetch;
|
||||
final boolean systemContact;
|
||||
final boolean isSelf;
|
||||
@@ -122,6 +123,7 @@ public class RecipientDetails {
|
||||
this.profileAvatar = record.getProfileAvatar();
|
||||
this.profileAvatarFileDetails = record.getProfileAvatarFileDetails();
|
||||
this.profileSharing = record.isProfileSharing();
|
||||
this.isHidden = record.isHidden();
|
||||
this.lastProfileFetch = record.getLastProfileFetch();
|
||||
this.systemContact = systemContact;
|
||||
this.isSelf = isSelf;
|
||||
@@ -176,6 +178,7 @@ public class RecipientDetails {
|
||||
this.profileAvatar = null;
|
||||
this.profileAvatarFileDetails = ProfileAvatarFileDetails.NO_DETAILS;
|
||||
this.profileSharing = false;
|
||||
this.isHidden = false;
|
||||
this.lastProfileFetch = 0;
|
||||
this.systemContact = true;
|
||||
this.isSelf = false;
|
||||
|
||||
@@ -198,6 +198,22 @@ public class RecipientUtil {
|
||||
StorageSyncHelper.scheduleSyncForDataChange();
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
public static boolean isRecipientHidden(long threadId) {
|
||||
if (threadId < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ThreadTable threadTable = SignalDatabase.threads();
|
||||
Recipient threadRecipient = threadTable.getRecipientForThreadId(threadId);
|
||||
|
||||
if (threadRecipient == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return threadRecipient.isHidden();
|
||||
}
|
||||
|
||||
/**
|
||||
* If true, the new message request UI does not need to be shown, and it's safe to send read
|
||||
* receipts.
|
||||
@@ -281,7 +297,8 @@ public class RecipientUtil {
|
||||
threadRecipient.isProfileSharing() ||
|
||||
threadRecipient.isSystemContact() ||
|
||||
!threadRecipient.isRegistered() ||
|
||||
threadRecipient.isForceSmsSelection();
|
||||
threadRecipient.isForceSmsSelection() ||
|
||||
threadRecipient.isHidden();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -331,9 +348,11 @@ public class RecipientUtil {
|
||||
threadRecipient.isSystemContact() ||
|
||||
threadRecipient.isForceSmsSelection() ||
|
||||
!threadRecipient.isRegistered() ||
|
||||
hasSentMessageInThread(threadId) ||
|
||||
noSecureMessagesAndNoCallsInThread(threadId) ||
|
||||
isPreMessageRequestThread(threadId);
|
||||
(!threadRecipient.isHidden() && (
|
||||
hasSentMessageInThread(threadId) ||
|
||||
noSecureMessagesAndNoCallsInThread(threadId) ||
|
||||
isPreMessageRequestThread(threadId))
|
||||
);
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
|
||||
Reference in New Issue
Block a user