Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed
- Calling now works directly without launching dialpad ([#562])

## [1.5.0] - 2025-10-18
### Added
Expand Down Expand Up @@ -187,7 +189,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#376]: https://github.com/FossifyOrg/Messages/issues/376
[#456]: https://github.com/FossifyOrg/Messages/issues/456
[#461]: https://github.com/FossifyOrg/Messages/issues/461
[#561]: https://github.com/FossifyOrg/Messages/issues/561
[#561]: https://github.com/FossifyOrg/Messages/pull/561
[#562]: https://github.com/FossifyOrg/Messages/issues/562

[Unreleased]: https://github.com/FossifyOrg/Messages/compare/1.5.0...HEAD
[1.5.0]: https://github.com/FossifyOrg/Messages/compare/1.4.0...1.5.0
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.CALL_PHONE" />

<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission
Expand Down
25 changes: 15 additions & 10 deletions app/src/main/kotlin/org/fossify/messages/extensions/Activity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.content.ActivityNotFoundException
import android.content.Intent
import android.net.Uri
import android.provider.ContactsContract
import org.fossify.commons.activities.BaseSimpleActivity
import org.fossify.commons.extensions.getMimeType
import org.fossify.commons.extensions.hideKeyboard
import org.fossify.commons.extensions.isPackageInstalled
Expand All @@ -14,25 +15,29 @@ import org.fossify.commons.extensions.showErrorToast
import org.fossify.commons.extensions.toast
import org.fossify.commons.helpers.CONTACT_ID
import org.fossify.commons.helpers.IS_PRIVATE
import org.fossify.commons.helpers.PERMISSION_CALL_PHONE
import org.fossify.commons.helpers.SimpleContactsHelper
import org.fossify.commons.helpers.ensureBackgroundThread
import org.fossify.commons.models.SimpleContact
import org.fossify.messages.activities.ConversationDetailsActivity
import org.fossify.messages.helpers.THREAD_ID
import java.util.Locale

fun Activity.dialNumber(phoneNumber: String, callback: (() -> Unit)? = null) {
fun BaseSimpleActivity.dialNumber(phoneNumber: String, callback: (() -> Unit)? = null) {
hideKeyboard()
Intent(Intent.ACTION_DIAL).apply {
data = Uri.fromParts("tel", phoneNumber, null)
handlePermission(PERMISSION_CALL_PHONE) {
val action = if (it) Intent.ACTION_CALL else Intent.ACTION_DIAL
Intent(action).apply {
data = Uri.fromParts("tel", phoneNumber, null)

try {
startActivity(this)
callback?.invoke()
} catch (_: ActivityNotFoundException) {
toast(org.fossify.commons.R.string.no_app_found)
} catch (e: Exception) {
showErrorToast(e)
try {
startActivity(this)
callback?.invoke()
} catch (_: ActivityNotFoundException) {
toast(org.fossify.commons.R.string.no_app_found)
} catch (e: Exception) {
showErrorToast(e)
}
}
}
}
Expand Down
Loading