mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-03-01 14:16:49 +00:00
Remove old username education fragment.
This commit is contained in:
committed by
Nicholas Tinsley
parent
9a52f4e3ff
commit
c9e2162afc
@@ -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)) {
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user