Improve error handling when creating backups, minor UI changes

This commit is contained in:
ameba23
2021-05-18 11:50:10 +02:00
parent 55e0ba8888
commit f601e2945b
6 changed files with 23 additions and 17 deletions

View File

@@ -296,11 +296,13 @@ class ConversationVisitor implements
@Override
public ConversationItem visitShardMessage(ShardMessageHeader r) {
if (r.isLocal()) {
String text = ctx.getString(R.string.social_backup_shard_sent);
String text = ctx.getString(R.string.social_backup_shard_sent,
contactName.getValue());
return new ConversationNoticeItem(
R.layout.list_item_conversation_notice_out, text, r);
} else {
String text = ctx.getString(R.string.social_backup_shard_received);
String text = ctx.getString(R.string.social_backup_shard_received,
contactName.getValue());
return new ConversationNoticeItem(
R.layout.list_item_conversation_notice_in, text, r);
}

View File

@@ -1,8 +0,0 @@
package org.briarproject.briar.android.socialbackup;
import androidx.annotation.UiThread;
public interface CustodianScanQrButtonListener {
@UiThread
void scanQrButtonClicked();
}

View File

@@ -80,7 +80,10 @@ public class DistributedBackupActivity extends BriarActivity implements
showNextFragment(fragment);
});
} catch (DbException e) {
e.printStackTrace();
Toast.makeText(this,
"There was an error when creating the backup",
Toast.LENGTH_LONG).show();
finish();
}
}

View File

@@ -54,10 +54,15 @@ public class ExistingBackupFragment extends BaseFragment {
container, false);
Bundle args = requireArguments();
ArrayList<String> custodianNames = args.getStringArrayList(CUSTODIANS);
String custodianNamesString = "";
for (String custodianName : custodianNames) {
custodianNamesString += custodianName + ", ";
}
StringBuilder custodianNamesString = new StringBuilder();
for (String custodianName : custodianNames) {
custodianNamesString
.append("")
.append(custodianName)
.append("\n");
}
TextView textViewThreshold = view.findViewById(R.id.textViewThreshold);
textViewThreshold.setText(String.format("%d of %d contacts needed to restore account", args.getInt(THRESHOLD), custodianNames.size()));
TextView textViewCustodians = view.findViewById(R.id.textViewCustodians);

View File

@@ -67,4 +67,8 @@ public class ShardsSentFragment extends BaseFragment {
component.inject(this);
}
public void onBackPressed() {
listener.shardsSentDismissed();
}
}

View File

@@ -723,8 +723,8 @@
<string name="activity_name_restore_account">Restore Account</string>
<!-- conversation -->
<string name="social_backup_shard_received">You have received a social backup shard.</string>
<string name="social_backup_shard_sent">You have sent a social backup shard.</string>
<string name="social_backup_shard_received">%1$s has sent you a social backup shard.</string>
<string name="social_backup_shard_sent">You have sent a social backup shard to %1$s.</string>
<string name="activity_name_new_or_recover_account">Create new account or recover existing account</string>
<string name="activity_name_recovery">Recover Account</string>