Account screen code styling
This commit is contained in:
@ -144,9 +144,7 @@ private fun AccountScreen(
|
|||||||
resumeToggle = System.currentTimeMillis()
|
resumeToggle = System.currentTimeMillis()
|
||||||
}
|
}
|
||||||
lifecycleOwner.lifecycle.addObserver(observer)
|
lifecycleOwner.lifecycle.addObserver(observer)
|
||||||
onDispose {
|
onDispose { lifecycleOwner.lifecycle.removeObserver(observer) }
|
||||||
lifecycleOwner.lifecycle.removeObserver(observer)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var isAccountAvailable by remember { mutableStateOf(false) }
|
var isAccountAvailable by remember { mutableStateOf(false) }
|
||||||
@ -441,9 +439,7 @@ private fun AccountContent(
|
|||||||
else
|
else
|
||||||
PasswordVisualTransformation(),
|
PasswordVisualTransformation(),
|
||||||
trailingIcon = {
|
trailingIcon = {
|
||||||
IconButton(onClick = {
|
IconButton(onClick = { showPassword.value = !showPassword.value }) {
|
||||||
showPassword.value = !showPassword.value
|
|
||||||
}) {
|
|
||||||
Icon(
|
Icon(
|
||||||
if (showPassword.value)
|
if (showPassword.value)
|
||||||
Icons.Filled.Visibility
|
Icons.Filled.Visibility
|
||||||
@ -689,9 +685,7 @@ private fun AccountContent(
|
|||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier.clickable {
|
modifier = Modifier.clickable { isDropDownExpanded.value = true }
|
||||||
isDropDownExpanded.value = true
|
|
||||||
}
|
|
||||||
) {
|
) {
|
||||||
Text(text = mediaEncMap[mediaEnc]!!)
|
Text(text = mediaEncMap[mediaEnc]!!)
|
||||||
Icon(
|
Icon(
|
||||||
@ -702,9 +696,8 @@ private fun AccountContent(
|
|||||||
}
|
}
|
||||||
DropdownMenu(
|
DropdownMenu(
|
||||||
expanded = isDropDownExpanded.value,
|
expanded = isDropDownExpanded.value,
|
||||||
onDismissRequest = {
|
onDismissRequest = { isDropDownExpanded.value = false }
|
||||||
isDropDownExpanded.value = false
|
) {
|
||||||
}) {
|
|
||||||
var index = 0
|
var index = 0
|
||||||
mediaEncMap.forEach {
|
mediaEncMap.forEach {
|
||||||
DropdownMenuItem(text = { Text(text = it.value) },
|
DropdownMenuItem(text = { Text(text = it.value) },
|
||||||
@ -731,7 +724,8 @@ private fun AccountContent(
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
Text(mediaNatTitle,
|
Text(
|
||||||
|
text = mediaNatTitle,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.clickable {
|
.clickable {
|
||||||
@ -747,9 +741,7 @@ private fun AccountContent(
|
|||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier.clickable {
|
modifier = Modifier.clickable { isDropDownExpanded.value = true }
|
||||||
isDropDownExpanded.value = true
|
|
||||||
}
|
|
||||||
) {
|
) {
|
||||||
Text(text = mediaNatMap[mediaNat]!!)
|
Text(text = mediaNatMap[mediaNat]!!)
|
||||||
Icon(
|
Icon(
|
||||||
@ -858,7 +850,7 @@ private fun AccountContent(
|
|||||||
trailingIcon = {
|
trailingIcon = {
|
||||||
IconButton(onClick = { showPassword.value = !showPassword.value }) {
|
IconButton(onClick = { showPassword.value = !showPassword.value }) {
|
||||||
Icon(
|
Icon(
|
||||||
if (showPassword.value)
|
imageVector = if (showPassword.value)
|
||||||
Icons.Filled.Visibility
|
Icons.Filled.Visibility
|
||||||
else
|
else
|
||||||
Icons.Filled.VisibilityOff,
|
Icons.Filled.VisibilityOff,
|
||||||
@ -891,7 +883,8 @@ private fun AccountContent(
|
|||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
val rtcpMux by viewModel.rtcpMux.collectAsState()
|
val rtcpMux by viewModel.rtcpMux.collectAsState()
|
||||||
Text(text = rtcpMuxTitle,
|
Text(
|
||||||
|
text = rtcpMuxTitle,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.clickable {
|
.clickable {
|
||||||
@ -949,10 +942,13 @@ private fun AccountContent(
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
val dtmfModeMap = mapOf(Api.DTMFMODE_RTP_EVENT to dtmfInbandText,
|
val dtmfModeMap = mapOf(
|
||||||
|
Api.DTMFMODE_RTP_EVENT to dtmfInbandText,
|
||||||
Api.DTMFMODE_SIP_INFO to dtmfInfoText,
|
Api.DTMFMODE_SIP_INFO to dtmfInfoText,
|
||||||
Api.DTMFMODE_AUTO to dtmfAutoText)
|
Api.DTMFMODE_AUTO to dtmfAutoText
|
||||||
Text(text = dtmfModeTitle,
|
)
|
||||||
|
Text(
|
||||||
|
text = dtmfModeTitle,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.clickable {
|
.clickable {
|
||||||
@ -1012,8 +1008,7 @@ private fun AccountContent(
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
val answerModeMap = mapOf(Api.ANSWERMODE_MANUAL to manualText,
|
val answerModeMap = mapOf(Api.ANSWERMODE_MANUAL to manualText, Api.ANSWERMODE_AUTO to autoText)
|
||||||
Api.ANSWERMODE_AUTO to autoText)
|
|
||||||
Text(text = answerModeTitle,
|
Text(text = answerModeTitle,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
@ -1068,8 +1063,7 @@ private fun AccountContent(
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
val redirectModeMap = mapOf(false to manualText,
|
val redirectModeMap = mapOf(false to manualText, true to autoText)
|
||||||
true to autoText)
|
|
||||||
Text(text = redirectModeTitle,
|
Text(text = redirectModeTitle,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
@ -1454,8 +1448,7 @@ private fun checkOnClick(ctx: Context, viewModel: AccountViewModel, ua: UserAgen
|
|||||||
val ob = ArrayList<String>()
|
val ob = ArrayList<String>()
|
||||||
var ob1 = viewModel.outbound1.value.trim().replace(" ", "")
|
var ob1 = viewModel.outbound1.value.trim().replace(" ", "")
|
||||||
if (ob1 != "") {
|
if (ob1 != "") {
|
||||||
if (!ob1.startsWith("sip:"))
|
if (!ob1.startsWith("sip:")) ob1 = "sip:$ob1"
|
||||||
ob1 = "sip:$ob1"
|
|
||||||
if (checkOutboundUri(ob1))
|
if (checkOutboundUri(ob1))
|
||||||
ob.add(ob1)
|
ob.add(ob1)
|
||||||
else {
|
else {
|
||||||
@ -1467,8 +1460,7 @@ private fun checkOnClick(ctx: Context, viewModel: AccountViewModel, ua: UserAgen
|
|||||||
}
|
}
|
||||||
var ob2 = viewModel.outbound2.value.trim().replace(" ", "")
|
var ob2 = viewModel.outbound2.value.trim().replace(" ", "")
|
||||||
if (ob2 != "") {
|
if (ob2 != "") {
|
||||||
if (!ob2.startsWith("sip:"))
|
if (!ob2.startsWith("sip:")) ob2 = "sip:$ob2"
|
||||||
ob2 = "sip:$ob2"
|
|
||||||
if (checkOutboundUri(ob2))
|
if (checkOutboundUri(ob2))
|
||||||
ob.add(ob2)
|
ob.add(ob2)
|
||||||
else {
|
else {
|
||||||
@ -1520,10 +1512,8 @@ private fun checkOnClick(ctx: Context, viewModel: AccountViewModel, ua: UserAgen
|
|||||||
reRegister = true
|
reRegister = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else if (regInt != acc.configuredRegInt)
|
||||||
if (regInt != acc.configuredRegInt)
|
|
||||||
acc.configuredRegInt = regInt
|
acc.configuredRegInt = regInt
|
||||||
}
|
|
||||||
|
|
||||||
val newCheckOrigin = viewModel.checkOrigin.value
|
val newCheckOrigin = viewModel.checkOrigin.value
|
||||||
if (newCheckOrigin != acc.checkOrigin) {
|
if (newCheckOrigin != acc.checkOrigin) {
|
||||||
@ -1560,8 +1550,7 @@ private fun checkOnClick(ctx: Context, viewModel: AccountViewModel, ua: UserAgen
|
|||||||
(newMediaNat == "turn" &&
|
(newMediaNat == "turn" &&
|
||||||
newStunServer.substringBefore(":") !in setOf("turn", "turns"))) {
|
newStunServer.substringBefore(":") !in setOf("turn", "turns"))) {
|
||||||
alertTitle.value = ctx.getString(R.string.notice)
|
alertTitle.value = ctx.getString(R.string.notice)
|
||||||
alertMessage.value = String.format(ctx.getString(R.string.invalid_stun_server),
|
alertMessage.value = String.format(ctx.getString(R.string.invalid_stun_server), newStunServer)
|
||||||
newStunServer)
|
|
||||||
showAlert.value = true
|
showAlert.value = true
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -1605,8 +1594,7 @@ private fun checkOnClick(ctx: Context, viewModel: AccountViewModel, ua: UserAgen
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alertTitle.value = noticeTitle
|
alertTitle.value = noticeTitle
|
||||||
alertMessage.value = String.format(ctx.getString(R.string.invalid_stun_password),
|
alertMessage.value = String.format(ctx.getString(R.string.invalid_stun_password), newStunPass)
|
||||||
newStunPass)
|
|
||||||
showAlert.value = true
|
showAlert.value = true
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user