fix crash & empty nickname bug

This commit is contained in:
Ryan ZHAO 2021-04-30 15:36:50 +10:00
parent a1edfb13ee
commit e64ac14b77
3 changed files with 5 additions and 2 deletions

View File

@ -417,7 +417,9 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
});
String nickname = DatabaseFactory.getStorage(this).getDisplayName(getRecipient().getAddress().serialize());
titleTextView.setText(nickname);
if (nickname != null) {
titleTextView.setSelection(nickname.length());
}
imm.showSoftInput(v, 0);
cancelButtonContainer.setVisibility(View.VISIBLE);
}

View File

@ -21,6 +21,7 @@ class ProfileManager: SSKEnvironment.ProfileManagerProtocol {
override fun setProfileName(context: Context, recipient: Recipient, profileName: String) {
val database = DatabaseFactory.getRecipientDatabase(context)
database.setProfileName(recipient, profileName)
recipient.notifyListeners()
}
override fun setProfilePictureURL(context: Context, recipient: Recipient, profilePictureURL: String) {

View File

@ -288,7 +288,7 @@ public class Recipient implements RecipientModifiedListener {
public synchronized @Nullable String getName() {
String displayName = MessagingModuleConfiguration.shared.getStorage().getDisplayName(this.address.toString());
if (displayName != null) { return displayName; }
if (displayName != null && !displayName.isEmpty()) { return displayName; }
if (this.name == null && isMmsGroupRecipient()) {
List<String> names = new LinkedList<>();