Added two helper functions
This commit is contained in:
@@ -307,13 +307,8 @@ class MainActivity : ComponentActivity() {
|
|||||||
intent.removeExtra("action")
|
intent.removeExtra("action")
|
||||||
handleIntent(applicationContext, viewModel, intent, action)
|
handleIntent(applicationContext, viewModel, intent, action)
|
||||||
}
|
}
|
||||||
else if (intent.action == ACTION_VIEW && (intent.type == CallLog.Calls.CONTENT_TYPE ||
|
else if (isCallLogIntent(intent)) {
|
||||||
intent.data?.toString()?.contains("calls") == true)) {
|
handleCallLogIntent()
|
||||||
Log.d(TAG, "onStart: Handling Call Log intent")
|
|
||||||
val ua = BaresipService.uas.value.find { it.account.isMobile }
|
|
||||||
?: BaresipService.uas.value.firstOrNull()
|
|
||||||
if (ua != null)
|
|
||||||
viewModel.navigateToCalls(ua.account.aor)
|
|
||||||
}
|
}
|
||||||
else if (intent.action == Intent.ACTION_MAIN && !atStartup) {
|
else if (intent.action == Intent.ACTION_MAIN && !atStartup) {
|
||||||
val activeNotifications = nm.activeNotifications
|
val activeNotifications = nm.activeNotifications
|
||||||
@@ -373,13 +368,8 @@ class MainActivity : ComponentActivity() {
|
|||||||
Log.d(TAG, "onNewIntent action/type/data: ${intent.action}/${intent.type}/${intent.data}")
|
Log.d(TAG, "onNewIntent action/type/data: ${intent.action}/${intent.type}/${intent.data}")
|
||||||
|
|
||||||
when {
|
when {
|
||||||
intent.action == ACTION_VIEW && (intent.type == CallLog.Calls.CONTENT_TYPE ||
|
isCallLogIntent(intent) -> {
|
||||||
intent.data?.toString()?.contains("calls") == true) -> {
|
handleCallLogIntent()
|
||||||
Log.d(TAG, "onNewIntent: Handling Call Log intent")
|
|
||||||
val ua = BaresipService.uas.value.find { it.account.isMobile }
|
|
||||||
?: BaresipService.uas.value.firstOrNull()
|
|
||||||
if (ua != null)
|
|
||||||
viewModel.navigateToCalls(ua.account.aor)
|
|
||||||
}
|
}
|
||||||
intent.action in listOf(ACTION_DIAL, ACTION_CALL, ACTION_VIEW) -> {
|
intent.action in listOf(ACTION_DIAL, ACTION_CALL, ACTION_VIEW) -> {
|
||||||
callAction(
|
callAction(
|
||||||
@@ -418,6 +408,19 @@ class MainActivity : ComponentActivity() {
|
|||||||
return super.onKeyDown(keyCode, event)
|
return super.onKeyDown(keyCode, event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun isCallLogIntent(intent: Intent?): Boolean {
|
||||||
|
return intent?.action == ACTION_VIEW && (intent.type == CallLog.Calls.CONTENT_TYPE ||
|
||||||
|
intent.data?.toString()?.contains("calls") == true)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun handleCallLogIntent() {
|
||||||
|
Log.d(TAG, "Handling Call Log intent")
|
||||||
|
val ua = BaresipService.uas.value.find { it.account.isMobile }
|
||||||
|
?: BaresipService.uas.value.firstOrNull()
|
||||||
|
if (ua != null)
|
||||||
|
viewModel.navigateToCalls(ua.account.aor)
|
||||||
|
}
|
||||||
|
|
||||||
private fun quitRestart(reStart: Boolean) {
|
private fun quitRestart(reStart: Boolean) {
|
||||||
Log.i(TAG, "quitRestart Restart = $reStart")
|
Log.i(TAG, "quitRestart Restart = $reStart")
|
||||||
window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
|
window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
|
||||||
|
|||||||
Reference in New Issue
Block a user