From f3408f1f9a1f17f30780fcd32b58fbf149dcce7a Mon Sep 17 00:00:00 2001
From: Naveen Singh <36371707+naveensingh@users.noreply.github.com>
Date: Thu, 23 Oct 2025 20:39:09 +0530
Subject: [PATCH] feat: call directly instead of launching dialpad (#563)
Refs: https://github.com/FossifyOrg/Messages/issues/562
---
CHANGELOG.md | 5 +++-
app/src/main/AndroidManifest.xml | 1 +
.../fossify/messages/extensions/Activity.kt | 25 +++++++++++--------
3 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 65559209..e3278115 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
@@ -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
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 21578edd..326db512 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -14,6 +14,7 @@
+
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)
+ }
}
}
}