mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 03:28:52 +01:00
#207 - Dual SIM support
commit c3dc3ada558c466be5115cd7ddbf9651a229c217 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Sat Jun 2 02:54:06 2018 -0400 Dual SIM support for QK Reply commit 48688dd4720bd1b3abc049d365e208e1dfe5ccb8 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Sat Jun 2 00:37:08 2018 -0400 #1172 - Load all recipients and subId from threadId when sending message from notification reply bar commit 0b7195fb134c0a9f2a6b551176c6c25a26bf5838 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Fri Jun 1 23:43:30 2018 -0400 Fix missing subId for RetrySending params commit 0d3ec43c0e60bab4acc293947ea9f6d2228c1b19 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Fri Jun 1 23:27:56 2018 -0400 Switch to appropriate SIM when new message is received commit 1ae883af890104cf1da9e970571371c95666db66 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Fri Jun 1 23:07:16 2018 -0400 Fix message grouping for incoming messages commit 2bf7b2d99ddbfdcafff873f305180d6d38c37d65 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Fri Jun 1 22:56:31 2018 -0400 Correctly assign subId for incoming SMS commit 1f6028f8921320358a3053a2dbc2c6e05410964b Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Fri Jun 1 20:52:01 2018 -0400 Abstract SubscriptionManager usage behind SubscriptionUtils commit 8b18f16271f19a42800c737cfbd867365c4aa781 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Fri Jun 1 20:05:52 2018 -0400 Store subId when receiving SMS commit f0e4ffdf15eb54d8ef78adfe244943ef4cb95d4e Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Fri Jun 1 19:52:40 2018 -0400 Use appropriate SIM card based on last message commit b7893d69891e4fb61755b0733a5fab561e86bbf3 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Thu May 31 00:20:42 2018 -0400 Fix crash when device doesn't support multi-sim commit bb038068129227e931167976628e1a535efb09a0 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Wed May 30 23:54:14 2018 -0400 Show sim indicator when subId changes in conversation commit 952f15f7ebfb85a03feef51373ef30568b76d5eb Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Wed May 30 22:13:57 2018 -0400 Send message from selected SIM commit 4cfab7ca9ec9bd9c7ce82b3eb5f228cf511a7c7b Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Wed May 30 21:46:01 2018 -0400 Fix filename for ActiveSubscriptionObservable commit 720cb79cb4fbfb98b10e169f2fea84be02fd2f91 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Wed May 30 20:35:30 2018 -0400 Allow cycling through inserted sims commit fa95980e9bc8e8c01dab7b4b8e4ed3a1c9a0f0b0 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Wed May 30 18:26:44 2018 -0400 Show sim card slot in compose bar
This commit is contained in:
@@ -32,23 +32,26 @@ class ReceiveSms @Inject constructor(
|
||||
private val messageRepo: MessageRepository,
|
||||
private val notificationManager: NotificationManager,
|
||||
private val updateBadge: UpdateBadge
|
||||
) : Interactor<Array<SmsMessage>>() {
|
||||
) : Interactor<ReceiveSms.Params>() {
|
||||
|
||||
override fun buildObservable(params: Array<SmsMessage>): Flowable<*> {
|
||||
class Params(val subId: Int, val messages: Array<SmsMessage>)
|
||||
|
||||
override fun buildObservable(params: Params): Flowable<*> {
|
||||
return Flowable.just(params)
|
||||
.filter { it.isNotEmpty() }
|
||||
.filter { messages -> // Don't continue if the sender is blocked
|
||||
val address = messages[0].displayOriginatingAddress
|
||||
.filter { it.messages.isNotEmpty() }
|
||||
.filter { // Don't continue if the sender is blocked
|
||||
val address = it.messages[0].displayOriginatingAddress
|
||||
!externalBlockingManager.shouldBlock(address).blockingGet()
|
||||
}
|
||||
.map { messages ->
|
||||
.map {
|
||||
val messages = it.messages
|
||||
val address = messages[0].displayOriginatingAddress
|
||||
val time = messages[0].timestampMillis
|
||||
val body: String = messages
|
||||
.map { message -> message.displayMessageBody }
|
||||
.reduce { body, new -> body + new }
|
||||
|
||||
messageRepo.insertReceivedSms(address, body, time) // Add the message to the db
|
||||
messageRepo.insertReceivedSms(it.subId, address, body, time) // Add the message to the db
|
||||
}
|
||||
.doOnNext { message -> messageRepo.updateConversations(message.threadId) } // Update the conversation
|
||||
.mapNotNull { message -> messageRepo.getOrCreateConversation(message.threadId) } // Map message to conversation
|
||||
|
||||
@@ -34,6 +34,7 @@ class RetrySending @Inject constructor(private val messageRepo: MessageRepositor
|
||||
type = params.type
|
||||
address = params.address
|
||||
body = params.body
|
||||
subId = params.subId
|
||||
}
|
||||
|
||||
return Flowable.just(message)
|
||||
|
||||
@@ -27,16 +27,16 @@ class SendMessage @Inject constructor(
|
||||
private val messageRepo: MessageRepository
|
||||
) : Interactor<SendMessage.Params>() {
|
||||
|
||||
data class Params(val threadId: Long, val addresses: List<String>, val body: String, val attachments: List<Attachment> = listOf())
|
||||
data class Params(val subId: Int, val threadId: Long, val addresses: List<String>, val body: String, val attachments: List<Attachment> = listOf())
|
||||
|
||||
override fun buildObservable(params: Params): Flowable<Unit> {
|
||||
return Flowable.just(Unit)
|
||||
.filter { params.addresses.isNotEmpty() }
|
||||
.doOnNext {
|
||||
if (params.addresses.size == 1 && params.attachments.isEmpty()) {
|
||||
messageRepo.sendSmsAndPersist(params.threadId, params.addresses.first(), params.body)
|
||||
messageRepo.sendSmsAndPersist(params.subId, params.threadId, params.addresses.first(), params.body)
|
||||
} else {
|
||||
messageRepo.sendMms(params.threadId, params.addresses, params.body, params.attachments)
|
||||
messageRepo.sendMms(params.subId, params.threadId, params.addresses, params.body, params.attachments)
|
||||
}
|
||||
}
|
||||
.doOnNext { messageRepo.updateConversations(params.threadId) }
|
||||
|
||||
Reference in New Issue
Block a user