mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Use raw values for learned profile name event.
This commit is contained in:
@@ -1118,12 +1118,17 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
|
||||
}
|
||||
}
|
||||
|
||||
fun insertLearnedProfileNameChangeMessage(recipient: Recipient, previousDisplayName: String) {
|
||||
fun insertLearnedProfileNameChangeMessage(recipient: Recipient, e164: String?, username: String?) {
|
||||
if ((e164 == null && username == null) || (e164 != null && username != null)) {
|
||||
Log.w(TAG, "Learn profile event expects an e164 or username")
|
||||
return
|
||||
}
|
||||
|
||||
val threadId: Long? = SignalDatabase.threads.getThreadIdFor(recipient.id)
|
||||
|
||||
if (threadId != null) {
|
||||
val extras = MessageExtras(
|
||||
profileChangeDetails = ProfileChangeDetails(learnedProfileName = ProfileChangeDetails.StringChange(previous = previousDisplayName))
|
||||
profileChangeDetails = ProfileChangeDetails(learnedProfileName = ProfileChangeDetails.LearnedProfileName(e164 = e164, username = username))
|
||||
)
|
||||
|
||||
writableDatabase
|
||||
|
||||
@@ -32,6 +32,7 @@ import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.Base64;
|
||||
import org.signal.core.util.StringUtil;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.signal.storageservice.protos.groups.local.DecryptedGroup;
|
||||
@@ -57,7 +58,6 @@ import org.thoughtcrime.securesms.phonenumbers.PhoneNumberFormatter;
|
||||
import org.thoughtcrime.securesms.profiles.ProfileName;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
import org.signal.core.util.Base64;
|
||||
import org.thoughtcrime.securesms.util.DateUtils;
|
||||
import org.thoughtcrime.securesms.util.ExpirationUtil;
|
||||
import org.thoughtcrime.securesms.util.GroupUtil;
|
||||
@@ -461,8 +461,19 @@ public abstract class MessageRecord extends DisplayRecord {
|
||||
}
|
||||
|
||||
return staticUpdateDescription(updateMessage, R.drawable.ic_update_profile_16);
|
||||
} else if (profileChangeDetails.deprecatedLearnedProfileName != null) {
|
||||
return staticUpdateDescription(context.getString(R.string.MessageRecord_started_this_chat, profileChangeDetails.deprecatedLearnedProfileName.previous), R.drawable.symbol_thread_16);
|
||||
} else if (profileChangeDetails.learnedProfileName != null) {
|
||||
return staticUpdateDescription(context.getString(R.string.MessageRecord_started_this_chat, profileChangeDetails.learnedProfileName.previous), R.drawable.symbol_thread_16);
|
||||
String previouslyKnownAs;
|
||||
if (!Util.isEmpty(profileChangeDetails.learnedProfileName.e164)) {
|
||||
previouslyKnownAs = PhoneNumberFormatter.prettyPrint(profileChangeDetails.learnedProfileName.e164);
|
||||
} else {
|
||||
previouslyKnownAs = profileChangeDetails.learnedProfileName.username;
|
||||
}
|
||||
|
||||
if (!Util.isEmpty(previouslyKnownAs)) {
|
||||
return staticUpdateDescription(context.getString(R.string.MessageRecord_started_this_chat, previouslyKnownAs), R.drawable.symbol_thread_16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user