From d5407b7b01690ba1cd9ca81118173f58ca14bbd1 Mon Sep 17 00:00:00 2001 From: Christian Basler Date: Sat, 24 Dec 2016 00:15:56 +0100 Subject: [PATCH] Minor improvement --- .../repository/AndroidMessageRepository.java | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/ch/dissem/apps/abit/repository/AndroidMessageRepository.java b/app/src/main/java/ch/dissem/apps/abit/repository/AndroidMessageRepository.java index 228c67e..a1500f4 100644 --- a/app/src/main/java/ch/dissem/apps/abit/repository/AndroidMessageRepository.java +++ b/app/src/main/java/ch/dissem/apps/abit/repository/AndroidMessageRepository.java @@ -33,7 +33,6 @@ import java.util.LinkedList; import java.util.List; import ch.dissem.apps.abit.R; -import ch.dissem.bitmessage.entity.BitmessageAddress; import ch.dissem.bitmessage.entity.Plaintext; import ch.dissem.bitmessage.entity.valueobject.InventoryVector; import ch.dissem.bitmessage.entity.valueobject.Label; @@ -242,25 +241,12 @@ public class AndroidMessageRepository extends AbstractMessageRepository { @Override public void save(Plaintext message) { + saveContactIfNecessary(message.getFrom()); + saveContactIfNecessary(message.getTo()); SQLiteDatabase db = sql.getWritableDatabase(); try { db.beginTransaction(); - // save from address if necessary - BitmessageAddress savedAddress = ctx.getAddressRepository().getAddress(message - .getFrom().getAddress()); - if (message.getId() == null) { - if (savedAddress == null) { - ctx.getAddressRepository().save(message.getFrom()); - } else if (savedAddress.getPubkey() == null) { - savedAddress.setPubkey(message.getFrom().getPubkey()); - ctx.getAddressRepository().save(savedAddress); - } - } - if (savedAddress != null) { - message.getFrom().setAlias(savedAddress.getAlias()); - } - // save message if (message.getId() == null) { insert(db, message);