Rename RecipientPreferences -> RecipientSettings

// FREEBIE
This commit is contained in:
Moxie Marlinspike
2017-08-21 18:47:37 -07:00
parent 8e6ca53023
commit d1790dfe17
26 changed files with 156 additions and 156 deletions

View File

@@ -182,7 +182,7 @@ public class DatabaseFactory {
return getInstance(context).groupDatabase;
}
public static RecipientDatabase getRecipientPreferenceDatabase(Context context) {
public static RecipientDatabase getRecipientDatabase(Context context) {
return getInstance(context).recipientDatabase;
}

View File

@@ -112,7 +112,7 @@ public class RecipientDatabase extends Database {
}
public Optional<RecipientsPreferences> getRecipientsPreferences(@NonNull Address address) {
public Optional<RecipientSettings> getRecipientSettings(@NonNull Address address) {
SQLiteDatabase database = databaseHelper.getReadableDatabase();
Cursor cursor = null;
@@ -129,7 +129,7 @@ public class RecipientDatabase extends Database {
}
}
Optional<RecipientsPreferences> getRecipientPreferences(@NonNull Cursor cursor) {
Optional<RecipientSettings> getRecipientPreferences(@NonNull Cursor cursor) {
boolean blocked = cursor.getInt(cursor.getColumnIndexOrThrow(BLOCK)) == 1;
String notification = cursor.getString(cursor.getColumnIndexOrThrow(NOTIFICATION));
int vibrateState = cursor.getInt(cursor.getColumnIndexOrThrow(VIBRATE));
@@ -165,12 +165,12 @@ public class RecipientDatabase extends Database {
}
}
return Optional.of(new RecipientsPreferences(blocked, muteUntil,
VibrateState.fromId(vibrateState),
notificationUri, color, seenInviteReminder,
defaultSubscriptionId, expireMessages, registered,
profileKey, systemDisplayName, signalProfileName,
signalProfileAvatar, profileSharing));
return Optional.of(new RecipientSettings(blocked, muteUntil,
VibrateState.fromId(vibrateState),
notificationUri, color, seenInviteReminder,
defaultSubscriptionId, expireMessages, registered,
profileKey, systemDisplayName, signalProfileName,
signalProfileAvatar, profileSharing));
}
public BulkOperationsHandle resetAllDisplayNames() {
@@ -359,7 +359,7 @@ public class RecipientDatabase extends Database {
}
}
public static class RecipientsPreferences {
public static class RecipientSettings {
private final boolean blocked;
private final long muteUntil;
private final VibrateState vibrateState;
@@ -375,19 +375,19 @@ public class RecipientDatabase extends Database {
private final String signalProfileAvatar;
private final boolean profileSharing;
RecipientsPreferences(boolean blocked, long muteUntil,
@NonNull VibrateState vibrateState,
@Nullable Uri notification,
@Nullable MaterialColor color,
boolean seenInviteReminder,
int defaultSubscriptionId,
int expireMessages,
boolean registered,
@Nullable byte[] profileKey,
@Nullable String systemDisplayName,
@Nullable String signalProfileName,
@Nullable String signalProfileAvatar,
boolean profileSharing)
RecipientSettings(boolean blocked, long muteUntil,
@NonNull VibrateState vibrateState,
@Nullable Uri notification,
@Nullable MaterialColor color,
boolean seenInviteReminder,
int defaultSubscriptionId,
int expireMessages,
boolean registered,
@Nullable byte[] profileKey,
@Nullable String systemDisplayName,
@Nullable String signalProfileName,
@Nullable String signalProfileAvatar,
boolean profileSharing)
{
this.blocked = blocked;
this.muteUntil = muteUntil;

View File

@@ -559,7 +559,7 @@ public class SmsDatabase extends MessagingDatabase {
}
if (message.getSubscriptionId() != -1) {
DatabaseFactory.getRecipientPreferenceDatabase(context).setDefaultSubscriptionId(recipient, message.getSubscriptionId());
DatabaseFactory.getRecipientDatabase(context).setDefaultSubscriptionId(recipient, message.getSubscriptionId());
}
notifyConversationListeners(threadId);

View File

@@ -33,7 +33,7 @@ import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.crypto.MasterCipher;
import org.thoughtcrime.securesms.database.GroupDatabase.GroupRecord;
import org.thoughtcrime.securesms.database.MessagingDatabase.MarkedMessageInfo;
import org.thoughtcrime.securesms.database.RecipientDatabase.RecipientsPreferences;
import org.thoughtcrime.securesms.database.RecipientDatabase.RecipientSettings;
import org.thoughtcrime.securesms.database.model.DisplayRecord;
import org.thoughtcrime.securesms.database.model.MediaMmsMessageRecord;
import org.thoughtcrime.securesms.database.model.MessageRecord;
@@ -620,18 +620,18 @@ public class ThreadDatabase extends Database {
int distributionType = cursor.getInt(cursor.getColumnIndexOrThrow(ThreadDatabase.TYPE));
Address address = Address.fromSerialized(cursor.getString(cursor.getColumnIndexOrThrow(ThreadDatabase.ADDRESS)));
Optional<RecipientsPreferences> preferences;
Optional<GroupRecord> groupRecord;
Optional<RecipientSettings> settings;
Optional<GroupRecord> groupRecord;
if (distributionType != DistributionTypes.ARCHIVE) {
preferences = DatabaseFactory.getRecipientPreferenceDatabase(context).getRecipientPreferences(cursor);
settings = DatabaseFactory.getRecipientDatabase(context).getRecipientPreferences(cursor);
groupRecord = DatabaseFactory.getGroupDatabase(context).getGroup(cursor);
} else {
preferences = Optional.absent();
settings = Optional.absent();
groupRecord = Optional.absent();
}
Recipient recipient = Recipient.from(context, address, preferences, groupRecord, true);
Recipient recipient = Recipient.from(context, address, settings, groupRecord, true);
DisplayRecord.Body body = getPlaintextBody(cursor);
long date = cursor.getLong(cursor.getColumnIndexOrThrow(ThreadDatabase.DATE));
long count = cursor.getLong(cursor.getColumnIndexOrThrow(ThreadDatabase.MESSAGE_COUNT));

View File

@@ -14,7 +14,7 @@ public class BlockedContactsLoader extends AbstractCursorLoader {
@Override
public Cursor getCursor() {
return DatabaseFactory.getRecipientPreferenceDatabase(getContext())
return DatabaseFactory.getRecipientDatabase(getContext())
.getBlocked();
}