From 79927be0c0f66bd0080d334ff4086ce1e75c9af4 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Wed, 5 Jun 2019 16:20:11 +1000 Subject: [PATCH] Fix name updating --- .../securesms/CreateProfileActivity.java | 31 ++++++++++++------- .../conversation/ConversationActivity.java | 1 - 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/org/thoughtcrime/securesms/CreateProfileActivity.java b/src/org/thoughtcrime/securesms/CreateProfileActivity.java index bdd8f56f5f..24f292b326 100644 --- a/src/org/thoughtcrime/securesms/CreateProfileActivity.java +++ b/src/org/thoughtcrime/securesms/CreateProfileActivity.java @@ -17,10 +17,6 @@ import android.support.annotation.RequiresApi; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; - -import org.thoughtcrime.securesms.avatar.AvatarSelection; -import org.thoughtcrime.securesms.components.LabeledEditText; -import org.thoughtcrime.securesms.logging.Log; import android.view.KeyEvent; import android.view.View; import android.view.ViewAnimationUtils; @@ -32,7 +28,9 @@ import android.widget.Toast; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.dd.CircularProgressButton; +import org.thoughtcrime.securesms.avatar.AvatarSelection; import org.thoughtcrime.securesms.components.InputAwareLayout; +import org.thoughtcrime.securesms.components.LabeledEditText; import org.thoughtcrime.securesms.components.emoji.EmojiDrawer; import org.thoughtcrime.securesms.components.emoji.EmojiToggle; import org.thoughtcrime.securesms.contacts.avatars.ResourceContactPhoto; @@ -40,6 +38,7 @@ import org.thoughtcrime.securesms.crypto.ProfileKeyUtil; import org.thoughtcrime.securesms.database.Address; import org.thoughtcrime.securesms.dependencies.InjectableType; import org.thoughtcrime.securesms.jobs.MultiDeviceProfileKeyUpdateJob; +import org.thoughtcrime.securesms.logging.Log; import org.thoughtcrime.securesms.mms.GlideApp; import org.thoughtcrime.securesms.permissions.Permissions; import org.thoughtcrime.securesms.profiles.AvatarHelper; @@ -364,16 +363,24 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje Context context = CreateProfileActivity.this; byte[] profileKey = ProfileKeyUtil.getProfileKey(CreateProfileActivity.this); - try { - accountManager.setProfileName(profileKey, name); - TextSecurePreferences.setProfileName(context, name); - } catch (IOException e) { - Log.w(TAG, e); - return false; - } + TextSecurePreferences.setProfileName(context, name); + + // Loki - Original code + // ======== +// try { +// accountManager.setProfileName(profileKey, name); +// TextSecurePreferences.setProfileName(context, name); +// } catch (IOException e) { +// Log.w(TAG, e); +// return false; +// } + // ======== try { - accountManager.setProfileAvatar(profileKey, avatar); + // Loki - Original code + // ======== + // accountManager.setProfileAvatar(profileKey, avatar); + // ======== AvatarHelper.setAvatar(CreateProfileActivity.this, Address.fromSerialized(TextSecurePreferences.getLocalNumber(context)), avatarBytes); TextSecurePreferences.setProfileAvatarId(CreateProfileActivity.this, new SecureRandom().nextInt()); } catch (IOException e) { diff --git a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java index cbbe4c3ba8..050ba0753a 100644 --- a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java @@ -146,7 +146,6 @@ import org.thoughtcrime.securesms.giph.ui.GiphyActivity; import org.thoughtcrime.securesms.linkpreview.LinkPreview; import org.thoughtcrime.securesms.linkpreview.LinkPreviewRepository; import org.thoughtcrime.securesms.linkpreview.LinkPreviewViewModel; -import org.thoughtcrime.securesms.loki.LokiFriendRequestMessage; import org.thoughtcrime.securesms.mediasend.MediaSendActivity; import org.thoughtcrime.securesms.mediasend.Media; import org.thoughtcrime.securesms.jobs.MultiDeviceBlockedUpdateJob;