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:
@@ -819,7 +819,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.action_delete:
|
case R.id.action_delete:
|
||||||
if (isReadyForAction()) {
|
if (isReadyForDeleteAction()) {
|
||||||
new AlertDialog.Builder(getActivity())
|
new AlertDialog.Builder(getActivity())
|
||||||
.setTitle(getResources().getQuantityString(
|
.setTitle(getResources().getQuantityString(
|
||||||
R.plurals.delete_conversations_confirmation_dialog_title, 1))
|
R.plurals.delete_conversations_confirmation_dialog_title, 1))
|
||||||
@@ -1073,6 +1073,10 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
|
|||||||
return UiUtils.isReadyForAction();
|
return UiUtils.isReadyForAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isReadyForDeleteAction() {
|
||||||
|
return UiUtils.isReadyForDeleteAction();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When there's some condition that prevents an operation, such as sending a message,
|
* 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
|
* 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) {
|
void deleteMessage(final String messageId) {
|
||||||
if (isReadyForAction()) {
|
if (isReadyForDeleteAction()) {
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
|
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
|
||||||
.setTitle(R.string.delete_message_confirmation_dialog_title)
|
.setTitle(R.string.delete_message_confirmation_dialog_title)
|
||||||
.setMessage(R.string.delete_message_confirmation_dialog_text)
|
.setMessage(R.string.delete_message_confirmation_dialog_text)
|
||||||
@@ -1178,7 +1182,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void deleteConversation() {
|
public void deleteConversation() {
|
||||||
if (isReadyForAction()) {
|
if (isReadyForDeleteAction()) {
|
||||||
final Context context = getActivity();
|
final Context context = getActivity();
|
||||||
mBinding.getData().deleteConversation(mBinding);
|
mBinding.getData().deleteConversation(mBinding);
|
||||||
closeConversation(mConversationId);
|
closeConversation(mConversationId);
|
||||||
|
|||||||
@@ -349,6 +349,18 @@ public class UiUtils {
|
|||||||
phoneUtils.isDefaultSmsApp();
|
phoneUtils.isDefaultSmsApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to check if a message or conversation can be deleted - it needs to be the default
|
||||||
|
* sms app
|
||||||
|
* @return true if all conditions are nominal and we're ready to delete a message
|
||||||
|
*/
|
||||||
|
public static boolean isReadyForDeleteAction() {
|
||||||
|
final PhoneUtils phoneUtils = PhoneUtils.getDefault();
|
||||||
|
|
||||||
|
// Is the default sms app?
|
||||||
|
return phoneUtils.isDefaultSmsApp();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Removes all html markup from the text and replaces links with the the text and a text version
|
* Removes all html markup from the text and replaces links with the the text and a text version
|
||||||
* of the href.
|
* of the href.
|
||||||
|
|||||||
Reference in New Issue
Block a user