mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-16 19:18:52 +01:00
change compose sendintent (sending sms/mms) and sendmessage interactor to ensure convos congruency
change compose selectedconversation (chips -> convo monitoring) to take advantage of changes in conversationrepo conversationrepo change getthreadid to getconversation to avoid duplicate db access some cleanups and refactoring in conversationrepo
This commit is contained in:
@@ -19,46 +19,46 @@
|
||||
package dev.octoshrimpy.quik.compat
|
||||
|
||||
import android.content.Context
|
||||
import android.database.sqlite.SqliteWrapper
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.provider.BaseColumns
|
||||
import android.provider.Telephony
|
||||
import android.text.TextUtils
|
||||
import android.util.Patterns
|
||||
import timber.log.Timber
|
||||
import java.util.regex.Pattern
|
||||
|
||||
object TelephonyCompat {
|
||||
class TelephonyCompat {
|
||||
companion object {
|
||||
val THREADS_CONTENT_URI = Telephony.Threads.CONTENT_URI
|
||||
|
||||
private val ID_PROJECTION = arrayOf(BaseColumns._ID)
|
||||
private val ID_PROJECTION = arrayOf(BaseColumns._ID)
|
||||
|
||||
private val THREAD_ID_CONTENT_URI = Uri.parse("content://mms-sms/threadID")
|
||||
private val THREAD_ID_CONTENT_URI = Uri.parse("content://mms-sms/threadID")
|
||||
|
||||
val NAME_ADDR_EMAIL_PATTERN = Pattern.compile("\\s*(\"[^\"]*\"|[^<>\"]+)\\s*<([^<>]+)>\\s*")
|
||||
val NAME_ADDR_EMAIL_PATTERN = Pattern.compile("\\s*(\"[^\"]*\"|[^<>\"]+)\\s*<([^<>]+)>\\s*")
|
||||
|
||||
fun getOrCreateThreadId(context: Context, recipient: String): Long {
|
||||
return getOrCreateThreadId(context, listOf(recipient))
|
||||
}
|
||||
|
||||
fun getOrCreateThreadId(context: Context, recipients: Collection<String>): Long {
|
||||
return Telephony.Threads.getOrCreateThreadId(context, recipients.toSet())
|
||||
}
|
||||
|
||||
fun extractAddrSpec(address: String): String {
|
||||
val match = NAME_ADDR_EMAIL_PATTERN.matcher(address)
|
||||
return if (match.matches()) {
|
||||
match.group(2)
|
||||
} else address
|
||||
}
|
||||
|
||||
fun isEmailAddress(address: String): Boolean {
|
||||
if (TextUtils.isEmpty(address)) {
|
||||
return false
|
||||
fun getOrCreateThreadId(context: Context, recipient: String): Long {
|
||||
return getOrCreateThreadId(context, listOf(recipient))
|
||||
}
|
||||
|
||||
fun getOrCreateThreadId(context: Context, recipients: Collection<String>): Long {
|
||||
return Telephony.Threads.getOrCreateThreadId(context, recipients.toSet())
|
||||
}
|
||||
|
||||
fun extractAddrSpec(address: String): String {
|
||||
val match = NAME_ADDR_EMAIL_PATTERN.matcher(address)
|
||||
return if (match.matches()) {
|
||||
match.group(2)
|
||||
} else address
|
||||
}
|
||||
|
||||
fun isEmailAddress(address: String): Boolean {
|
||||
if (TextUtils.isEmpty(address)) {
|
||||
return false
|
||||
}
|
||||
val s = extractAddrSpec(address)
|
||||
val match = Patterns.EMAIL_ADDRESS.matcher(s)
|
||||
return match.matches()
|
||||
}
|
||||
val s = extractAddrSpec(address)
|
||||
val match = Patterns.EMAIL_ADDRESS.matcher(s)
|
||||
return match.matches()
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user