mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-25 02:55:23 +00:00
fix: some compile issues in tests and some TODOs for things to do before merge
This commit is contained in:
parent
cf171fc371
commit
f7b8a90edb
@ -41,7 +41,7 @@ import org.thoughtcrime.securesms.database.model.SmsMessageRecord
|
||||
import org.thoughtcrime.securesms.mms.GlideRequests
|
||||
import org.thoughtcrime.securesms.util.SearchUtil
|
||||
import org.thoughtcrime.securesms.util.getAccentColor
|
||||
import java.util.*
|
||||
import java.util.Locale
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
class VisibleMessageContentView : ConstraintLayout {
|
||||
@ -131,7 +131,6 @@ class VisibleMessageContentView : ConstraintLayout {
|
||||
delegate?.scrollToMessageIfPossible(quote.id)
|
||||
}
|
||||
}
|
||||
val hasMedia = message.slideDeck.asAttachments().isNotEmpty()
|
||||
}
|
||||
|
||||
if (message is MmsMessageRecord) {
|
||||
|
@ -593,6 +593,7 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
|
||||
|
||||
if (oldVersion < lokiV41) {
|
||||
db.execSQL(ConfigDatabase.CREATE_CONFIG_TABLE_COMMAND);
|
||||
// TODO: delete threads where necessary for one to ones
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
|
@ -144,24 +144,23 @@ public class ExpiringMessageManager implements SSKEnvironment.MessageExpirationM
|
||||
String groupId = message.getGroupPublicKey();
|
||||
int duration = message.getDuration();
|
||||
|
||||
Address address = Address.fromSerialized((message.getSyncTarget() != null && !message.getSyncTarget().isEmpty()) ? message.getSyncTarget() : message.getRecipient());
|
||||
Recipient recipient = Recipient.from(context, address, false);
|
||||
if (message.getThreadID() == null || message.getThreadID() < 0) {
|
||||
StorageProtocol storage = MessagingModuleConfiguration.getShared().getStorage();
|
||||
message.setThreadID(storage.getOrCreateThreadIdFor(address));
|
||||
}
|
||||
Address address;
|
||||
|
||||
try {
|
||||
if (groupId != null) {
|
||||
address = Address.fromSerialized(GroupUtil.doubleEncodeGroupID(groupId));
|
||||
} else {
|
||||
address = Address.fromSerialized((message.getSyncTarget() != null && !message.getSyncTarget().isEmpty()) ? message.getSyncTarget() : message.getRecipient());
|
||||
}
|
||||
|
||||
Recipient recipient = Recipient.from(context, address, false);
|
||||
StorageProtocol storage = MessagingModuleConfiguration.getShared().getStorage();
|
||||
message.setThreadID(storage.getOrCreateThreadIdFor(address));
|
||||
|
||||
OutgoingExpirationUpdateMessage timerUpdateMessage = new OutgoingExpirationUpdateMessage(recipient, sentTimestamp, duration * 1000L, groupId);
|
||||
mmsDatabase.insertSecureDecryptedMessageOutbox(timerUpdateMessage, message.getThreadID(), sentTimestamp, true);
|
||||
|
||||
if (groupId != null) {
|
||||
// we need the group ID as recipient for setExpireMessages below
|
||||
recipient = Recipient.from(context, Address.fromSerialized(GroupUtil.doubleEncodeGroupID(groupId)), false);
|
||||
}
|
||||
//set the timer to the conversation
|
||||
MessagingModuleConfiguration.getShared().getStorage().setExpirationTimer(recipient.getAddress().serialize(), duration);
|
||||
|
||||
} catch (MmsException | IOException ioe) {
|
||||
Log.e("Loki", "Failed to insert expiration update message.", ioe);
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import kotlinx.coroutines.flow.first
|
||||
import org.hamcrest.CoreMatchers.endsWith
|
||||
import org.hamcrest.CoreMatchers.equalTo
|
||||
import org.hamcrest.MatcherAssert.assertThat
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.mockito.Mockito.anyLong
|
||||
@ -31,7 +30,7 @@ class ConversationViewModelTest: BaseViewModelTest() {
|
||||
private lateinit var recipient: Recipient
|
||||
|
||||
private val viewModel: ConversationViewModel by lazy {
|
||||
ConversationViewModel(threadId, edKeyPair, repository, storage)
|
||||
ConversationViewModel(threadId, edKeyPair, mock(), repository, storage)
|
||||
}
|
||||
|
||||
@Before
|
||||
|
@ -26,9 +26,9 @@ class MessageRequestsViewModelTest : BaseViewModelTest() {
|
||||
|
||||
@Test
|
||||
fun `should clear all message requests`() = runBlockingTest {
|
||||
viewModel.clearAllMessageRequests()
|
||||
viewModel.clearAllMessageRequests(block = false)
|
||||
|
||||
verify(repository).clearAllMessageRequests()
|
||||
verify(repository).clearAllMessageRequests(block = false)
|
||||
}
|
||||
|
||||
}
|
@ -9,7 +9,7 @@ import junit.framework.TestCase;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.session.libsession.utilities.Address;
|
||||
import org.session.libsession.utilities.recipients.Recipient;
|
||||
import org.session.libsession.utilities.recipients.RecipientExporter;
|
||||
|
@ -90,6 +90,7 @@ data class ConfigurationSyncJob(val destination: Destination): Job {
|
||||
Log.d(TAG, "Including delete request for current hashes")
|
||||
}
|
||||
|
||||
// TODO: re-add all this to do actual network sync job
|
||||
val batchResponse = SnodeAPI.getSingleTargetSnode(destination.destinationPublicKey()).bind { snode ->
|
||||
SnodeAPI.getRawBatchResponse(
|
||||
snode,
|
||||
|
Loading…
Reference in New Issue
Block a user