make dialNumber callback nullable for easier reading
This commit is contained in:
parent
636c7cb8c5
commit
580fc7d35b
1 changed files with 3 additions and 3 deletions
|
|
@ -34,10 +34,10 @@ import com.simplemobiletools.smsmessenger.interfaces.MessagesDao
|
||||||
import com.simplemobiletools.smsmessenger.models.*
|
import com.simplemobiletools.smsmessenger.models.*
|
||||||
import com.simplemobiletools.smsmessenger.receivers.DirectReplyReceiver
|
import com.simplemobiletools.smsmessenger.receivers.DirectReplyReceiver
|
||||||
import com.simplemobiletools.smsmessenger.receivers.MarkAsReadReceiver
|
import com.simplemobiletools.smsmessenger.receivers.MarkAsReadReceiver
|
||||||
|
import me.leolin.shortcutbadger.ShortcutBadger
|
||||||
import java.io.FileNotFoundException
|
import java.io.FileNotFoundException
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
import me.leolin.shortcutbadger.ShortcutBadger
|
|
||||||
|
|
||||||
val Context.config: Config get() = Config.newInstance(applicationContext)
|
val Context.config: Config get() = Config.newInstance(applicationContext)
|
||||||
|
|
||||||
|
|
@ -894,13 +894,13 @@ fun Context.getFileSizeFromUri(uri: Uri): Long {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.dialNumber(phoneNumber: String, callback: () -> Unit = fun() {}) {
|
fun Context.dialNumber(phoneNumber: String, callback: (() -> Unit)? = null) {
|
||||||
Intent(Intent.ACTION_DIAL).apply {
|
Intent(Intent.ACTION_DIAL).apply {
|
||||||
data = Uri.fromParts("tel", phoneNumber, null)
|
data = Uri.fromParts("tel", phoneNumber, null)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
startActivity(this)
|
startActivity(this)
|
||||||
callback()
|
callback?.invoke()
|
||||||
} catch (e: ActivityNotFoundException) {
|
} catch (e: ActivityNotFoundException) {
|
||||||
toast(R.string.no_app_found)
|
toast(R.string.no_app_found)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue