Remove TextSecurePreferences.getProfileName()

This commit is contained in:
Greyson Parrelli
2020-03-25 17:58:33 -04:00
parent a860315587
commit 6aac3baa55
16 changed files with 61 additions and 42 deletions

View File

@@ -23,6 +23,7 @@ import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.messagerequests.MessageRequestMegaphoneActivity;
import org.thoughtcrime.securesms.profiles.ProfileName;
import org.thoughtcrime.securesms.profiles.edit.EditProfileActivity;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.util.AvatarUtil;
import org.thoughtcrime.securesms.util.FeatureFlags;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
@@ -202,7 +203,7 @@ public final class Megaphones {
}
private static @NonNull Megaphone buildProfileNamesMegaphone(@NonNull Context context) {
short requestCode = TextSecurePreferences.getProfileName(context) != ProfileName.EMPTY
short requestCode = Recipient.self().getProfileName() != ProfileName.EMPTY
? ConversationListFragment.PROFILE_NAMES_REQUEST_CODE_CONFIRM_NAME
: ConversationListFragment.PROFILE_NAMES_REQUEST_CODE_CREATE_NAME;
@@ -210,7 +211,7 @@ public final class Megaphones {
.enableSnooze(null)
.setImageRequest(AvatarUtil.getSelfAvatarOrFallbackIcon(context, R.drawable.ic_profilename_64));
if (TextSecurePreferences.getProfileName(ApplicationDependencies.getApplication()) == ProfileName.EMPTY) {
if (Recipient.self().getProfileName() == ProfileName.EMPTY) {
return builder.setTitle(R.string.ProfileNamesMegaphone__add_a_profile_name)
.setBody(R.string.ProfileNamesMegaphone__this_will_be_displayed_when_you_start)
.setActionButton(R.string.ProfileNamesMegaphone__add_profile_name, (megaphone, listener) -> {
@@ -241,7 +242,7 @@ public final class Megaphones {
}
private static boolean shouldShowMessageRequestsMegaphone() {
boolean userHasAProfileName = TextSecurePreferences.getProfileName(ApplicationDependencies.getApplication()) != ProfileName.EMPTY;
boolean userHasAProfileName = Recipient.self().getProfileName() != ProfileName.EMPTY;
return FeatureFlags.messageRequests() && !userHasAProfileName;
}