mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 00:29:11 +01:00
Renamed database classes to table classes.
Because they're not databases. They're tables.
This commit is contained in:
committed by
Cody Henthorne
parent
b190f9495a
commit
7949996c5c
@@ -29,7 +29,7 @@ import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.WebRtcCallActivity;
|
||||
import org.thoughtcrime.securesms.contacts.sync.ContactDiscovery;
|
||||
import org.thoughtcrime.securesms.conversation.ConversationIntents;
|
||||
import org.thoughtcrime.securesms.database.GroupDatabase;
|
||||
import org.thoughtcrime.securesms.database.GroupTable;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.groups.GroupId;
|
||||
@@ -237,7 +237,7 @@ public class CommunicationActions {
|
||||
GroupId.V2 groupId = GroupId.v2(groupInviteLinkUrl.getGroupMasterKey());
|
||||
|
||||
SimpleTask.run(SignalExecutors.BOUNDED, () -> {
|
||||
GroupDatabase.GroupRecord group = SignalDatabase.groups().getGroup(groupId).orElse(null);
|
||||
GroupTable.GroupRecord group = SignalDatabase.groups().getGroup(groupId).orElse(null);
|
||||
|
||||
return group != null && group.isActive() ? Recipient.resolved(group.getRecipientId())
|
||||
: null;
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.signal.core.util.concurrent.SignalExecutors;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.conversation.ConversationIntents;
|
||||
import org.thoughtcrime.securesms.database.GroupDatabase;
|
||||
import org.thoughtcrime.securesms.database.GroupTable;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.groups.GroupId;
|
||||
import org.thoughtcrime.securesms.jobs.ConversationShortcutUpdateJob;
|
||||
@@ -241,7 +241,7 @@ public final class ConversationUtil {
|
||||
*/
|
||||
@WorkerThread
|
||||
private static @NonNull Person[] buildPersonsForGroup(@NonNull Context context, @NonNull GroupId groupId) {
|
||||
List<Recipient> members = SignalDatabase.groups().getGroupMembers(groupId, GroupDatabase.MemberSet.FULL_MEMBERS_EXCLUDING_SELF);
|
||||
List<Recipient> members = SignalDatabase.groups().getGroupMembers(groupId, GroupTable.MemberSet.FULL_MEMBERS_EXCLUDING_SELF);
|
||||
|
||||
return Stream.of(members).map(member -> buildPersonWithoutIcon(context, member.resolve())).toArray(Person[]::new);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package org.thoughtcrime.securesms.util;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.database.MessageDatabase;
|
||||
import org.thoughtcrime.securesms.database.model.MessageId;
|
||||
import org.thoughtcrime.securesms.database.model.ServiceMessageId;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceContent;
|
||||
@@ -12,7 +10,6 @@ import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.signal.core.util.logging.Log;
|
||||
import org.signal.libsignal.zkgroup.InvalidInputException;
|
||||
import org.signal.libsignal.zkgroup.groups.GroupMasterKey;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.database.GroupDatabase;
|
||||
import org.thoughtcrime.securesms.database.GroupTable;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.groups.GroupId;
|
||||
import org.thoughtcrime.securesms.mms.MessageGroupContext;
|
||||
@@ -93,9 +93,9 @@ public final class GroupUtil {
|
||||
@NonNull GroupId.Push groupId)
|
||||
{
|
||||
if (groupId.isV2()) {
|
||||
GroupDatabase groupDatabase = SignalDatabase.groups();
|
||||
GroupDatabase.GroupRecord groupRecord = groupDatabase.requireGroup(groupId);
|
||||
GroupDatabase.V2GroupProperties v2GroupProperties = groupRecord.requireV2GroupProperties();
|
||||
GroupTable groupDatabase = SignalDatabase.groups();
|
||||
GroupTable.GroupRecord groupRecord = groupDatabase.requireGroup(groupId);
|
||||
GroupTable.V2GroupProperties v2GroupProperties = groupRecord.requireV2GroupProperties();
|
||||
SignalServiceGroupV2 group = SignalServiceGroupV2.newBuilder(v2GroupProperties.getGroupMasterKey())
|
||||
.withRevision(v2GroupProperties.getGroupRevision())
|
||||
.build();
|
||||
|
||||
@@ -15,10 +15,10 @@ import org.signal.libsignal.protocol.state.SessionStore;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.crypto.ReentrantSessionLock;
|
||||
import org.thoughtcrime.securesms.crypto.storage.SignalIdentityKeyStore;
|
||||
import org.thoughtcrime.securesms.database.GroupDatabase;
|
||||
import org.thoughtcrime.securesms.database.IdentityDatabase;
|
||||
import org.thoughtcrime.securesms.database.MessageDatabase;
|
||||
import org.thoughtcrime.securesms.database.MessageDatabase.InsertResult;
|
||||
import org.thoughtcrime.securesms.database.GroupTable;
|
||||
import org.thoughtcrime.securesms.database.IdentityTable;
|
||||
import org.thoughtcrime.securesms.database.MessageTable;
|
||||
import org.thoughtcrime.securesms.database.MessageTable.InsertResult;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.database.model.IdentityRecord;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
@@ -62,13 +62,13 @@ public final class IdentityUtil {
|
||||
|
||||
public static void markIdentityVerified(Context context, Recipient recipient, boolean verified, boolean remote)
|
||||
{
|
||||
long time = System.currentTimeMillis();
|
||||
MessageDatabase smsDatabase = SignalDatabase.sms();
|
||||
GroupDatabase groupDatabase = SignalDatabase.groups();
|
||||
long time = System.currentTimeMillis();
|
||||
MessageTable smsDatabase = SignalDatabase.sms();
|
||||
GroupTable groupDatabase = SignalDatabase.groups();
|
||||
|
||||
try (GroupDatabase.Reader reader = groupDatabase.getGroups()) {
|
||||
try (GroupTable.Reader reader = groupDatabase.getGroups()) {
|
||||
|
||||
GroupDatabase.GroupRecord groupRecord;
|
||||
GroupTable.GroupRecord groupRecord;
|
||||
|
||||
while ((groupRecord = reader.getNext()) != null) {
|
||||
if (groupRecord.getMembers().contains(recipient.getId()) && groupRecord.isActive() && !groupRecord.isMms()) {
|
||||
@@ -121,12 +121,12 @@ public final class IdentityUtil {
|
||||
public static void markIdentityUpdate(@NonNull Context context, @NonNull RecipientId recipientId) {
|
||||
Log.w(TAG, "Inserting safety number change event(s) for " + recipientId, new Throwable());
|
||||
|
||||
long time = System.currentTimeMillis();
|
||||
MessageDatabase smsDatabase = SignalDatabase.sms();
|
||||
GroupDatabase groupDatabase = SignalDatabase.groups();
|
||||
long time = System.currentTimeMillis();
|
||||
MessageTable smsDatabase = SignalDatabase.sms();
|
||||
GroupTable groupDatabase = SignalDatabase.groups();
|
||||
|
||||
try (GroupDatabase.Reader reader = groupDatabase.getGroups()) {
|
||||
GroupDatabase.GroupRecord groupRecord;
|
||||
try (GroupTable.Reader reader = groupDatabase.getGroups()) {
|
||||
GroupTable.GroupRecord groupRecord;
|
||||
|
||||
while ((groupRecord = reader.getNext()) != null) {
|
||||
if (groupRecord.getMembers().contains(recipientId) && groupRecord.isActive()) {
|
||||
@@ -183,21 +183,21 @@ public final class IdentityUtil {
|
||||
if (verifiedMessage.getVerified() == VerifiedMessage.VerifiedState.DEFAULT &&
|
||||
identityRecord.isPresent() &&
|
||||
identityRecord.get().getIdentityKey().equals(verifiedMessage.getIdentityKey()) &&
|
||||
identityRecord.get().getVerifiedStatus() != IdentityDatabase.VerifiedStatus.DEFAULT)
|
||||
identityRecord.get().getVerifiedStatus() != IdentityTable.VerifiedStatus.DEFAULT)
|
||||
{
|
||||
Log.i(TAG, "Setting " + recipient.getId() + " verified status to " + IdentityDatabase.VerifiedStatus.DEFAULT);
|
||||
identityStore.setVerified(recipient.getId(), identityRecord.get().getIdentityKey(), IdentityDatabase.VerifiedStatus.DEFAULT);
|
||||
Log.i(TAG, "Setting " + recipient.getId() + " verified status to " + IdentityTable.VerifiedStatus.DEFAULT);
|
||||
identityStore.setVerified(recipient.getId(), identityRecord.get().getIdentityKey(), IdentityTable.VerifiedStatus.DEFAULT);
|
||||
markIdentityVerified(context, recipient, false, true);
|
||||
}
|
||||
|
||||
if (verifiedMessage.getVerified() == VerifiedMessage.VerifiedState.VERIFIED &&
|
||||
(!identityRecord.isPresent() ||
|
||||
(identityRecord.isPresent() && !identityRecord.get().getIdentityKey().equals(verifiedMessage.getIdentityKey())) ||
|
||||
(identityRecord.isPresent() && identityRecord.get().getVerifiedStatus() != IdentityDatabase.VerifiedStatus.VERIFIED)))
|
||||
(identityRecord.isPresent() && identityRecord.get().getVerifiedStatus() != IdentityTable.VerifiedStatus.VERIFIED)))
|
||||
{
|
||||
Log.i(TAG, "Setting " + recipient.getId() + " verified status to " + IdentityDatabase.VerifiedStatus.VERIFIED);
|
||||
Log.i(TAG, "Setting " + recipient.getId() + " verified status to " + IdentityTable.VerifiedStatus.VERIFIED);
|
||||
saveIdentity(verifiedMessage.getDestination().getIdentifier(), verifiedMessage.getIdentityKey());
|
||||
identityStore.setVerified(recipient.getId(), verifiedMessage.getIdentityKey(), IdentityDatabase.VerifiedStatus.VERIFIED);
|
||||
identityStore.setVerified(recipient.getId(), verifiedMessage.getIdentityKey(), IdentityTable.VerifiedStatus.VERIFIED);
|
||||
markIdentityVerified(context, recipient, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.signal.libsignal.zkgroup.profiles.ProfileKey;
|
||||
import org.thoughtcrime.securesms.badges.models.Badge;
|
||||
import org.thoughtcrime.securesms.crypto.ProfileKeyUtil;
|
||||
import org.thoughtcrime.securesms.crypto.UnidentifiedAccessUtil;
|
||||
import org.thoughtcrime.securesms.database.RecipientDatabase;
|
||||
import org.thoughtcrime.securesms.database.RecipientTable;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.jobmanager.Job;
|
||||
@@ -378,7 +378,7 @@ public final class ProfileUtil {
|
||||
}
|
||||
|
||||
private static @NonNull SignalServiceAddress toSignalServiceAddress(@NonNull Context context, @NonNull Recipient recipient) throws IOException {
|
||||
if (recipient.getRegistered() == RecipientDatabase.RegisteredState.NOT_REGISTERED) {
|
||||
if (recipient.getRegistered() == RecipientTable.RegisteredState.NOT_REGISTERED) {
|
||||
if (recipient.hasServiceId()) {
|
||||
return new SignalServiceAddress(recipient.requireServiceId(), recipient.getE164().orElse(null));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user