mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Check if the chosen contact supports removable drive transport
and show message if not
This commit is contained in:
@@ -93,7 +93,9 @@ class RemovableDriveViewModel extends DbViewModel {
|
||||
ContactId c = requireNonNull(contactId);
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
if (manager.isWriterTaskNeeded(c)) {
|
||||
if (!manager.isTransportSupportedByContact(c)) {
|
||||
state.postValue(new TransferDataState.NotSupported());
|
||||
} else if (manager.isWriterTaskNeeded(c)) {
|
||||
state.postValue(new TransferDataState.Ready());
|
||||
} else {
|
||||
state.postValue(new TransferDataState.NoDataToSend());
|
||||
|
||||
@@ -102,6 +102,9 @@ public class SendFragment extends Fragment {
|
||||
if (state instanceof TransferDataState.NoDataToSend) {
|
||||
introTextView.setText(R.string.removable_drive_send_no_data);
|
||||
button.setEnabled(false);
|
||||
} else if (state instanceof TransferDataState.NotSupported) {
|
||||
introTextView.setText(R.string.removable_drive_send_not_supported);
|
||||
button.setEnabled(false);
|
||||
} else if (state instanceof TransferDataState.Ready) {
|
||||
button.setEnabled(true);
|
||||
} else if (state instanceof TransferDataState.TaskAvailable) {
|
||||
|
||||
@@ -13,6 +13,13 @@ abstract class TransferDataState {
|
||||
static class NoDataToSend extends TransferDataState {
|
||||
}
|
||||
|
||||
/**
|
||||
* The chosen contact does not support the transport, yet.
|
||||
* So we can't send them data this way.
|
||||
*/
|
||||
static class NotSupported extends TransferDataState {
|
||||
}
|
||||
|
||||
/**
|
||||
* We are ready to let the user select a file for sending or receiving data.
|
||||
*/
|
||||
|
||||
@@ -696,6 +696,7 @@
|
||||
<string name="removable_drive_title_receive">Receive data</string>
|
||||
<string name="removable_drive_send_intro">Tap the button below to create a new file containing the encrypted messages. You can choose where the file will be saved.\n\nIf you want to save the file on a removable drive, insert the drive now.</string>
|
||||
<string name="removable_drive_send_no_data">There are currently no messages waiting to be sent to this contact.</string>
|
||||
<string name="removable_drive_send_not_supported">This contact is using an old version of Briar which does not yet support this feature.</string>
|
||||
<string name="removable_drive_send_button">Choose file for export</string>
|
||||
<string name="removable_drive_ongoing">Please wait for ongoing task to complete</string>
|
||||
<string name="removable_drive_receive_intro">Tap the button below to choose the file that your contact sent you.\n\nIf the file is on a removable drive, insert the drive now.</string>
|
||||
|
||||
Reference in New Issue
Block a user