-
Notifications
You must be signed in to change notification settings - Fork 505
Update core-telecom dependency and add CALL_BACK intent filter #405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
d2e52ce
f940dd2
741d9ad
5e84173
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,16 +25,21 @@ import android.widget.Toast | |
| import androidx.annotation.RequiresApi | ||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.Row | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.material3.Button | ||
| import androidx.compose.material3.Checkbox | ||
| import androidx.compose.material3.MaterialTheme | ||
| import androidx.compose.material3.Text | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.LaunchedEffect | ||
| import androidx.compose.runtime.collectAsState | ||
| import androidx.compose.runtime.getValue | ||
| import androidx.compose.runtime.mutableStateOf | ||
| import androidx.compose.runtime.remember | ||
| import androidx.compose.runtime.saveable.rememberSaveable | ||
| import androidx.compose.runtime.setValue | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.platform.LocalContext | ||
|
|
@@ -44,6 +49,7 @@ import com.example.platform.connectivity.telecom.call.TelecomCallService | |
| import com.example.platform.connectivity.telecom.model.TelecomCall | ||
| import com.example.platform.connectivity.telecom.model.TelecomCallRepository | ||
| import com.example.platform.shared.PermissionBox | ||
| import androidx.core.net.toUri | ||
|
|
||
| @RequiresApi(Build.VERSION_CODES.O) | ||
| @Composable | ||
|
|
@@ -104,14 +110,30 @@ private fun TelecomCallOptions() { | |
| "No active call" | ||
| } | ||
| Text(text = title, style = MaterialTheme.typography.titleLarge) | ||
|
|
||
| var excludeCallLogging by rememberSaveable { | ||
| mutableStateOf(false) | ||
| } | ||
| Row( | ||
| verticalAlignment = Alignment.CenterVertically | ||
| ) { | ||
| Checkbox( | ||
| checked = excludeCallLogging, | ||
| onCheckedChange = { isChecked -> | ||
| excludeCallLogging = isChecked | ||
| } | ||
| ) | ||
| Text("Exclude from call logs") | ||
| } | ||
| Button( | ||
| enabled = !hasOngoingCall, | ||
| onClick = { | ||
| Toast.makeText(context, "Incoming call in 2 seconds", Toast.LENGTH_SHORT).show() | ||
| context.launchCall( | ||
| action = TelecomCallService.ACTION_INCOMING_CALL, | ||
| name = "Alice", | ||
| uri = Uri.parse("tel:12345"), | ||
| uri = "tel:12345".toUri(), | ||
| excludeCallLogging | ||
| ) | ||
| }, | ||
| ) { | ||
|
|
@@ -123,7 +145,8 @@ private fun TelecomCallOptions() { | |
| context.launchCall( | ||
| action = TelecomCallService.ACTION_OUTGOING_CALL, | ||
| name = "Bob", | ||
| uri = Uri.parse("tel:54321"), | ||
| uri = "tel:54321".toUri(), | ||
| excludeCallLogging | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use parameter naming here for consistency |
||
| ) | ||
| }, | ||
| ) { | ||
|
|
@@ -133,12 +156,13 @@ private fun TelecomCallOptions() { | |
| } | ||
|
|
||
| @RequiresApi(Build.VERSION_CODES.O) | ||
| private fun Context.launchCall(action: String, name: String, uri: Uri) { | ||
| internal fun Context.launchCall(action: String, name: String, uri: Uri, excludeCallLogging: Boolean) { | ||
| startService( | ||
| Intent(this, TelecomCallService::class.java).apply { | ||
| this.action = action | ||
| putExtra(TelecomCallService.EXTRA_NAME, name) | ||
| putExtra(TelecomCallService.EXTRA_URI, uri) | ||
| putExtra(TelecomCallService.EXTRA_EXCLUDE_CALL_LOGGING, excludeCallLogging) | ||
| }, | ||
| ) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,9 @@ pluginManagement { | |
| gradlePluginPortal() | ||
| } | ||
| } | ||
| plugins { | ||
| id("org.gradle.toolchains.foojay-resolver-convention") version "0.10.0" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this plugin has been added?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This plugin helps gradle to download JDK automatically. The project uses JDK 17 strictly. So if JDK 17 is not available in the system the project is building, the plugin will help gradle to download it automatically making the project cloning and building process seamless. |
||
| } | ||
| dependencyResolutionManagement { | ||
| repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) | ||
| repositories { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use parameter naming here for consistency