var -> val

This commit is contained in:
Diogo
2024-11-21 09:49:24 +00:00
parent 8ef8cf0776
commit 13aa104e8a
2 changed files with 13 additions and 10 deletions
@@ -3718,8 +3718,8 @@ data class ServerOperator(
val tradeName: String,
val legalName: String?,
val serverDomains: List<String>,
var conditionsAcceptance: ConditionsAcceptance,
var enabled: Boolean,
val conditionsAcceptance: ConditionsAcceptance,
val enabled: Boolean,
val smpRoles: ServerRoles,
val xftpRoles: ServerRoles,
) {
@@ -3821,20 +3821,20 @@ data class ServerOperator(
@Serializable
data class ServerRoles(
var storage: Boolean,
var proxy: Boolean
val storage: Boolean,
val proxy: Boolean
)
@Serializable
data class UserOperatorServers(
var operator: ServerOperator?,
val operator: ServerOperator?,
val smpServers: List<UserServer>,
val xftpServers: List<UserServer>
) {
val id: String
get() = operator?.operatorId?.toString() ?: "nil operator"
var operator_: ServerOperator
val operator_: ServerOperator
get() = operator ?: ServerOperator(
operatorId = 0,
operatorTag = null,
@@ -3846,9 +3846,6 @@ data class UserOperatorServers(
smpRoles = ServerRoles(storage = true, proxy = true),
xftpRoles = ServerRoles(storage = true, proxy = true)
)
set(value) {
operator = value
}
companion object {
val sampleData1 = UserOperatorServers(
@@ -739,7 +739,13 @@ fun showUpdateNetworkSettingsDialog(
fun updateOperatorsConditionsAcceptance(usvs: MutableState<List<UserOperatorServers>>, updatedOperators: List<ServerOperator>) {
for (i in usvs.value.indices) {
val updatedOperator = updatedOperators.firstOrNull { it.operatorId == usvs.value[i].operator?.operatorId } ?: continue
usvs.value[i].operator?.conditionsAcceptance = updatedOperator.conditionsAcceptance
usvs.value = usvs.value.toMutableList().apply {
this[i] = this[i].copy(
operator = this[i].operator?.copy(
conditionsAcceptance = updatedOperator.conditionsAcceptance
)
)
}
}
}