forked from upstream-mirrors/quik
#891 - Call button will call instead of dial if possible
This commit is contained in:
@@ -42,6 +42,7 @@ import com.moez.QKSMS.feature.settings.about.AboutActivity
|
||||
import com.moez.QKSMS.feature.themepicker.ThemePickerActivity
|
||||
import com.moez.QKSMS.manager.AnalyticsManager
|
||||
import com.moez.QKSMS.manager.NotificationManager
|
||||
import com.moez.QKSMS.manager.PermissionManager
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@@ -50,7 +51,8 @@ import javax.inject.Singleton
|
||||
class Navigator @Inject constructor(
|
||||
private val context: Context,
|
||||
private val analyticsManager: AnalyticsManager,
|
||||
private val notificationManager: NotificationManager
|
||||
private val notificationManager: NotificationManager,
|
||||
private val permissions: PermissionManager
|
||||
) {
|
||||
|
||||
private fun startActivity(intent: Intent) {
|
||||
@@ -174,7 +176,8 @@ class Navigator @Inject constructor(
|
||||
}
|
||||
|
||||
fun makePhoneCall(address: String) {
|
||||
val intent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:$address"))
|
||||
val action = if (permissions.hasCalling()) Intent.ACTION_CALL else Intent.ACTION_DIAL
|
||||
val intent = Intent(action, Uri.parse("tel:$address"))
|
||||
startActivityExternal(intent)
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.moez.QKSMS.common.util.extensions.dpToPx
|
||||
import com.moez.QKSMS.extensions.isImage
|
||||
import com.moez.QKSMS.feature.compose.ComposeActivity
|
||||
import com.moez.QKSMS.feature.qkreply.QkReplyActivity
|
||||
import com.moez.QKSMS.manager.PermissionManager
|
||||
import com.moez.QKSMS.mapper.CursorToPartImpl
|
||||
import com.moez.QKSMS.receiver.MarkReadReceiver
|
||||
import com.moez.QKSMS.receiver.MarkSeenReceiver
|
||||
@@ -56,7 +57,8 @@ class NotificationManagerImpl @Inject constructor(
|
||||
private val colors: Colors,
|
||||
private val conversationRepo: ConversationRepository,
|
||||
private val prefs: Preferences,
|
||||
private val messageRepo: MessageRepository
|
||||
private val messageRepo: MessageRepository,
|
||||
private val permissions: PermissionManager
|
||||
) : com.moez.QKSMS.manager.NotificationManager {
|
||||
|
||||
companion object {
|
||||
@@ -219,7 +221,8 @@ class NotificationManagerImpl @Inject constructor(
|
||||
|
||||
Preferences.NOTIFICATION_ACTION_CALL -> {
|
||||
val address = conversation.recipients[0]?.address
|
||||
val intent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:$address"))
|
||||
val intentAction = if (permissions.hasCalling()) Intent.ACTION_CALL else Intent.ACTION_DIAL
|
||||
val intent = Intent(intentAction, Uri.parse("tel:$address"))
|
||||
val pi = PendingIntent.getActivity(context, threadId.toInt() + 50000, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
NotificationCompat.Action(R.drawable.ic_call_white_24dp, actionLabels[action], pi)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user