Messaging: Allow deletion of messages without a sim inserted

* Currently there is a check in place checking for the presence of a
  preferred sim card
* For deletion of a conversation and message this is unnecessary and
  deleting a conversation from the main view does also not have that check
  already, so replace the check with just checking for being the default
  messaging app

Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/5974
Test: Try deleting a single message or conversation from within
 conversation before and after
Change-Id: Icd47882eb29e16a17ad57a79ea5e0c0f7855ffc6
This commit is contained in:
Michael W
2024-06-16 13:44:19 +02:00
committed by Michael Bestas
parent 37b7f1a539
commit b11039ed8c
2 changed files with 19 additions and 3 deletions

View File

@@ -819,7 +819,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
return true;
case R.id.action_delete:
if (isReadyForAction()) {
if (isReadyForDeleteAction()) {
new AlertDialog.Builder(getActivity())
.setTitle(getResources().getQuantityString(
R.plurals.delete_conversations_confirmation_dialog_title, 1))
@@ -1073,6 +1073,10 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
return UiUtils.isReadyForAction();
}
public boolean isReadyForDeleteAction() {
return UiUtils.isReadyForDeleteAction();
}
/**
* When there's some condition that prevents an operation, such as sending a message,
* call warnOfMissingActionConditions to put up a snackbar and allow the user to repair
@@ -1142,7 +1146,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
}
void deleteMessage(final String messageId) {
if (isReadyForAction()) {
if (isReadyForDeleteAction()) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
.setTitle(R.string.delete_message_confirmation_dialog_title)
.setMessage(R.string.delete_message_confirmation_dialog_text)
@@ -1178,7 +1182,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
}
public void deleteConversation() {
if (isReadyForAction()) {
if (isReadyForDeleteAction()) {
final Context context = getActivity();
mBinding.getData().deleteConversation(mBinding);
closeConversation(mConversationId);