use of org.thoughtcrime.securesms.database.model.databaseprotos.ProfileChangeDetails in project Signal-Android by WhisperSystems.
the class MessageRecord method getProfileChangeDescription.
@NonNull
private String getProfileChangeDescription(@NonNull Context context) {
try {
byte[] decoded = Base64.decode(getBody());
ProfileChangeDetails profileChangeDetails = ProfileChangeDetails.parseFrom(decoded);
if (profileChangeDetails.hasProfileNameChange()) {
String displayName = getIndividualRecipient().getDisplayName(context);
String newName = StringUtil.isolateBidi(ProfileName.fromSerialized(profileChangeDetails.getProfileNameChange().getNew()).toString());
String previousName = StringUtil.isolateBidi(ProfileName.fromSerialized(profileChangeDetails.getProfileNameChange().getPrevious()).toString());
if (getIndividualRecipient().isSystemContact()) {
return context.getString(R.string.MessageRecord_changed_their_profile_name_from_to, displayName, previousName, newName);
} else {
return context.getString(R.string.MessageRecord_changed_their_profile_name_to, previousName, newName);
}
}
} catch (IOException e) {
Log.w(TAG, "Profile name change details could not be read", e);
}
return context.getString(R.string.MessageRecord_changed_their_profile, getIndividualRecipient().getDisplayName(context));
}
use of org.thoughtcrime.securesms.database.model.databaseprotos.ProfileChangeDetails in project Signal-Android by signalapp.
the class MessageRecord method getProfileChangeDescription.
@NonNull
private String getProfileChangeDescription(@NonNull Context context) {
try {
byte[] decoded = Base64.decode(getBody());
ProfileChangeDetails profileChangeDetails = ProfileChangeDetails.parseFrom(decoded);
if (profileChangeDetails.hasProfileNameChange()) {
String displayName = getIndividualRecipient().getDisplayName(context);
String newName = StringUtil.isolateBidi(ProfileName.fromSerialized(profileChangeDetails.getProfileNameChange().getNew()).toString());
String previousName = StringUtil.isolateBidi(ProfileName.fromSerialized(profileChangeDetails.getProfileNameChange().getPrevious()).toString());
if (getIndividualRecipient().isSystemContact()) {
return context.getString(R.string.MessageRecord_changed_their_profile_name_from_to, displayName, previousName, newName);
} else {
return context.getString(R.string.MessageRecord_changed_their_profile_name_to, previousName, newName);
}
}
} catch (IOException e) {
Log.w(TAG, "Profile name change details could not be read", e);
}
return context.getString(R.string.MessageRecord_changed_their_profile, getIndividualRecipient().getDisplayName(context));
}
Aggregations