mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 10:58:34 +00:00
Add additional logging around attachment upload/deletion.
This commit is contained in:
parent
cee6736656
commit
b281b817ba
@ -293,6 +293,8 @@ public class AttachmentDatabase extends Database {
|
|||||||
|
|
||||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
public void deleteAttachmentsForMessage(long mmsId) {
|
public void deleteAttachmentsForMessage(long mmsId) {
|
||||||
|
Log.d(TAG, "[deleteAttachmentsForMessage] mmsId: " + mmsId);
|
||||||
|
|
||||||
SQLiteDatabase database = databaseHelper.getWritableDatabase();
|
SQLiteDatabase database = databaseHelper.getWritableDatabase();
|
||||||
Cursor cursor = null;
|
Cursor cursor = null;
|
||||||
|
|
||||||
@ -317,6 +319,8 @@ public class AttachmentDatabase extends Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void deleteAttachmentFilesForMessage(long mmsId) {
|
public void deleteAttachmentFilesForMessage(long mmsId) {
|
||||||
|
Log.d(TAG, "[deleteAttachmentFilesForMessage] mmsId: " + mmsId);
|
||||||
|
|
||||||
SQLiteDatabase database = databaseHelper.getWritableDatabase();
|
SQLiteDatabase database = databaseHelper.getWritableDatabase();
|
||||||
Cursor cursor = null;
|
Cursor cursor = null;
|
||||||
|
|
||||||
@ -360,6 +364,8 @@ public class AttachmentDatabase extends Database {
|
|||||||
|
|
||||||
|
|
||||||
public void deleteAttachment(@NonNull AttachmentId id) {
|
public void deleteAttachment(@NonNull AttachmentId id) {
|
||||||
|
Log.d(TAG, "[deleteAttachment] attachmentId: " + id);
|
||||||
|
|
||||||
SQLiteDatabase database = databaseHelper.getWritableDatabase();
|
SQLiteDatabase database = databaseHelper.getWritableDatabase();
|
||||||
|
|
||||||
try (Cursor cursor = database.query(TABLE_NAME,
|
try (Cursor cursor = database.query(TABLE_NAME,
|
||||||
@ -408,9 +414,9 @@ public class AttachmentDatabase extends Database {
|
|||||||
boolean dataInUse = isDataUsedByAnotherAttachment(data, attachmentId);
|
boolean dataInUse = isDataUsedByAnotherAttachment(data, attachmentId);
|
||||||
|
|
||||||
if (dataInUse) {
|
if (dataInUse) {
|
||||||
Log.i(TAG, "[deleteAttachmentOnDisk] Attachment in use. Skipping deletion. " + data);
|
Log.i(TAG, "[deleteAttachmentOnDisk] Attachment in use. Skipping deletion. " + data + " " + attachmentId);
|
||||||
} else {
|
} else {
|
||||||
Log.i(TAG, "[deleteAttachmentOnDisk] No other users of this attachment. Safe to delete. " + data);
|
Log.i(TAG, "[deleteAttachmentOnDisk] No other users of this attachment. Safe to delete. " + data + " " + attachmentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(data) && !dataInUse) {
|
if (!TextUtils.isEmpty(data) && !dataInUse) {
|
||||||
|
@ -95,6 +95,8 @@ public final class AttachmentUploadJob extends BaseJob {
|
|||||||
throw new InvalidAttachmentException("Cannot find the specified attachment.");
|
throw new InvalidAttachmentException("Cannot find the specified attachment.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.i(TAG, "Uploading attachment for message " + databaseAttachment.getMmsId() + " with ID " + databaseAttachment.getAttachmentId());
|
||||||
|
|
||||||
try (NotificationController notification = getNotificationForAttachment(databaseAttachment)) {
|
try (NotificationController notification = getNotificationForAttachment(databaseAttachment)) {
|
||||||
SignalServiceAttachment localAttachment = getAttachmentFor(databaseAttachment, notification);
|
SignalServiceAttachment localAttachment = getAttachmentFor(databaseAttachment, notification);
|
||||||
SignalServiceAttachmentPointer remoteAttachment = messageSender.uploadAttachment(localAttachment.asStream());
|
SignalServiceAttachmentPointer remoteAttachment = messageSender.uploadAttachment(localAttachment.asStream());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user