From 13aa104e8a200a6be2c1ffb0e1219c330178721e Mon Sep 17 00:00:00 2001 From: Diogo Date: Thu, 21 Nov 2024 09:49:24 +0000 Subject: [PATCH] var -> val --- .../chat/simplex/common/model/SimpleXAPI.kt | 15 ++++++--------- .../networkAndServers/NetworkAndServers.kt | 8 +++++++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt index 93ef19aeeb..36ee3bb401 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt @@ -3718,8 +3718,8 @@ data class ServerOperator( val tradeName: String, val legalName: String?, val serverDomains: List, - 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, val xftpServers: List ) { 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( diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/NetworkAndServers.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/NetworkAndServers.kt index b7529ece15..13f3d851b8 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/NetworkAndServers.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/NetworkAndServers.kt @@ -739,7 +739,13 @@ fun showUpdateNetworkSettingsDialog( fun updateOperatorsConditionsAcceptance(usvs: MutableState>, updatedOperators: List) { 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 + ) + ) + } } }