mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-22 10:21:29 +00:00
fix queuing of pending parts that had data already
fixes #4061 Closes #4073 // FREEBIE
This commit is contained in:
parent
ed1d411bde
commit
0e06e2de97
@ -66,7 +66,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
|
|||||||
public static final int PUSH_DECRYPT_SERIAL_ID_VERSION = 131;
|
public static final int PUSH_DECRYPT_SERIAL_ID_VERSION = 131;
|
||||||
public static final int MIGRATE_SESSION_PLAINTEXT = 136;
|
public static final int MIGRATE_SESSION_PLAINTEXT = 136;
|
||||||
public static final int CONTACTS_ACCOUNT_VERSION = 136;
|
public static final int CONTACTS_ACCOUNT_VERSION = 136;
|
||||||
public static final int MEDIA_DOWNLOAD_CONTROLS_VERSION = 149;
|
public static final int MEDIA_DOWNLOAD_CONTROLS_VERSION = 151;
|
||||||
|
|
||||||
private static final SortedSet<Integer> UPGRADE_VERSIONS = new TreeSet<Integer>() {{
|
private static final SortedSet<Integer> UPGRADE_VERSIONS = new TreeSet<Integer>() {{
|
||||||
add(NO_MORE_KEY_EXCHANGE_PREFIX_VERSION);
|
add(NO_MORE_KEY_EXCHANGE_PREFIX_VERSION);
|
||||||
@ -233,8 +233,8 @@ public class DatabaseUpgradeActivity extends BaseActivity {
|
|||||||
final Reader reader = mmsDb.readerFor(masterSecret, mmsDb.getMessage(part.getMmsId()));
|
final Reader reader = mmsDb.readerFor(masterSecret, mmsDb.getMessage(part.getMmsId()));
|
||||||
final MessageRecord record = reader.getNext();
|
final MessageRecord record = reader.getNext();
|
||||||
|
|
||||||
if (part.getContentLocation() == null) {
|
if (part.getDataUri() != null) {
|
||||||
Log.w(TAG, "corrected a pending self-sent media part " + part.getPartId() + ".");
|
Log.w(TAG, "corrected a pending media part " + part.getPartId() + "that already had data.");
|
||||||
partDb.setTransferState(part.getMmsId(), part.getPartId(), PartDatabase.TRANSFER_PROGRESS_DONE);
|
partDb.setTransferState(part.getMmsId(), part.getPartId(), PartDatabase.TRANSFER_PROGRESS_DONE);
|
||||||
} else if (record != null && !record.isOutgoing() && record.isPush()) {
|
} else if (record != null && !record.isOutgoing() && record.isPush()) {
|
||||||
Log.w(TAG, "queuing new attachment download job for incoming push part " + part.getPartId() + ".");
|
Log.w(TAG, "queuing new attachment download job for incoming push part " + part.getPartId() + ".");
|
||||||
|
@ -226,7 +226,7 @@ public class ThumbnailView extends FrameLayout {
|
|||||||
builder = buildPlaceholderGlideRequest(slide);
|
builder = buildPlaceholderGlideRequest(slide);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slide.isInProgress() && !hideControls) {
|
if (slide.getTransferProgress() != PartDatabase.TRANSFER_PROGRESS_DONE && !hideControls) {
|
||||||
return builder;
|
return builder;
|
||||||
} else {
|
} else {
|
||||||
return builder.error(R.drawable.ic_missing_thumbnail_picture);
|
return builder.error(R.drawable.ic_missing_thumbnail_picture);
|
||||||
@ -331,9 +331,9 @@ public class ThumbnailView extends FrameLayout {
|
|||||||
private class ThumbnailClickDispatcher implements View.OnClickListener {
|
private class ThumbnailClickDispatcher implements View.OnClickListener {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (thumbnailClickListener != null &&
|
if (thumbnailClickListener != null &&
|
||||||
slide != null &&
|
slide != null &&
|
||||||
slide.getTransferProgress() == PartDatabase.TRANSFER_PROGRESS_DONE)
|
slide.getPart().getDataUri() != null)
|
||||||
{
|
{
|
||||||
thumbnailClickListener.onClick(view, slide);
|
thumbnailClickListener.onClick(view, slide);
|
||||||
}
|
}
|
||||||
|
@ -298,6 +298,11 @@ public class PartDatabase extends Database {
|
|||||||
|
|
||||||
if (!cursor.isNull(sizeColumn))
|
if (!cursor.isNull(sizeColumn))
|
||||||
part.setDataSize(cursor.getLong(cursor.getColumnIndexOrThrow(SIZE)));
|
part.setDataSize(cursor.getLong(cursor.getColumnIndexOrThrow(SIZE)));
|
||||||
|
|
||||||
|
int dataColumn = cursor.getColumnIndexOrThrow(DATA);
|
||||||
|
|
||||||
|
if (!cursor.isNull(dataColumn))
|
||||||
|
part.setDataUri(PartAuthority.getPartUri(part.getPartId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContentValues getContentValuesForPart(PduPart part) throws MmsException {
|
private ContentValues getContentValuesForPart(PduPart part) throws MmsException {
|
||||||
@ -440,8 +445,6 @@ public class PartDatabase extends Database {
|
|||||||
|
|
||||||
getPartValues(part, cursor);
|
getPartValues(part, cursor);
|
||||||
|
|
||||||
part.setDataUri(PartAuthority.getPartUri(part.getPartId()));
|
|
||||||
|
|
||||||
return part;
|
return part;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +71,10 @@ public class AttachmentDownloadJob extends MasterSecretJob implements Injectable
|
|||||||
Log.w(TAG, "part no longer exists.");
|
Log.w(TAG, "part no longer exists.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (part.getDataUri() != null) {
|
||||||
|
Log.w(TAG, "part was already downloaded.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Log.w(TAG, "Downloading push part " + partId);
|
Log.w(TAG, "Downloading push part " + partId);
|
||||||
|
|
||||||
|
@ -87,6 +87,7 @@ public class PushGroupSendJob extends PushSendJob implements InjectableType {
|
|||||||
database.markAsPush(messageId);
|
database.markAsPush(messageId);
|
||||||
database.markAsSecure(messageId);
|
database.markAsSecure(messageId);
|
||||||
database.markAsSent(messageId, "push".getBytes(), 0);
|
database.markAsSent(messageId, "push".getBytes(), 0);
|
||||||
|
markPartsUploaded(messageId, message.getBody());
|
||||||
} catch (InvalidNumberException | RecipientFormattingException | UndeliverableMessageException e) {
|
} catch (InvalidNumberException | RecipientFormattingException | UndeliverableMessageException e) {
|
||||||
Log.w(TAG, e);
|
Log.w(TAG, e);
|
||||||
database.markAsSentFailed(messageId);
|
database.markAsSentFailed(messageId);
|
||||||
|
@ -55,7 +55,7 @@ public class ImageSlide extends Slide {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @DrawableRes int getPlaceholderRes(Theme theme) {
|
public @DrawableRes int getPlaceholderRes(Theme theme) {
|
||||||
return R.drawable.ic_missing_thumbnail_picture;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user