Optimistically fetch profiles.

This commit is contained in:
Greyson Parrelli
2020-06-12 10:22:46 -07:00
committed by Greyson Parrelli
parent f5626f678d
commit ce940235b0
11 changed files with 169 additions and 29 deletions

View File

@@ -89,6 +89,7 @@ public class Recipient {
private final String profileAvatar;
private final boolean hasProfileImage;
private final boolean profileSharing;
private final long lastProfileFetch;
private final String notificationChannel;
private final UnidentifiedAccessMode unidentifiedAccessMode;
private final boolean forceSmsSelection;
@@ -332,6 +333,7 @@ public class Recipient {
this.profileAvatar = null;
this.hasProfileImage = false;
this.profileSharing = false;
this.lastProfileFetch = 0;
this.notificationChannel = null;
this.unidentifiedAccessMode = UnidentifiedAccessMode.DISABLED;
this.forceSmsSelection = false;
@@ -374,6 +376,7 @@ public class Recipient {
this.profileAvatar = details.profileAvatar;
this.hasProfileImage = details.hasProfileImage;
this.profileSharing = details.profileSharing;
this.lastProfileFetch = details.lastProfileFetch;
this.notificationChannel = details.notificationChannel;
this.unidentifiedAccessMode = details.unidentifiedAccessMode;
this.forceSmsSelection = details.forceSmsSelection;
@@ -610,6 +613,10 @@ public class Recipient {
return profileSharing;
}
public long getLastProfileFetchTime() {
return lastProfileFetch;
}
public boolean isGroup() {
return resolve().groupId != null;
}

View File

@@ -53,6 +53,7 @@ public class RecipientDetails {
final String profileAvatar;
final boolean hasProfileImage;
final boolean profileSharing;
final long lastProfileFetch;
final boolean systemContact;
final boolean isLocalNumber;
final String notificationChannel;
@@ -99,6 +100,7 @@ public class RecipientDetails {
this.profileAvatar = settings.getProfileAvatar();
this.hasProfileImage = settings.hasProfileImage();
this.profileSharing = settings.isProfileSharing();
this.lastProfileFetch = settings.getLastProfileFetch();
this.systemContact = systemContact;
this.isLocalNumber = isLocalNumber;
this.notificationChannel = settings.getNotificationChannel();
@@ -146,6 +148,7 @@ public class RecipientDetails {
this.profileAvatar = null;
this.hasProfileImage = false;
this.profileSharing = false;
this.lastProfileFetch = 0;
this.systemContact = true;
this.isLocalNumber = false;
this.notificationChannel = null;

View File

@@ -163,7 +163,7 @@ public class RecipientUtil {
return true;
}
long beforeTime = SignalStore.getMessageRequestEnableTime();
long beforeTime = SignalStore.misc().getMessageRequestEnableTime();
return DatabaseFactory.getMmsSmsDatabase(context).getConversationCount(threadId, beforeTime) > 0;
}