Skip to content

Commit 416054b

Browse files
committed
move the SMS sending activity extension to Commons
1 parent c759954 commit 416054b

File tree

5 files changed

+8
-21
lines changed

5 files changed

+8
-21
lines changed

app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ android {
5757
}
5858

5959
dependencies {
60-
implementation 'com.simplemobiletools:commons:5.32.5'
60+
implementation 'com.simplemobiletools:commons:5.32.17'
6161
implementation 'joda-time:joda-time:2.10.1'
6262
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5'
6363
implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a'
6464
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
6565

66-
kapt "androidx.room:room-compiler:2.2.5"
67-
implementation "androidx.room:room-runtime:2.2.5"
68-
annotationProcessor "androidx.room:room-compiler:2.2.5"
66+
kapt "androidx.room:room-compiler:2.2.6"
67+
implementation "androidx.room:room-runtime:2.2.6"
68+
annotationProcessor "androidx.room:room-compiler:2.2.6"
6969
}

app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ContactActivity.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import com.simplemobiletools.commons.helpers.letterBackgroundColors
2424
import com.simplemobiletools.commons.models.RadioItem
2525
import com.simplemobiletools.contacts.pro.R
2626
import com.simplemobiletools.contacts.pro.extensions.sendEmailIntent
27-
import com.simplemobiletools.contacts.pro.extensions.sendSMSIntent
2827
import com.simplemobiletools.contacts.pro.extensions.shareContacts
2928
import com.simplemobiletools.contacts.pro.helpers.ContactsHelper
3029
import com.simplemobiletools.contacts.pro.models.Contact
@@ -92,15 +91,15 @@ abstract class ContactActivity : SimpleActivity() {
9291
fun trySendSMS() {
9392
val numbers = contact!!.phoneNumbers
9493
if (numbers.size == 1) {
95-
sendSMSIntent(numbers.first().value)
94+
launchSendSMSIntent(numbers.first().value)
9695
} else if (numbers.size > 1) {
9796
val items = ArrayList<RadioItem>()
9897
numbers.forEachIndexed { index, phoneNumber ->
9998
items.add(RadioItem(index, phoneNumber.value, phoneNumber.value))
10099
}
101100

102101
RadioGroupDialog(this, items) {
103-
sendSMSIntent(it as String)
102+
launchSendSMSIntent(it as String)
104103
}
105104
}
106105
}

app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,6 @@ fun Context.sendEmailIntent(recipient: String) {
6666
}
6767
}
6868

69-
fun Context.sendSMSIntent(recipient: String) {
70-
Intent(Intent.ACTION_SENDTO).apply {
71-
data = Uri.fromParts("smsto", recipient, null)
72-
if (resolveActivity(packageManager) != null) {
73-
startActivity(this)
74-
} else {
75-
toast(R.string.no_app_found)
76-
}
77-
}
78-
}
79-
8069
fun Context.sendAddressIntent(address: String) {
8170
val location = Uri.encode(address)
8271
val uri = Uri.parse("geo:0,0?q=$location")

app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/LocalContactsHelper.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import android.graphics.BitmapFactory
66
import android.net.Uri
77
import android.provider.ContactsContract.CommonDataKinds.Event
88
import android.provider.MediaStore
9-
import com.simplemobiletools.commons.extensions.getChoppedList
109
import com.simplemobiletools.commons.models.SimpleContact
1110
import com.simplemobiletools.contacts.pro.extensions.contactsDB
1211
import com.simplemobiletools.contacts.pro.extensions.getByteArray
@@ -56,7 +55,7 @@ class LocalContactsHelper(val context: Context) {
5655
}
5756

5857
fun deleteContactIds(ids: MutableList<Long>) {
59-
ids.getChoppedList().forEach {
58+
ids.chunked(30).forEach {
6059
context.contactsDB.deleteContactIds(it)
6160
}
6261
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.4.20'
4+
ext.kotlin_version = '1.4.21'
55

66
repositories {
77
google()

0 commit comments

Comments
 (0)