From 869c06e71ad8668d4321a533954d63d273d2bf49 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Tue, 10 Sep 2019 09:52:43 +1000 Subject: [PATCH] Clean --- .../securesms/jobs/PushDecryptJob.java | 36 +++++-------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java index 9b2dd1adc0..e23f87b8a2 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java @@ -744,17 +744,9 @@ public class PushDecryptJob extends BaseJob implements InjectableType { Optional> sharedContacts = getContacts(message.getSharedContacts()); Optional> linkPreviews = getLinkPreviews(message.getPreviews(), message.getBody().or("")); Optional sticker = getStickerAttachment(message.getSticker()); - IncomingMediaMessage mediaMessage = new IncomingMediaMessage(Address.fromExternal(context, content.getSender()), - message.getTimestamp(), -1, - message.getExpiresInSeconds() * 1000L, false, - content.isNeedsReceipt(), - message.getBody(), - message.getGroupInfo(), - message.getAttachments(), - quote, - sharedContacts, - linkPreviews, - sticker); + IncomingMediaMessage mediaMessage = new IncomingMediaMessage(Address.fromExternal(context, content.getSender()), message.getTimestamp(), -1, + message.getExpiresInSeconds() * 1000L, false, content.isNeedsReceipt(), message.getBody(), message.getGroupInfo(), message.getAttachments(), + quote, sharedContacts, linkPreviews, sticker); if (linkPreviews.isPresent()) { int linkPreviewCount = linkPreviews.get().size(); @@ -774,7 +766,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType { try { handleMediaMessage(content, mediaMessage, smsMessageId); } catch (Exception e) { - // Do nothing + // TODO: Handle } } })); @@ -958,17 +950,9 @@ public class PushDecryptJob extends BaseJob implements InjectableType { List urls = LinkPreviewUtil.findWhitelistedUrls(body); int urlCount = urls.size(); if (urlCount != 0) { - IncomingMediaMessage mediaMessage = new IncomingMediaMessage(Address.fromExternal(context, content.getSender()), - message.getTimestamp(), -1, - message.getExpiresInSeconds() * 1000L, false, - content.isNeedsReceipt(), - message.getBody(), - message.getGroupInfo(), - message.getAttachments(), - Optional.absent(), - Optional.absent(), - Optional.of(new ArrayList<>()), - Optional.absent()); + IncomingMediaMessage mediaMessage = new IncomingMediaMessage(Address.fromExternal(context, content.getSender()), message.getTimestamp(), -1, + message.getExpiresInSeconds() * 1000L, false, content.isNeedsReceipt(), message.getBody(), message.getGroupInfo(), message.getAttachments(), + Optional.absent(), Optional.absent(), Optional.of(new ArrayList<>()), Optional.absent()); LinkPreviewRepository lpr = new LinkPreviewRepository(context); final int[] count = { 0 }; for (Link url : urls) { @@ -976,14 +960,12 @@ public class PushDecryptJob extends BaseJob implements InjectableType { int c = count[0]; c = c + 1; count[0] = c; - if (lp.isPresent()) { - mediaMessage.getLinkPreviews().add(lp.get()); - } + if (lp.isPresent()) { mediaMessage.getLinkPreviews().add(lp.get()); } if (c == urlCount) { try { handleMediaMessage(content, mediaMessage, smsMessageId); } catch (Exception e) { - // Do nothing + // TODO: Handle } } }));