Do not show rec icon when mobile account is selected
Disable account spinner long click and screen swipe when mobile account is selected
This commit is contained in:
@@ -552,6 +552,11 @@ private fun TopAppBar(
|
|||||||
windowInsets = WindowInsets(0, 0, 0, 0),
|
windowInsets = WindowInsets(0, 0, 0, 0),
|
||||||
actions = {
|
actions = {
|
||||||
|
|
||||||
|
val selectedAor by viewModel.selectedAor.collectAsState()
|
||||||
|
val uas by BaresipService.uas
|
||||||
|
val isMobile = uas.find { it.account.aor == selectedAor }?.account?.isMobile ?: false
|
||||||
|
|
||||||
|
if (!isMobile) {
|
||||||
Spacer(modifier = Modifier.width(8.dp))
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
|
|
||||||
val callRecordingTitle = stringResource(R.string.call_recording_title)
|
val callRecordingTitle = stringResource(R.string.call_recording_title)
|
||||||
@@ -562,17 +567,13 @@ private fun TopAppBar(
|
|||||||
.clip(CircleShape)
|
.clip(CircleShape)
|
||||||
.combinedClickable(
|
.combinedClickable(
|
||||||
onClick = {
|
onClick = {
|
||||||
if (Call.call("connected") == null) {
|
if (!Call.isAnyCallActive(ctx)) {
|
||||||
BaresipService.isRecOn = !BaresipService.isRecOn
|
BaresipService.isRecOn = !BaresipService.isRecOn
|
||||||
if (BaresipService.isRecOn) {
|
Api.aufilt_enable("sndfile", BaresipService.isRecOn)
|
||||||
Api.module_load("sndfile")
|
|
||||||
} else {
|
|
||||||
Api.module_unload("sndfile")
|
|
||||||
}
|
|
||||||
isRecOn = BaresipService.isRecOn
|
isRecOn = BaresipService.isRecOn
|
||||||
} else {
|
|
||||||
Toast.makeText(ctx, R.string.rec_in_call, Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
Toast.makeText(ctx, R.string.rec_in_call, Toast.LENGTH_SHORT).show()
|
||||||
},
|
},
|
||||||
onLongClick = {
|
onLongClick = {
|
||||||
alertTitle.value = callRecordingTitle
|
alertTitle.value = callRecordingTitle
|
||||||
@@ -591,6 +592,7 @@ private fun TopAppBar(
|
|||||||
modifier = Modifier.size(40.dp)
|
modifier = Modifier.size(40.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.width(22.dp))
|
Spacer(modifier = Modifier.width(22.dp))
|
||||||
|
|
||||||
@@ -1086,6 +1088,7 @@ private fun AccountSpinner(ctx: Context, viewModel: ViewModel, navController: Na
|
|||||||
val ua = UserAgent.ofAor(selected)
|
val ua = UserAgent.ofAor(selected)
|
||||||
if (ua != null) {
|
if (ua != null) {
|
||||||
val acc = ua.account
|
val acc = ua.account
|
||||||
|
if (!acc.isMobile) {
|
||||||
if (Api.account_regint(acc.accp) > 0) {
|
if (Api.account_regint(acc.accp) > 0) {
|
||||||
Api.account_set_regint(acc.accp, 0)
|
Api.account_set_regint(acc.accp, 0)
|
||||||
Api.ua_unregister(ua.uap)
|
Api.ua_unregister(ua.uap)
|
||||||
@@ -1100,6 +1103,7 @@ private fun AccountSpinner(ctx: Context, viewModel: ViewModel, navController: Na
|
|||||||
Account.saveAccounts()
|
Account.saveAccounts()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
colors = ButtonColors(
|
colors = ButtonColors(
|
||||||
@@ -1137,6 +1141,7 @@ private fun AccountSpinner(ctx: Context, viewModel: ViewModel, navController: Na
|
|||||||
val ua = UserAgent.ofAor(selected)
|
val ua = UserAgent.ofAor(selected)
|
||||||
if (ua != null) {
|
if (ua != null) {
|
||||||
val acc = ua.account
|
val acc = ua.account
|
||||||
|
if (!acc.isMobile) {
|
||||||
if (Api.account_regint(acc.accp) > 0) {
|
if (Api.account_regint(acc.accp) > 0) {
|
||||||
Api.account_set_regint(acc.accp, 0)
|
Api.account_set_regint(acc.accp, 0)
|
||||||
Api.ua_unregister(ua.uap)
|
Api.ua_unregister(ua.uap)
|
||||||
@@ -1151,6 +1156,7 @@ private fun AccountSpinner(ctx: Context, viewModel: ViewModel, navController: Na
|
|||||||
Account.saveAccounts()
|
Account.saveAccounts()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
Icon(
|
Icon(
|
||||||
@@ -2249,7 +2255,7 @@ private fun showCall(ctx: Context, viewModel: ViewModel, ua: UserAgent?, showCal
|
|||||||
if (viewModel.isUIRedundant(aor, callp, status, security)) return
|
if (viewModel.isUIRedundant(aor, callp, status, security)) return
|
||||||
|
|
||||||
if (call == null) {
|
if (call == null) {
|
||||||
pullToRefreshEnabled.value = true
|
pullToRefreshEnabled.value = !ua.account.isMobile
|
||||||
viewModel.dialerState.callUri.value = ua.account.resumeUri
|
viewModel.dialerState.callUri.value = ua.account.resumeUri
|
||||||
viewModel.dialerState.callUriLabel.value = ctx.getString(R.string.outgoing_call_to_dots)
|
viewModel.dialerState.callUriLabel.value = ctx.getString(R.string.outgoing_call_to_dots)
|
||||||
Handler(Looper.getMainLooper()).postDelayed({
|
Handler(Looper.getMainLooper()).postDelayed({
|
||||||
|
|||||||
Reference in New Issue
Block a user