Retain value of account's Check Origin when Register is toggled
This commit is contained in:
@ -1454,20 +1454,11 @@ private fun checkOnClick(ctx: Context, viewModel: AccountViewModel, ua: UserAgen
|
||||
acc.configuredRegInt = regInt
|
||||
}
|
||||
|
||||
if (acc.regint == 0)
|
||||
Api.account_set_check_origin(ua.account.accp, false)
|
||||
else
|
||||
Api.account_set_check_origin(ua.account.accp, viewModel.checkOrigin.value)
|
||||
acc.checkOrigin = Api.account_check_origin(ua.account.accp)
|
||||
|
||||
val newMediaEnc = viewModel.mediaEnc.value
|
||||
if (newMediaEnc != acc.mediaEnc) {
|
||||
if (Api.account_set_mediaenc(acc.accp, newMediaEnc) == 0) {
|
||||
acc.mediaEnc = Api.account_mediaenc(acc.accp)
|
||||
Log.d(TAG, "New mediaenc is ${acc.mediaEnc}")
|
||||
}
|
||||
else
|
||||
Log.e(TAG, "Setting of mediaenc $newMediaEnc failed")
|
||||
val newCheckOrigin = viewModel.checkOrigin.value
|
||||
if (newCheckOrigin != acc.checkOrigin) {
|
||||
Api.account_set_check_origin(ua.account.accp, newCheckOrigin)
|
||||
acc.checkOrigin = Api.account_check_origin(ua.account.accp)
|
||||
Log.d(TAG, "New checkOrigin is ${acc.checkOrigin}")
|
||||
}
|
||||
|
||||
val newMediaNat = viewModel.mediaNat.value
|
||||
|
||||
@ -13,7 +13,7 @@ class AccountViewModel: ViewModel() {
|
||||
val outbound2 = MutableStateFlow("")
|
||||
val register = MutableStateFlow(false)
|
||||
val regInt = MutableStateFlow("")
|
||||
val checkOrigin = MutableStateFlow(false)
|
||||
val checkOrigin = MutableStateFlow(true)
|
||||
val mediaEnc = MutableStateFlow("")
|
||||
val mediaNat = MutableStateFlow("")
|
||||
val stunServer = MutableStateFlow("")
|
||||
|
||||
Reference in New Issue
Block a user