mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Merge branch '68-tweak-deletion-error-messages' into 'master'
Tweak the error dialog when message deletion fails See merge request briar/briar!1200
This commit is contained in:
@@ -130,6 +130,7 @@ import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
import static org.briarproject.bramble.util.LogUtils.now;
|
||||
import static org.briarproject.bramble.util.StringUtils.fromHexString;
|
||||
import static org.briarproject.bramble.util.StringUtils.isNullOrEmpty;
|
||||
import static org.briarproject.bramble.util.StringUtils.join;
|
||||
import static org.briarproject.briar.android.activity.RequestCodes.REQUEST_ATTACH_IMAGE;
|
||||
import static org.briarproject.briar.android.activity.RequestCodes.REQUEST_INTRODUCTION;
|
||||
import static org.briarproject.briar.android.conversation.ImageActivity.ATTACHMENTS;
|
||||
@@ -896,44 +897,42 @@ public class ConversationActivity extends BriarActivity
|
||||
}
|
||||
|
||||
private void showNotAllDeletedDialog(DeletionResult result) {
|
||||
StringBuilder msg = new StringBuilder();
|
||||
// get failures the user can not immediately prevent
|
||||
StringBuilder fails = new StringBuilder();
|
||||
if (result.hasIntroductionSessionInProgress()) {
|
||||
String s = getString(
|
||||
R.string.dialog_message_not_deleted_ongoing_introductions);
|
||||
fails.append(s).append("\n");
|
||||
}
|
||||
if (result.hasInvitationSessionInProgress()) {
|
||||
String s = getString(
|
||||
R.string.dialog_message_not_deleted_ongoing_invitations);
|
||||
fails.append(s).append("\n");
|
||||
List<String> fails = new ArrayList<>();
|
||||
// get failures the user cannot immediately resolve
|
||||
if (result.hasIntroductionSessionInProgress() &&
|
||||
result.hasInvitationSessionInProgress()) {
|
||||
fails.add(getString(
|
||||
R.string.dialog_message_not_deleted_ongoing_both));
|
||||
} else if (result.hasIntroductionSessionInProgress()) {
|
||||
fails.add(getString(
|
||||
R.string.dialog_message_not_deleted_ongoing_introductions));
|
||||
} else if (result.hasInvitationSessionInProgress()) {
|
||||
fails.add(getString(
|
||||
R.string.dialog_message_not_deleted_ongoing_invitations));
|
||||
}
|
||||
if (result.hasNotFullyDownloaded()) {
|
||||
String s = getString(
|
||||
R.string.dialog_message_not_deleted_partly_downloaded);
|
||||
fails.append(s).append("\n");
|
||||
}
|
||||
// add failures to message if there are any
|
||||
if (fails.length() > 0) {
|
||||
String s = getString(R.string.dialog_message_not_deleted,
|
||||
fails.toString());
|
||||
msg.append(s);
|
||||
fails.add(getString(
|
||||
R.string.dialog_message_not_deleted_partly_downloaded));
|
||||
}
|
||||
// add problems the user can resolve
|
||||
if (result.hasNotAllIntroductionSelected() ||
|
||||
if (result.hasNotAllIntroductionSelected() &&
|
||||
result.hasNotAllInvitationSelected()) {
|
||||
if (msg.length() > 0) msg.append("\n\n");
|
||||
String s = getString(
|
||||
R.string.dialog_message_not_deleted_not_all_selected);
|
||||
msg.append(s);
|
||||
fails.add(getString(
|
||||
R.string.dialog_message_not_deleted_not_all_selected_both));
|
||||
} else if (result.hasNotAllIntroductionSelected()) {
|
||||
fails.add(getString(
|
||||
R.string.dialog_message_not_deleted_not_all_selected_introductions));
|
||||
} else if (result.hasNotAllInvitationSelected()) {
|
||||
fails.add(getString(
|
||||
R.string.dialog_message_not_deleted_not_all_selected_invitations));
|
||||
}
|
||||
String msg = join(fails, "\n\n");
|
||||
// show dialog
|
||||
AlertDialog.Builder builder =
|
||||
new AlertDialog.Builder(this, R.style.BriarDialogTheme);
|
||||
builder.setTitle(
|
||||
getString(R.string.dialog_title_not_all_messages_deleted));
|
||||
builder.setMessage(msg.toString());
|
||||
builder.setMessage(msg);
|
||||
builder.setPositiveButton(R.string.ok, null);
|
||||
builder.show();
|
||||
}
|
||||
|
||||
@@ -139,11 +139,13 @@
|
||||
<string name="dialog_title_delete_all_messages">Confirm Message Deletion</string>
|
||||
<string name="dialog_message_delete_all_messages">Are you sure that you want to delete all messages?</string>
|
||||
<string name="dialog_title_not_all_messages_deleted">Could not delete all messages</string>
|
||||
<string name="dialog_message_not_deleted">Messages related to\n\n%s\ncan not be deleted until they conclude.</string>
|
||||
<string name="dialog_message_not_deleted_ongoing_introductions">• ongoing introductions</string>
|
||||
<string name="dialog_message_not_deleted_ongoing_invitations">• ongoing (blog/forum/group) invitations</string>
|
||||
<string name="dialog_message_not_deleted_partly_downloaded">• partly downloaded messages</string>
|
||||
<string name="dialog_message_not_deleted_not_all_selected">To delete an invitation/introduction, you need to select the request and the response.</string>
|
||||
<string name="dialog_message_not_deleted_ongoing_both">Messages related to ongoing invitations and introductions cannot be deleted until they conclude.</string>
|
||||
<string name="dialog_message_not_deleted_ongoing_introductions">Messages related to ongoing introductions cannot be deleted until they conclude.</string>
|
||||
<string name="dialog_message_not_deleted_ongoing_invitations">Messages related to ongoing invitations cannot be deleted until they conclude.</string>
|
||||
<string name="dialog_message_not_deleted_partly_downloaded">Partly downloaded messages cannot be deleted until they have finished downloading.</string>
|
||||
<string name="dialog_message_not_deleted_not_all_selected_both">To delete an invitation or introduction, you need to select the request and the response.</string>
|
||||
<string name="dialog_message_not_deleted_not_all_selected_introductions">To delete an introduction, you need to select the request and the response.</string>
|
||||
<string name="dialog_message_not_deleted_not_all_selected_invitations">To delete an invitation, you need to select the request and the response.</string>
|
||||
<string name="delete_contact">Delete contact</string>
|
||||
<string name="dialog_title_delete_contact">Confirm Contact Deletion</string>
|
||||
<string name="dialog_message_delete_contact">Are you sure that you want to remove this contact and all messages exchanged with this contact?</string>
|
||||
|
||||
Reference in New Issue
Block a user