mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user