mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-27 12:15:50 +01:00
Set contact colors more aggressively.
This commit is contained in:
@@ -37,6 +37,7 @@ import org.thoughtcrime.securesms.phonenumbers.PhoneNumberFormatter;
|
||||
import org.thoughtcrime.securesms.profiles.ProfileName;
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.concurrent.SignalExecutors;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Preconditions;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
@@ -447,10 +448,13 @@ public class Recipient {
|
||||
return MaterialColor.GROUP;
|
||||
} else if (color != null) {
|
||||
return color;
|
||||
} else if (name != null) {
|
||||
Log.i(TAG, "Saving color for " + id);
|
||||
MaterialColor color = ContactColors.generateFor(name);
|
||||
DatabaseFactory.getRecipientDatabase(ApplicationDependencies.getApplication()).setColor(id, color);
|
||||
} else if (name != null || profileSharing) {
|
||||
Log.w(TAG, "Had no color for " + id + "! Saving a new one.");
|
||||
|
||||
Context context = ApplicationDependencies.getApplication();
|
||||
MaterialColor color = ContactColors.generateFor(getDisplayName(context));
|
||||
|
||||
SignalExecutors.BOUNDED.execute(() -> DatabaseFactory.getRecipientDatabase(context).setColorIfNotSet(id, color));
|
||||
return color;
|
||||
} else {
|
||||
return ContactColors.UNKNOWN_COLOR;
|
||||
|
||||
Reference in New Issue
Block a user