media saved notification is sent only when incoming media are saved

pull/508/head
Brice-W 4 years ago
parent 40015c2898
commit 2bce2738b3

@ -353,8 +353,11 @@ public class MediaOverviewActivity extends PassphraseRequiredActionBarActivity {
saveTask.executeOnExecutor(THREAD_POOL_EXECUTOR,
attachments.toArray(new SaveAttachmentTask.Attachment[attachments.size()]));
actionMode.finish();
// Sending a Data extraction notification
sendMediaSavedNotificationIfNeeded();
// Sending a Data extraction notification (for incoming attachments only)
boolean containsIncoming = mediaRecords.parallelStream().anyMatch(m -> !m.isOutgoing());
if (containsIncoming) {
sendMediaSavedNotificationIfNeeded();
}
}
}.execute();
})

@ -357,8 +357,10 @@ public class MediaPreviewActivity extends PassphraseRequiredActionBarActivity im
saveTask.executeOnExecutor(
AsyncTask.THREAD_POOL_EXECUTOR,
new Attachment(mediaItem.uri, mediaItem.type, saveDate, null));
// Sending a Data extraction notification
sendMediaSavedNotificationIfNeeded();
// Sending a Data extraction notification (for incoming attachments only)
if(!mediaItem.outgoing) {
sendMediaSavedNotificationIfNeeded();
}
})
.execute();
});

@ -746,8 +746,10 @@ public class ConversationFragment extends Fragment
if (!Util.isEmpty(attachments)) {
SaveAttachmentTask saveTask = new SaveAttachmentTask(getActivity());
saveTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, attachments.toArray(new SaveAttachmentTask.Attachment[0]));
// Sending a Data extraction notification
sendMediaSavedNotificationIfNeeded();
// Sending a Data extraction notification (for incoming attachments only)
if(!message.isOutgoing()) {
sendMediaSavedNotificationIfNeeded();
}
return;
}

Loading…
Cancel
Save