Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7270499 authored by Moez Bhatti's avatar Moez Bhatti Committed by Dayona Joseph
Browse files

Use Recipient instead of Chip

parent fa51f6fb
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -37,11 +37,10 @@ class CursorToRecipientImpl @Inject constructor(
        const val COLUMN_ADDRESS = 1
    }

    override fun map(from: Cursor) = Recipient().apply {
        id = from.getLong(COLUMN_ID)
        address = from.getString(COLUMN_ADDRESS)
        lastUpdate = System.currentTimeMillis()
    }
    override fun map(from: Cursor) = Recipient(
            id = from.getLong(COLUMN_ID),
            address = from.getString(COLUMN_ADDRESS),
            lastUpdate = System.currentTimeMillis())

    override fun getRecipientCursor(): Cursor? {
        return when (permissionManager.hasReadSms()) {
+6 −0
Original line number Diff line number Diff line
@@ -220,6 +220,12 @@ class ConversationRepositoryImpl @Inject constructor(
                .observeOn(Schedulers.io())
    }

    override fun getRecipients(): RealmResults<Recipient> {
        val realm = Realm.getDefaultInstance()
        return realm.where(Recipient::class.java)
                .findAll()
    }

    override fun getUnmanagedRecipients(): Observable<List<Recipient>> {
        val realm = Realm.getDefaultInstance()
        return realm.where(Recipient::class.java)
+2 −0
Original line number Diff line number Diff line
@@ -54,6 +54,8 @@ interface ConversationRepository {

    fun getUnmanagedConversations(): Observable<List<Conversation>>

    fun getRecipients(): RealmResults<Recipient>

    fun getUnmanagedRecipients(): Observable<List<Recipient>>

    fun getRecipient(recipientId: Long): Recipient?
+3 −3
Original line number Diff line number Diff line
@@ -56,10 +56,10 @@ import com.moez.QKSMS.common.util.extensions.setBackgroundTint
import com.moez.QKSMS.common.util.extensions.setTint
import com.moez.QKSMS.common.util.extensions.setVisible
import com.moez.QKSMS.common.util.extensions.showKeyboard
import com.moez.QKSMS.feature.compose.editing.Chip
import com.moez.QKSMS.feature.compose.editing.ChipsAdapter
import com.moez.QKSMS.feature.contacts.ContactsActivity
import com.moez.QKSMS.model.Attachment
import com.moez.QKSMS.model.Recipient
import com.uber.autodispose.android.lifecycle.scope
import com.uber.autodispose.autoDisposable
import dagger.android.AndroidInjection
@@ -92,7 +92,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {

    override val activityVisibleIntent: Subject<Boolean> = PublishSubject.create()
    override val chipsSelectedIntent: Subject<HashMap<String, String?>> = PublishSubject.create()
    override val chipDeletedIntent: Subject<Chip> by lazy { chipsAdapter.chipDeleted }
    override val chipDeletedIntent: Subject<Recipient> by lazy { chipsAdapter.chipDeleted }
    override val menuReadyIntent: Observable<Unit> = menu.map { Unit }
    override val optionsItemIntent: Subject<Int> = PublishSubject.create()
    override val sendAsGroupIntent by lazy { sendAsGroupBackground.clicks() }
@@ -307,7 +307,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
        startActivityForResult(Intent.createChooser(intent, null), AttachContactRequestCode)
    }

    override fun showContacts(sharing: Boolean, chips: List<Chip>) {
    override fun showContacts(sharing: Boolean, chips: List<Recipient>) {
        message.hideKeyboard()
        val serialized = HashMap(chips.associate { chip -> chip.address to chip.contact?.lookupKey })
        val intent = Intent(this, ContactsActivity::class.java)
+2 −2
Original line number Diff line number Diff line
@@ -19,17 +19,17 @@
package com.moez.QKSMS.feature.compose

import com.moez.QKSMS.compat.SubscriptionInfoCompat
import com.moez.QKSMS.feature.compose.editing.Chip
import com.moez.QKSMS.model.Attachment
import com.moez.QKSMS.model.Conversation
import com.moez.QKSMS.model.Message
import com.moez.QKSMS.model.Recipient
import io.realm.RealmResults

data class ComposeState(
    val hasError: Boolean = false,
    val editingMode: Boolean = false,
    val threadId: Long = 0,
    val selectedChips: List<Chip> = ArrayList(),
    val selectedChips: List<Recipient> = ArrayList(),
    val sendAsGroup: Boolean = true,
    val conversationtitle: String = "",
    val loading: Boolean = false,
Loading