From c9e2162afc43816b4f7341617fec3e0750d889b8 Mon Sep 17 00:00:00 2001 From: Alex Hart Date: Thu, 25 Jan 2024 15:55:39 -0400 Subject: [PATCH] Remove old username education fragment. --- .../profiles/manage/EditProfileActivity.java | 10 +- .../profiles/manage/EditProfileFragment.kt | 26 ++- .../manage/UsernameEducationFragment.kt | 38 ---- .../NewWaysToConnectDialogFragment.kt | 1 + app/src/main/res/drawable/link_color_48.xml | 94 ---------- app/src/main/res/drawable/lock_color_48.xml | 26 --- app/src/main/res/drawable/number_color_48.xml | 14 -- .../layout/username_education_fragment.xml | 172 ------------------ app/src/main/res/navigation/edit_profile.xml | 19 -- app/src/main/res/values/strings.xml | 12 -- 10 files changed, 14 insertions(+), 398 deletions(-) delete mode 100644 app/src/main/java/org/thoughtcrime/securesms/profiles/manage/UsernameEducationFragment.kt delete mode 100644 app/src/main/res/drawable/link_color_48.xml delete mode 100644 app/src/main/res/drawable/lock_color_48.xml delete mode 100644 app/src/main/res/drawable/number_color_48.xml delete mode 100644 app/src/main/res/layout/username_education_fragment.xml diff --git a/app/src/main/java/org/thoughtcrime/securesms/profiles/manage/EditProfileActivity.java b/app/src/main/java/org/thoughtcrime/securesms/profiles/manage/EditProfileActivity.java index 9eb3ef2bd4..59a3da55b1 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/profiles/manage/EditProfileActivity.java +++ b/app/src/main/java/org/thoughtcrime/securesms/profiles/manage/EditProfileActivity.java @@ -13,7 +13,6 @@ import androidx.navigation.fragment.NavHostFragment; import org.thoughtcrime.securesms.PassphraseRequiredActivity; import org.thoughtcrime.securesms.R; -import org.thoughtcrime.securesms.keyvalue.SignalStore; import org.thoughtcrime.securesms.reactions.any.ReactWithAnyEmojiBottomSheetDialogFragment; import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme; import org.thoughtcrime.securesms.util.DynamicTheme; @@ -64,13 +63,8 @@ public class EditProfileActivity extends PassphraseRequiredActivity implements R navController.setGraph(graph, extras != null ? extras : new Bundle()); if (extras != null && extras.getBoolean(START_AT_USERNAME, false)) { - if (SignalStore.uiHints().hasSeenUsernameEducation()) { - NavDirections action = EditProfileFragmentDirections.actionManageUsername(); - SafeNavigation.safeNavigate(navController, action); - } else { - NavDirections action = EditProfileFragmentDirections.actionManageProfileFragmentToUsernameEducationFragment(); - SafeNavigation.safeNavigate(navController, action); - } + NavDirections action = EditProfileFragmentDirections.actionManageUsername(); + SafeNavigation.safeNavigate(navController, action); } if (extras != null && extras.getBoolean(START_AT_AVATAR, false)) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/profiles/manage/EditProfileFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/profiles/manage/EditProfileFragment.kt index 4ad391ec88..0d376f9b15 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/profiles/manage/EditProfileFragment.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/profiles/manage/EditProfileFragment.kt @@ -42,7 +42,6 @@ import org.thoughtcrime.securesms.util.NameUtil.getAbbreviation import org.thoughtcrime.securesms.util.livedata.LiveDataUtil import org.thoughtcrime.securesms.util.navigation.safeNavigate import org.thoughtcrime.securesms.util.views.SimpleProgressDialog -import org.thoughtcrime.securesms.util.visible import java.util.Arrays import java.util.Optional @@ -81,22 +80,18 @@ class EditProfileFragment : LoggingFragment() { binding.manageProfileNameContainer.setOnClickListener { v: View -> findNavController(v).safeNavigate(EditProfileFragmentDirections.actionManageProfileName()) } binding.manageProfileUsernameContainer.setOnClickListener { v: View -> - if (SignalStore.uiHints().hasSeenUsernameEducation() || SignalStore.account().username != null) { - if (SignalStore.account().username != null) { - MaterialAlertDialogBuilder(requireContext(), R.style.ThemeOverlay_Signal_MaterialAlertDialog_List) - .setItems(R.array.username_edit_entries) { _: DialogInterface?, w: Int -> - when (w) { - 0 -> findNavController(v).safeNavigate(EditProfileFragmentDirections.actionManageUsername()) - 1 -> displayConfirmUsernameDeletionDialog() - else -> throw IllegalStateException() - } + if (SignalStore.account().username != null) { + MaterialAlertDialogBuilder(requireContext(), R.style.ThemeOverlay_Signal_MaterialAlertDialog_List) + .setItems(R.array.username_edit_entries) { _: DialogInterface?, w: Int -> + when (w) { + 0 -> findNavController(v).safeNavigate(EditProfileFragmentDirections.actionManageUsername()) + 1 -> displayConfirmUsernameDeletionDialog() + else -> throw IllegalStateException() } - .show() - } else { - findNavController(v).safeNavigate(EditProfileFragmentDirections.actionManageUsername()) - } + } + .show() } else { - findNavController(v).safeNavigate(EditProfileFragmentDirections.actionManageProfileFragmentToUsernameEducationFragment()) + findNavController(v).safeNavigate(EditProfileFragmentDirections.actionManageUsername()) } } @@ -322,6 +317,7 @@ class EditProfileFragment : LoggingFragment() { Snackbar.make(requireView(), R.string.ManageProfileFragment__username_deleted, Snackbar.LENGTH_SHORT).show() binding.usernameLinkContainer.visibility = View.GONE } + UsernameDeleteResult.NETWORK_ERROR -> Snackbar.make(requireView(), R.string.ManageProfileFragment__couldnt_delete_username, Snackbar.LENGTH_SHORT).show() } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/profiles/manage/UsernameEducationFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/profiles/manage/UsernameEducationFragment.kt deleted file mode 100644 index 8b784f91ea..0000000000 --- a/app/src/main/java/org/thoughtcrime/securesms/profiles/manage/UsernameEducationFragment.kt +++ /dev/null @@ -1,38 +0,0 @@ -package org.thoughtcrime.securesms.profiles.manage - -import android.os.Bundle -import android.view.View -import androidx.fragment.app.Fragment -import androidx.navigation.fragment.findNavController -import org.thoughtcrime.securesms.R -import org.thoughtcrime.securesms.components.ViewBinderDelegate -import org.thoughtcrime.securesms.databinding.UsernameEducationFragmentBinding -import org.thoughtcrime.securesms.dependencies.ApplicationDependencies -import org.thoughtcrime.securesms.keyvalue.SignalStore -import org.thoughtcrime.securesms.megaphone.Megaphones -import org.thoughtcrime.securesms.util.CommunicationActions -import org.thoughtcrime.securesms.util.navigation.safeNavigate - -/** - * Displays a Username education screen which displays some basic information - * about usernames and provides a learn-more link. - */ -class UsernameEducationFragment : Fragment(R.layout.username_education_fragment) { - private val binding by ViewBinderDelegate(UsernameEducationFragmentBinding::bind) - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - binding.toolbar.setNavigationOnClickListener { - findNavController().popBackStack() - } - - binding.usernameEducationLearnMore.setOnClickListener { - CommunicationActions.openBrowserLink(requireContext(), getString(R.string.username_support_url)) - } - - binding.continueButton.setOnClickListener { - SignalStore.uiHints().markHasSeenUsernameEducation() - ApplicationDependencies.getMegaphoneRepository().markFinished(Megaphones.Event.SET_UP_YOUR_USERNAME) - findNavController().safeNavigate(UsernameEducationFragmentDirections.actionUsernameEducationFragmentToUsernameManageFragment()) - } - } -} diff --git a/app/src/main/java/org/thoughtcrime/securesms/profiles/username/NewWaysToConnectDialogFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/profiles/username/NewWaysToConnectDialogFragment.kt index ee5ed6c157..5dd3c2ff6d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/profiles/username/NewWaysToConnectDialogFragment.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/profiles/username/NewWaysToConnectDialogFragment.kt @@ -5,6 +5,7 @@ package org.thoughtcrime.securesms.profiles.username +import android.content.res.Configuration import android.os.Bundle import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Column diff --git a/app/src/main/res/drawable/link_color_48.xml b/app/src/main/res/drawable/link_color_48.xml deleted file mode 100644 index 0d36036d7d..0000000000 --- a/app/src/main/res/drawable/link_color_48.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/lock_color_48.xml b/app/src/main/res/drawable/lock_color_48.xml deleted file mode 100644 index 0dd82a324d..0000000000 --- a/app/src/main/res/drawable/lock_color_48.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/drawable/number_color_48.xml b/app/src/main/res/drawable/number_color_48.xml deleted file mode 100644 index 9ee7d9c842..0000000000 --- a/app/src/main/res/drawable/number_color_48.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - diff --git a/app/src/main/res/layout/username_education_fragment.xml b/app/src/main/res/layout/username_education_fragment.xml deleted file mode 100644 index 1f368ea047..0000000000 --- a/app/src/main/res/layout/username_education_fragment.xml +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/navigation/edit_profile.xml b/app/src/main/res/navigation/edit_profile.xml index 27583b916a..741b55c3b3 100644 --- a/app/src/main/res/navigation/edit_profile.xml +++ b/app/src/main/res/navigation/edit_profile.xml @@ -67,14 +67,6 @@ android:id="@+id/action_manageProfileFragment_to_shareUsernameDialog" app:destination="@id/shareUsernameDialog" /> - - - - - - Clear formatting - - - Continue - - Set up your Signal username - - Usernames are paired with a set of digits and aren\'t shared on your profile - - Each username has a unique QR code and link you can share with friends to start a chat with you - - Turn off phone number discovery under Settings > Privacy > Phone number > Who can find my number, to use your username as the primary way others can contact you - Edit username