kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix situation where group thread does not yet exist.
rodzic
8df6e95781
commit
6e5abc92a0
|
@ -24,7 +24,9 @@ import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class ReviewUtil {
|
public final class ReviewUtil {
|
||||||
|
|
||||||
|
private ReviewUtil() { }
|
||||||
|
|
||||||
private static final long TIMEOUT = TimeUnit.HOURS.toMillis(24);
|
private static final long TIMEOUT = TimeUnit.HOURS.toMillis(24);
|
||||||
|
|
||||||
|
@ -91,10 +93,14 @@ public class ReviewUtil {
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
public static @NonNull List<MessageRecord> getProfileChangeRecordsForGroup(@NonNull Context context, @NonNull GroupId.V2 groupId) {
|
public static @NonNull List<MessageRecord> getProfileChangeRecordsForGroup(@NonNull Context context, @NonNull GroupId.V2 groupId) {
|
||||||
RecipientId recipientId = DatabaseFactory.getRecipientDatabase(context).getByGroupId(groupId).get();
|
RecipientId recipientId = DatabaseFactory.getRecipientDatabase(context).getByGroupId(groupId).get();
|
||||||
long threadId = Objects.requireNonNull(DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipientId));
|
Long threadId = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipientId);
|
||||||
|
|
||||||
|
if (threadId == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
} else {
|
||||||
return DatabaseFactory.getSmsDatabase(context).getProfileChangeDetailsRecords(threadId, System.currentTimeMillis() - TIMEOUT);
|
return DatabaseFactory.getSmsDatabase(context).getProfileChangeDetailsRecords(threadId, System.currentTimeMillis() - TIMEOUT);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
public static int getGroupsInCommonCount(@NonNull Context context, @NonNull RecipientId recipientId) {
|
public static int getGroupsInCommonCount(@NonNull Context context, @NonNull RecipientId recipientId) {
|
||||||
|
|
Ładowanie…
Reference in New Issue