Composed account activity alerts
This commit is contained in:
@@ -44,8 +44,10 @@ import androidx.compose.runtime.remember
|
|||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.focus.FocusRequester
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
|
import androidx.compose.ui.platform.LocalFocusManager
|
||||||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||||
import androidx.compose.ui.platform.SoftwareKeyboardController
|
import androidx.compose.ui.platform.SoftwareKeyboardController
|
||||||
import androidx.compose.ui.res.colorResource
|
import androidx.compose.ui.res.colorResource
|
||||||
@@ -60,6 +62,7 @@ import androidx.compose.ui.text.input.VisualTransformation
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.tutpro.baresip.BaresipService.Companion.uas
|
import com.tutpro.baresip.BaresipService.Companion.uas
|
||||||
|
import com.tutpro.baresip.CustomElements.AlertDialog
|
||||||
import com.tutpro.baresip.CustomElements.Checkbox
|
import com.tutpro.baresip.CustomElements.Checkbox
|
||||||
import com.tutpro.baresip.CustomElements.verticalScrollbar
|
import com.tutpro.baresip.CustomElements.verticalScrollbar
|
||||||
|
|
||||||
@@ -124,6 +127,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
private var showPasswordDialog = mutableStateOf(false)
|
private var showPasswordDialog = mutableStateOf(false)
|
||||||
private var keyboardController: SoftwareKeyboardController? = null
|
private var keyboardController: SoftwareKeyboardController? = null
|
||||||
|
|
||||||
|
val alertTitle = mutableStateOf("")
|
||||||
|
val alertMessage = mutableStateOf("")
|
||||||
|
val showAlert = mutableStateOf(false)
|
||||||
|
|
||||||
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
|
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
|
||||||
override fun handleOnBackPressed() {
|
override fun handleOnBackPressed() {
|
||||||
@@ -229,11 +235,25 @@ class AccountActivity : ComponentActivity() {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AccountContent(ctx: Context, contentPadding: PaddingValues) {
|
fun AccountContent(ctx: Context, contentPadding: PaddingValues) {
|
||||||
|
|
||||||
arrowTint = if (BaresipService.darkTheme.value)
|
arrowTint = if (BaresipService.darkTheme.value)
|
||||||
LocalCustomColors.current.grayLight
|
LocalCustomColors.current.grayLight
|
||||||
else
|
else
|
||||||
LocalCustomColors.current.black
|
LocalCustomColors.current.black
|
||||||
|
|
||||||
val scrollState = rememberScrollState()
|
val scrollState = rememberScrollState()
|
||||||
|
|
||||||
|
if (showAlert.value) {
|
||||||
|
AlertDialog(
|
||||||
|
showDialog = showAlert,
|
||||||
|
title = alertTitle.value,
|
||||||
|
message = alertMessage.value,
|
||||||
|
positiveButtonText = stringResource(R.string.ok),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
val focusManager = LocalFocusManager.current
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.imePadding()
|
.imePadding()
|
||||||
@@ -241,7 +261,8 @@ class AccountActivity : ComponentActivity() {
|
|||||||
.padding(contentPadding)
|
.padding(contentPadding)
|
||||||
.padding(start = 16.dp, end = 4.dp, top = 8.dp, bottom = 8.dp)
|
.padding(start = 16.dp, end = 4.dp, top = 8.dp, bottom = 8.dp)
|
||||||
.verticalScrollbar(scrollState)
|
.verticalScrollbar(scrollState)
|
||||||
.verticalScroll(state = scrollState),
|
.verticalScroll(state = scrollState)
|
||||||
|
.clickable { focusManager.clearFocus() },
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
) {
|
) {
|
||||||
oldNickname = acc.nickName.value
|
oldNickname = acc.nickName.value
|
||||||
@@ -272,27 +293,27 @@ class AccountActivity : ComponentActivity() {
|
|||||||
oldTelProvider = acc.telProvider
|
oldTelProvider = acc.telProvider
|
||||||
oldDefaultAccount = UserAgent.findAorIndex(aor)!! == 0
|
oldDefaultAccount = UserAgent.findAorIndex(aor)!! == 0
|
||||||
AoR()
|
AoR()
|
||||||
Nickname(ctx)
|
Nickname()
|
||||||
Displayname(ctx)
|
DisplayName()
|
||||||
AuthUser(ctx)
|
AuthUser()
|
||||||
AuthPass(ctx)
|
AuthPass()
|
||||||
Outbound(ctx)
|
Outbound()
|
||||||
Register(ctx)
|
Register()
|
||||||
RegInt(ctx)
|
RegInt()
|
||||||
AudioCodecs(ctx)
|
AudioCodecs(ctx)
|
||||||
MediaEnc(ctx)
|
MediaEnc()
|
||||||
MediaNat(ctx)
|
MediaNat()
|
||||||
StunServer(ctx)
|
StunServer()
|
||||||
StunUser(ctx)
|
StunUser()
|
||||||
StunPass(ctx)
|
StunPass()
|
||||||
RtcpMux()
|
RtcpMux()
|
||||||
Rel100()
|
Rel100()
|
||||||
Dtmf(ctx)
|
Dtmf()
|
||||||
Answer(ctx)
|
Answer()
|
||||||
Redirect(ctx)
|
Redirect()
|
||||||
Voicemail(ctx)
|
Voicemail()
|
||||||
CountryCode(ctx)
|
CountryCode()
|
||||||
TelProvider(ctx)
|
TelProvider()
|
||||||
DefaultAccount()
|
DefaultAccount()
|
||||||
AskPassword(ctx)
|
AskPassword(ctx)
|
||||||
}
|
}
|
||||||
@@ -301,7 +322,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
@Composable
|
@Composable
|
||||||
private fun AoR() {
|
private fun AoR() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(end=10.dp),
|
Modifier.fillMaxWidth().padding(top=8.dp, end=10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
@@ -320,9 +341,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun Nickname(ctx: Context) {
|
private fun Nickname() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(end=10.dp),
|
Modifier.fillMaxWidth().padding(top=8.dp, end=10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
@@ -337,8 +358,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
Utils.alertView(ctx, getString(R.string.nickname),
|
alertTitle.value = getString(R.string.nickname)
|
||||||
getString(R.string.account_nickname_help)) },
|
alertMessage.value = getString(R.string.account_nickname_help)
|
||||||
|
showAlert.value = true },
|
||||||
textStyle = TextStyle(
|
textStyle = TextStyle(
|
||||||
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
||||||
label = { Text(stringResource(R.string.nickname)) },
|
label = { Text(stringResource(R.string.nickname)) },
|
||||||
@@ -350,9 +372,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun Displayname(ctx: Context) {
|
private fun DisplayName() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(end=10.dp),
|
Modifier.fillMaxWidth().padding(top=8.dp, end=10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
@@ -367,8 +389,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
Utils.alertView(ctx, getString(R.string.display_name),
|
alertTitle.value = getString(R.string.display_name)
|
||||||
getString(R.string.display_name_help)) },
|
alertMessage.value = getString(R.string.display_name_help)
|
||||||
|
showAlert.value = true },
|
||||||
textStyle = TextStyle(
|
textStyle = TextStyle(
|
||||||
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
||||||
label = { Text(stringResource(R.string.display_name)) },
|
label = { Text(stringResource(R.string.display_name)) },
|
||||||
@@ -380,9 +403,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun AuthUser(ctx: Context) {
|
private fun AuthUser() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(end=10.dp),
|
Modifier.fillMaxWidth().padding(top=8.dp, end=10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
@@ -397,8 +420,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
Utils.alertView(ctx, getString(R.string.authentication_username),
|
alertTitle.value = getString(R.string.authentication_username)
|
||||||
getString(R.string.authentication_username_help)) },
|
alertMessage.value = getString(R.string.authentication_username_help)
|
||||||
|
showAlert.value = true },
|
||||||
textStyle = TextStyle(
|
textStyle = TextStyle(
|
||||||
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
||||||
label = { Text(stringResource(R.string.authentication_username)) },
|
label = { Text(stringResource(R.string.authentication_username)) },
|
||||||
@@ -408,10 +432,10 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun AuthPass(ctx: Context) {
|
private fun AuthPass() {
|
||||||
val showPassword = remember { mutableStateOf(false) }
|
val showPassword = remember { mutableStateOf(false) }
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(end=10.dp),
|
Modifier.fillMaxWidth().padding(top=8.dp, end=10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
@@ -446,8 +470,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
Utils.alertView(ctx, getString(R.string.authentication_password),
|
alertTitle.value = getString(R.string.authentication_password)
|
||||||
getString(R.string.authentication_password_help)) },
|
alertMessage.value = getString(R.string.authentication_password_help)
|
||||||
|
showAlert.value = true },
|
||||||
textStyle = TextStyle(
|
textStyle = TextStyle(
|
||||||
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
||||||
label = { Text(stringResource(R.string.authentication_password)) },
|
label = { Text(stringResource(R.string.authentication_password)) },
|
||||||
@@ -457,23 +482,18 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun Outbound(ctx: Context) {
|
private fun Outbound() {
|
||||||
Row(
|
|
||||||
Modifier.fillMaxWidth().padding(end=10.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
horizontalArrangement = Arrangement.Start
|
|
||||||
) {
|
|
||||||
Text(text = stringResource(R.string.outbound_proxies),
|
Text(text = stringResource(R.string.outbound_proxies),
|
||||||
color = LocalCustomColors.current.itemText,
|
color = LocalCustomColors.current.itemText,
|
||||||
modifier = Modifier.clickable {
|
modifier = Modifier.padding(top=8.dp)
|
||||||
Utils.alertView(
|
.clickable {
|
||||||
ctx, getString(R.string.outbound_proxies),
|
alertTitle.value = getString(R.string.outbound_proxies)
|
||||||
getString(R.string.outbound_proxies_help)
|
alertMessage.value = getString(R.string.outbound_proxies_help)
|
||||||
)
|
showAlert.value = true
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
)
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(end=10.dp),
|
Modifier.fillMaxWidth().padding(top=8.dp, end=10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
@@ -495,7 +515,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(end=10.dp),
|
Modifier.fillMaxWidth().padding(top=8.dp, end=10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
@@ -519,7 +539,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Register(ctx: Context) {
|
fun Register() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth(),
|
Modifier.fillMaxWidth(),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
@@ -528,9 +548,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
Text(text = stringResource(R.string.register),
|
Text(text = stringResource(R.string.register),
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
.clickable {
|
.clickable {
|
||||||
Utils.alertView(
|
alertTitle.value = getString(R.string.register)
|
||||||
ctx, getString(R.string.register), getString(R.string.register_help)
|
alertMessage.value = getString(R.string.register_help)
|
||||||
)
|
showAlert.value = true
|
||||||
},
|
},
|
||||||
color = LocalCustomColors.current.itemText)
|
color = LocalCustomColors.current.itemText)
|
||||||
var register by remember { mutableStateOf(oldRegister) }
|
var register by remember { mutableStateOf(oldRegister) }
|
||||||
@@ -546,7 +566,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun RegInt(ctx: Context) {
|
private fun RegInt() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(end=10.dp),
|
Modifier.fillMaxWidth().padding(end=10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
@@ -563,8 +583,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
Utils.alertView(ctx, getString(R.string.reg_int),
|
alertTitle.value = getString(R.string.reg_int)
|
||||||
getString(R.string.reg_int_help)) },
|
alertMessage.value = getString(R.string.reg_int_help)
|
||||||
|
showAlert.value = true },
|
||||||
textStyle = TextStyle(
|
textStyle = TextStyle(
|
||||||
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
||||||
label = { Text(stringResource(R.string.reg_int)) },
|
label = { Text(stringResource(R.string.reg_int)) },
|
||||||
@@ -599,7 +620,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun MediaEnc(ctx: Context) {
|
private fun MediaEnc() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth(),
|
Modifier.fillMaxWidth(),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
@@ -608,8 +629,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
Text(text = stringResource(R.string.media_encryption),
|
Text(text = stringResource(R.string.media_encryption),
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
.clickable {
|
.clickable {
|
||||||
Utils.alertView(ctx, getString(R.string.media_encryption),
|
alertTitle.value = getString(R.string.media_encryption)
|
||||||
getString(R.string.media_encryption_help))
|
alertMessage.value = getString(R.string.media_encryption_help)
|
||||||
|
showAlert.value = true
|
||||||
},
|
},
|
||||||
color = LocalCustomColors.current.itemText,
|
color = LocalCustomColors.current.itemText,
|
||||||
fontSize = 18.sp)
|
fontSize = 18.sp)
|
||||||
@@ -658,7 +680,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun MediaNat(ctx: Context) {
|
private fun MediaNat() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth(),
|
Modifier.fillMaxWidth(),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
@@ -667,8 +689,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
Text(text = stringResource(R.string.media_nat),
|
Text(text = stringResource(R.string.media_nat),
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
.clickable {
|
.clickable {
|
||||||
Utils.alertView(ctx, getString(R.string.media_nat),
|
alertTitle.value = getString(R.string.media_nat)
|
||||||
getString(R.string.media_nat_help))
|
alertMessage.value = getString(R.string.media_nat_help)
|
||||||
|
showAlert.value = true
|
||||||
},
|
},
|
||||||
color = LocalCustomColors.current.itemText,
|
color = LocalCustomColors.current.itemText,
|
||||||
fontSize = 18.sp)
|
fontSize = 18.sp)
|
||||||
@@ -720,7 +743,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun StunServer(ctx: Context) {
|
private fun StunServer() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(end=10.dp),
|
Modifier.fillMaxWidth().padding(end=10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
@@ -737,8 +760,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
Utils.alertView(ctx, getString(R.string.stun_server),
|
alertTitle.value = getString(R.string.stun_server)
|
||||||
getString(R.string.stun_server_help)) },
|
alertMessage.value = getString(R.string.stun_server_help)
|
||||||
|
showAlert.value = true },
|
||||||
textStyle = TextStyle(
|
textStyle = TextStyle(
|
||||||
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
||||||
label = { Text(stringResource(R.string.stun_server)) },
|
label = { Text(stringResource(R.string.stun_server)) },
|
||||||
@@ -748,9 +772,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun StunUser(ctx: Context) {
|
private fun StunUser() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(end=10.dp),
|
Modifier.fillMaxWidth().padding(top=8.dp, end=10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
@@ -765,8 +789,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
Utils.alertView(ctx, getString(R.string.stun_username),
|
alertTitle.value = getString(R.string.stun_username)
|
||||||
getString(R.string.stun_username_help)) },
|
alertMessage.value = getString(R.string.stun_username_help)
|
||||||
|
showAlert.value = true },
|
||||||
textStyle = TextStyle(
|
textStyle = TextStyle(
|
||||||
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
||||||
label = { Text(stringResource(R.string.stun_username)) },
|
label = { Text(stringResource(R.string.stun_username)) },
|
||||||
@@ -776,7 +801,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun StunPass(ctx: Context) {
|
private fun StunPass() {
|
||||||
val showPassword = remember { mutableStateOf(false) }
|
val showPassword = remember { mutableStateOf(false) }
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(end=10.dp),
|
Modifier.fillMaxWidth().padding(end=10.dp),
|
||||||
@@ -818,8 +843,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
Utils.alertView(ctx, getString(R.string.stun_password),
|
alertTitle.value = getString(R.string.stun_password)
|
||||||
getString(R.string.stun_password_help)) },
|
alertMessage.value = getString(R.string.stun_password_help)
|
||||||
|
showAlert.value = true },
|
||||||
textStyle = TextStyle(
|
textStyle = TextStyle(
|
||||||
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
||||||
label = { Text(stringResource(R.string.stun_password)) },
|
label = { Text(stringResource(R.string.stun_password)) },
|
||||||
@@ -836,7 +862,12 @@ class AccountActivity : ComponentActivity() {
|
|||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(R.string.rtcp_mux),
|
Text(text = stringResource(R.string.rtcp_mux),
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f)
|
||||||
|
.clickable {
|
||||||
|
alertTitle.value = getString(R.string.rtcp_mux)
|
||||||
|
alertMessage.value = getString(R.string.rtcp_mux_help)
|
||||||
|
showAlert.value = true
|
||||||
|
},
|
||||||
color = LocalCustomColors.current.itemText)
|
color = LocalCustomColors.current.itemText)
|
||||||
var rtcpMux by remember { mutableStateOf(oldRtcpMux) }
|
var rtcpMux by remember { mutableStateOf(oldRtcpMux) }
|
||||||
newRtcpMux = rtcpMux
|
newRtcpMux = rtcpMux
|
||||||
@@ -857,8 +888,13 @@ class AccountActivity : ComponentActivity() {
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(R.string.rtcp_mux),
|
Text(text = stringResource(R.string.rel_100),
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f)
|
||||||
|
.clickable {
|
||||||
|
alertTitle.value = getString(R.string.rel_100)
|
||||||
|
alertMessage.value = getString(R.string.rel_100_help)
|
||||||
|
showAlert.value = true
|
||||||
|
},
|
||||||
color = LocalCustomColors.current.itemText)
|
color = LocalCustomColors.current.itemText)
|
||||||
var rel100 by remember { mutableStateOf(old100Rel) }
|
var rel100 by remember { mutableStateOf(old100Rel) }
|
||||||
new100Rel = rel100
|
new100Rel = rel100
|
||||||
@@ -873,7 +909,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun Dtmf(ctx: Context) {
|
private fun Dtmf() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(top=12.dp),
|
Modifier.fillMaxWidth().padding(top=12.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
@@ -882,8 +918,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
Text(text = stringResource(R.string.dtmf_mode),
|
Text(text = stringResource(R.string.dtmf_mode),
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
.clickable {
|
.clickable {
|
||||||
Utils.alertView(ctx, getString(R.string.dtmf_mode),
|
alertTitle.value = getString(R.string.dtmf_mode)
|
||||||
getString(R.string.dtmf_mode_help))
|
alertMessage.value = getString(R.string.dtmf_mode_help)
|
||||||
|
showAlert.value = true
|
||||||
},
|
},
|
||||||
color = LocalCustomColors.current.itemText,
|
color = LocalCustomColors.current.itemText,
|
||||||
fontSize = 18.sp)
|
fontSize = 18.sp)
|
||||||
@@ -933,7 +970,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun Answer(ctx: Context) {
|
private fun Answer() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(top=12.dp),
|
Modifier.fillMaxWidth().padding(top=12.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
@@ -942,8 +979,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
Text(text = stringResource(R.string.answer_mode),
|
Text(text = stringResource(R.string.answer_mode),
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
.clickable {
|
.clickable {
|
||||||
Utils.alertView(ctx, getString(R.string.answer_mode),
|
alertTitle.value = getString(R.string.answer_mode)
|
||||||
getString(R.string.answer_mode_help))
|
alertMessage.value = getString(R.string.answer_mode_help)
|
||||||
|
showAlert.value = true
|
||||||
},
|
},
|
||||||
color = LocalCustomColors.current.itemText,
|
color = LocalCustomColors.current.itemText,
|
||||||
fontSize = 18.sp)
|
fontSize = 18.sp)
|
||||||
@@ -991,7 +1029,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun Redirect(ctx: Context) {
|
private fun Redirect() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(top=12.dp),
|
Modifier.fillMaxWidth().padding(top=12.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
@@ -1000,8 +1038,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
Text(text = stringResource(R.string.redirect_mode),
|
Text(text = stringResource(R.string.redirect_mode),
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
.clickable {
|
.clickable {
|
||||||
Utils.alertView(ctx, getString(R.string.redirect_mode),
|
alertTitle.value = getString(R.string.redirect_mode)
|
||||||
getString(R.string.redirect_mode_help))
|
alertMessage.value = getString(R.string.redirect_mode_help)
|
||||||
|
showAlert.value = true
|
||||||
},
|
},
|
||||||
color = LocalCustomColors.current.itemText,
|
color = LocalCustomColors.current.itemText,
|
||||||
fontSize = 18.sp)
|
fontSize = 18.sp)
|
||||||
@@ -1051,7 +1090,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun Voicemail(ctx: Context) {
|
private fun Voicemail() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(end=10.dp),
|
Modifier.fillMaxWidth().padding(end=10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
@@ -1068,8 +1107,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
Utils.alertView(ctx, getString(R.string.voicemail_uri),
|
alertTitle.value = getString(R.string.voicemail_uri)
|
||||||
getString(R.string.voicemain_uri_help)) },
|
alertMessage.value = getString(R.string.voicemain_uri_help)
|
||||||
|
showAlert.value = true },
|
||||||
textStyle = TextStyle(
|
textStyle = TextStyle(
|
||||||
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
||||||
label = { Text(stringResource(R.string.voicemail_uri)) },
|
label = { Text(stringResource(R.string.voicemail_uri)) },
|
||||||
@@ -1079,9 +1119,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun CountryCode(ctx: Context) {
|
private fun CountryCode() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(end=10.dp),
|
Modifier.fillMaxWidth().padding(top=8.dp, end=10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
@@ -1096,8 +1136,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
Utils.alertView(ctx, getString(R.string.country_code),
|
alertTitle.value = getString(R.string.country_code)
|
||||||
getString(R.string.country_code_help)) },
|
alertMessage.value = getString(R.string.country_code_help)
|
||||||
|
showAlert.value = true },
|
||||||
textStyle = TextStyle(
|
textStyle = TextStyle(
|
||||||
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
||||||
label = { Text(stringResource(R.string.country_code)) },
|
label = { Text(stringResource(R.string.country_code)) },
|
||||||
@@ -1107,9 +1148,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun TelProvider(ctx: Context) {
|
private fun TelProvider() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(end=10.dp),
|
Modifier.fillMaxWidth().padding(top=8.dp, end=10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
@@ -1124,8 +1165,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
Utils.alertView(ctx, getString(R.string.telephony_provider),
|
alertTitle.value = getString(R.string.telephony_provider)
|
||||||
getString(R.string.telephony_provider_help)) },
|
alertMessage.value = getString(R.string.telephony_provider_help)
|
||||||
|
showAlert.value = true },
|
||||||
textStyle = TextStyle(
|
textStyle = TextStyle(
|
||||||
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
||||||
label = { Text(stringResource(R.string.telephony_provider)) },
|
label = { Text(stringResource(R.string.telephony_provider)) },
|
||||||
@@ -1142,7 +1184,11 @@ class AccountActivity : ComponentActivity() {
|
|||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(R.string.default_account),
|
Text(text = stringResource(R.string.default_account),
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f)
|
||||||
|
.clickable {
|
||||||
|
alertTitle.value = getString(R.string.default_account)
|
||||||
|
alertMessage.value = getString(R.string.default_account_help)
|
||||||
|
showAlert.value = true },
|
||||||
color = LocalCustomColors.current.itemText)
|
color = LocalCustomColors.current.itemText)
|
||||||
var defaultAccount by remember { mutableStateOf(oldDefaultAccount) }
|
var defaultAccount by remember { mutableStateOf(oldDefaultAccount) }
|
||||||
newDefaultAccount = defaultAccount
|
newDefaultAccount = defaultAccount
|
||||||
@@ -1193,14 +1239,18 @@ class AccountActivity : ComponentActivity() {
|
|||||||
if (nn == "" || Account.uniqueNickName(nn)) {
|
if (nn == "" || Account.uniqueNickName(nn)) {
|
||||||
acc.nickName.value = nn
|
acc.nickName.value = nn
|
||||||
Log.d(TAG, "New nickname is ${acc.nickName.value}")
|
Log.d(TAG, "New nickname is ${acc.nickName.value}")
|
||||||
} else {
|
}
|
||||||
Utils.alertView(this, getString(R.string.notice),
|
else {
|
||||||
String.format(getString(R.string.non_unique_account_nickname), nn))
|
alertTitle.value = getString(R.string.notice)
|
||||||
|
alertMessage.value = String.format(getString(R.string.non_unique_account_nickname), nn)
|
||||||
|
showAlert.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
Utils.alertView(this, getString(R.string.notice),
|
else {
|
||||||
String.format(getString(R.string.invalid_account_nickname), nn))
|
alertTitle.value = getString(R.string.notice)
|
||||||
|
alertMessage.value = String.format(getString(R.string.invalid_account_nickname), nn)
|
||||||
|
showAlert.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1214,9 +1264,11 @@ class AccountActivity : ComponentActivity() {
|
|||||||
} else {
|
} else {
|
||||||
Log.e(TAG, "Setting of display name failed")
|
Log.e(TAG, "Setting of display name failed")
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
Utils.alertView(this, getString(R.string.notice),
|
else {
|
||||||
String.format(getString(R.string.invalid_display_name), dn))
|
alertTitle.value = getString(R.string.notice)
|
||||||
|
alertMessage.value = String.format(getString(R.string.invalid_display_name), dn)
|
||||||
|
showAlert.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1229,12 +1281,15 @@ class AccountActivity : ComponentActivity() {
|
|||||||
Log.d(TAG, "New auth user is ${acc.authUser}")
|
Log.d(TAG, "New auth user is ${acc.authUser}")
|
||||||
if (acc.regint > 0)
|
if (acc.regint > 0)
|
||||||
reRegister = true
|
reRegister = true
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Log.e(TAG, "Setting of auth user failed")
|
Log.e(TAG, "Setting of auth user failed")
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
Utils.alertView(this, getString(R.string.notice),
|
else {
|
||||||
String.format(getString(R.string.invalid_authentication_username), au))
|
alertTitle.value = getString(R.string.notice)
|
||||||
|
alertMessage.value = String.format(getString(R.string.invalid_authentication_username), au)
|
||||||
|
showAlert.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1247,20 +1302,22 @@ class AccountActivity : ComponentActivity() {
|
|||||||
acc.authPass = Api.account_auth_pass(acc.accp)
|
acc.authPass = Api.account_auth_pass(acc.accp)
|
||||||
if (acc.regint > 0)
|
if (acc.regint > 0)
|
||||||
reRegister = true
|
reRegister = true
|
||||||
} else {
|
|
||||||
Log.e(TAG, "Setting of auth pass failed")
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
Log.e(TAG, "Setting of auth pass failed")
|
||||||
BaresipService.aorPasswords.remove(acc.aor)
|
BaresipService.aorPasswords.remove(acc.aor)
|
||||||
} else {
|
}
|
||||||
Utils.alertView(this, getString(R.string.notice),
|
else {
|
||||||
String.format(getString(R.string.invalid_authentication_password), ap))
|
alertTitle.value = getString(R.string.notice)
|
||||||
|
alertMessage.value = String.format(getString(R.string.invalid_authentication_password), ap)
|
||||||
|
showAlert.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
BaresipService.aorPasswords.remove(acc.aor)
|
BaresipService.aorPasswords.remove(acc.aor)
|
||||||
}
|
}
|
||||||
} else { // ap == ""
|
else { // ap == ""
|
||||||
if (acc.authPass != NO_AUTH_PASS &&
|
if (acc.authPass != NO_AUTH_PASS &&
|
||||||
acc.authPass != BaresipService.aorPasswords[acc.aor])
|
acc.authPass != BaresipService.aorPasswords[acc.aor])
|
||||||
if (Api.account_set_auth_pass(acc.accp, "") == 0) {
|
if (Api.account_set_auth_pass(acc.accp, "") == 0) {
|
||||||
@@ -1276,9 +1333,11 @@ class AccountActivity : ComponentActivity() {
|
|||||||
ob1 = "sip:$ob1"
|
ob1 = "sip:$ob1"
|
||||||
if (checkOutboundUri(ob1)) {
|
if (checkOutboundUri(ob1)) {
|
||||||
ob.add(ob1)
|
ob.add(ob1)
|
||||||
} else {
|
}
|
||||||
Utils.alertView(this, getString(R.string.notice),
|
else {
|
||||||
String.format(getString(R.string.invalid_proxy_server_uri), ob1))
|
alertTitle.value = getString(R.string.notice)
|
||||||
|
alertMessage.value = String.format(getString(R.string.invalid_proxy_server_uri), ob1)
|
||||||
|
showAlert.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1286,11 +1345,12 @@ class AccountActivity : ComponentActivity() {
|
|||||||
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 {
|
||||||
Utils.alertView(this, getString(R.string.notice),
|
alertTitle.value = getString(R.string.notice)
|
||||||
String.format(getString(R.string.invalid_proxy_server_uri), ob2))
|
alertMessage.value = String.format(getString(R.string.invalid_proxy_server_uri), ob2)
|
||||||
|
showAlert.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1315,10 +1375,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
|
|
||||||
val regInt = newRegInt.trim().toInt()
|
val regInt = newRegInt.trim().toInt()
|
||||||
if (regInt < 60 || regInt > 3600) {
|
if (regInt < 60 || regInt > 3600) {
|
||||||
Utils.alertView(
|
alertTitle.value = getString(R.string.notice)
|
||||||
this, getString(R.string.notice),
|
alertMessage.value = String.format(getString(R.string.invalid_reg_int), "$regInt")
|
||||||
String.format(getString(R.string.invalid_reg_int), "$regInt")
|
showAlert.value = true
|
||||||
)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val reReg = (newRegister != acc.regint > 0) ||
|
val reReg = (newRegister != acc.regint > 0) ||
|
||||||
@@ -1365,8 +1424,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
if (!Utils.checkStunUri(newStunServer) ||
|
if (!Utils.checkStunUri(newStunServer) ||
|
||||||
(newMediaNat == "turn" &&
|
(newMediaNat == "turn" &&
|
||||||
newStunServer.substringBefore(":") !in setOf("turn", "turns"))) {
|
newStunServer.substringBefore(":") !in setOf("turn", "turns"))) {
|
||||||
Utils.alertView(this, getString(R.string.notice),
|
alertTitle.value = getString(R.string.notice)
|
||||||
String.format(getString(R.string.invalid_stun_server), newStunServer))
|
alertMessage.value = String.format(getString(R.string.invalid_stun_server), newStunServer)
|
||||||
|
showAlert.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1386,12 +1446,14 @@ class AccountActivity : ComponentActivity() {
|
|||||||
if (Api.account_set_stun_user(acc.accp, newStunUser) == 0) {
|
if (Api.account_set_stun_user(acc.accp, newStunUser) == 0) {
|
||||||
acc.stunUser = Api.account_stun_user(acc.accp)
|
acc.stunUser = Api.account_stun_user(acc.accp)
|
||||||
Log.d(TAG, "New STUN/TURN user is ${acc.stunUser}")
|
Log.d(TAG, "New STUN/TURN user is ${acc.stunUser}")
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
Log.e(TAG, "Setting of STUN/TURN user failed")
|
Log.e(TAG, "Setting of STUN/TURN user failed")
|
||||||
}
|
}
|
||||||
} else {
|
else {
|
||||||
Utils.alertView(this, getString(R.string.notice), String.format(getString(R.string.invalid_stun_username),
|
alertTitle.value = getString(R.string.notice)
|
||||||
newStunUser))
|
alertMessage.value = String.format(getString(R.string.invalid_stun_username), newStunUser)
|
||||||
|
showAlert.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1399,14 +1461,15 @@ class AccountActivity : ComponentActivity() {
|
|||||||
val newStunPass = newStunPass.trim()
|
val newStunPass = newStunPass.trim()
|
||||||
if (acc.stunPass != newStunPass) {
|
if (acc.stunPass != newStunPass) {
|
||||||
if (newStunPass.isEmpty() || Account.checkAuthPass(newStunPass)) {
|
if (newStunPass.isEmpty() || Account.checkAuthPass(newStunPass)) {
|
||||||
if (Api.account_set_stun_pass(acc.accp, newStunPass) == 0) {
|
if (Api.account_set_stun_pass(acc.accp, newStunPass) == 0)
|
||||||
acc.stunPass = Api.account_stun_pass(acc.accp)
|
acc.stunPass = Api.account_stun_pass(acc.accp)
|
||||||
} else {
|
else
|
||||||
Log.e(TAG, "Setting of stun pass failed")
|
Log.e(TAG, "Setting of stun pass failed")
|
||||||
}
|
}
|
||||||
} else {
|
else {
|
||||||
Utils.alertView(this, getString(R.string.notice),
|
alertTitle.value = getString(R.string.notice)
|
||||||
String.format(getString(R.string.invalid_stun_password), newStunPass))
|
alertMessage.value = String.format(getString(R.string.invalid_stun_password), newStunPass)
|
||||||
|
showAlert.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1460,14 +1523,15 @@ class AccountActivity : ComponentActivity() {
|
|||||||
if (!newVmUri.startsWith("sip:")) newVmUri = "sip:$newVmUri"
|
if (!newVmUri.startsWith("sip:")) newVmUri = "sip:$newVmUri"
|
||||||
if (!newVmUri.contains("@")) newVmUri = "$newVmUri@${acc.host()}"
|
if (!newVmUri.contains("@")) newVmUri = "$newVmUri@${acc.host()}"
|
||||||
if (!Utils.checkUri(newVmUri)) {
|
if (!Utils.checkUri(newVmUri)) {
|
||||||
Utils.alertView(this, getString(R.string.notice),
|
alertTitle.value = getString(R.string.notice)
|
||||||
String.format(getString(R.string.invalid_sip_or_tel_uri), newVmUri))
|
alertMessage.value = String.format(getString(R.string.invalid_sip_or_tel_uri), newVmUri)
|
||||||
|
showAlert.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Api.account_set_mwi(acc.accp, true)
|
Api.account_set_mwi(acc.accp, true)
|
||||||
} else {
|
|
||||||
Api.account_set_mwi(acc.accp, false)
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
Api.account_set_mwi(acc.accp, false)
|
||||||
acc.vmUri = newVmUri
|
acc.vmUri = newVmUri
|
||||||
Log.d(TAG, "New voicemail URI is ${acc.vmUri}")
|
Log.d(TAG, "New voicemail URI is ${acc.vmUri}")
|
||||||
}
|
}
|
||||||
@@ -1475,8 +1539,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
newCountryCode = newCountryCode.trim()
|
newCountryCode = newCountryCode.trim()
|
||||||
if (newCountryCode != acc.countryCode) {
|
if (newCountryCode != acc.countryCode) {
|
||||||
if (newCountryCode != "" && !Utils.checkCountryCode(newCountryCode)) {
|
if (newCountryCode != "" && !Utils.checkCountryCode(newCountryCode)) {
|
||||||
Utils.alertView(this, getString(R.string.notice),
|
alertTitle.value = getString(R.string.notice)
|
||||||
String.format(getString(R.string.invalid_country_code), newCountryCode))
|
alertMessage.value = String.format(getString(R.string.invalid_country_code), newCountryCode)
|
||||||
|
showAlert.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
acc.countryCode = newCountryCode
|
acc.countryCode = newCountryCode
|
||||||
@@ -1486,8 +1551,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
val hostPart = newTelProvider.trim()
|
val hostPart = newTelProvider.trim()
|
||||||
if (hostPart != acc.telProvider) {
|
if (hostPart != acc.telProvider) {
|
||||||
if (hostPart != "" && !Utils.checkHostPortParams(hostPart)) {
|
if (hostPart != "" && !Utils.checkHostPortParams(hostPart)) {
|
||||||
Utils.alertView(this, getString(R.string.notice),
|
alertTitle.value = getString(R.string.notice)
|
||||||
String.format(getString(R.string.invalid_sip_uri_hostpart), hostPart))
|
alertMessage.value = String.format(getString(R.string.invalid_sip_uri_hostpart), hostPart)
|
||||||
|
showAlert.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
acc.telProvider = hostPart
|
acc.telProvider = hostPart
|
||||||
|
|||||||
Reference in New Issue
Block a user