Immutable data class. var -> val
This commit is contained in:
parent
7773b75834
commit
015438289e
|
@ -24,8 +24,8 @@ import kotlinx.parcelize.Parcelize
|
||||||
*/
|
*/
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data class LocalizedFlowDataLoginTerms(
|
data class LocalizedFlowDataLoginTerms(
|
||||||
var policyName: String? = null,
|
val policyName: String?,
|
||||||
var version: String? = null,
|
val version: String?,
|
||||||
var localizedUrl: String? = null,
|
val localizedUrl: String?,
|
||||||
var localizedName: String? = null
|
val localizedName: String?
|
||||||
) : Parcelable
|
) : Parcelable
|
||||||
|
|
|
@ -22,12 +22,12 @@ import org.matrix.android.sdk.internal.crypto.model.CryptoInfo
|
||||||
data class CryptoDeviceInfo(
|
data class CryptoDeviceInfo(
|
||||||
val deviceId: String,
|
val deviceId: String,
|
||||||
override val userId: String,
|
override val userId: String,
|
||||||
var algorithms: List<String>? = null,
|
val algorithms: List<String>? = null,
|
||||||
override val keys: Map<String, String>? = null,
|
override val keys: Map<String, String>? = null,
|
||||||
override val signatures: Map<String, Map<String, String>>? = null,
|
override val signatures: Map<String, Map<String, String>>? = null,
|
||||||
val unsigned: UnsignedDeviceInfo? = null,
|
val unsigned: UnsignedDeviceInfo? = null,
|
||||||
var trustLevel: DeviceTrustLevel? = null,
|
var trustLevel: DeviceTrustLevel? = null,
|
||||||
var isBlocked: Boolean = false,
|
val isBlocked: Boolean = false,
|
||||||
val firstTimeSeenLocalTs: Long? = null
|
val firstTimeSeenLocalTs: Long? = null
|
||||||
) : CryptoInfo {
|
) : CryptoInfo {
|
||||||
|
|
||||||
|
|
|
@ -25,14 +25,14 @@ import org.matrix.android.sdk.internal.crypto.OutgoingGossipingRequest
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class OutgoingRoomKeyRequest(
|
data class OutgoingRoomKeyRequest(
|
||||||
// RequestBody
|
// RequestBody
|
||||||
var requestBody: RoomKeyRequestBody?,
|
val requestBody: RoomKeyRequestBody?,
|
||||||
// list of recipients for the request
|
// list of recipients for the request
|
||||||
override var recipients: Map<String, List<String>>,
|
override val recipients: Map<String, List<String>>,
|
||||||
// Unique id for this request. Used for both
|
// Unique id for this request. Used for both
|
||||||
// an id within the request for later pairing with a cancellation, and for
|
// an id within the request for later pairing with a cancellation, and for
|
||||||
// the transaction id when sending the to_device messages to our local
|
// the transaction id when sending the to_device messages to our local
|
||||||
override var requestId: String, // current state of this request
|
override val requestId: String, // current state of this request
|
||||||
override var state: OutgoingGossipingRequestState
|
override val state: OutgoingGossipingRequestState
|
||||||
// transaction id for the cancellation, if any
|
// transaction id for the cancellation, if any
|
||||||
// override var cancellationTxnId: String? = null
|
// override var cancellationTxnId: String? = null
|
||||||
) : OutgoingGossipingRequest {
|
) : OutgoingGossipingRequest {
|
||||||
|
@ -43,9 +43,7 @@ data class OutgoingRoomKeyRequest(
|
||||||
* @return the room id.
|
* @return the room id.
|
||||||
*/
|
*/
|
||||||
val roomId: String?
|
val roomId: String?
|
||||||
get() = if (null != requestBody) {
|
get() = requestBody?.roomId
|
||||||
requestBody!!.roomId
|
|
||||||
} else null
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used only for log.
|
* Used only for log.
|
||||||
|
@ -53,7 +51,5 @@ data class OutgoingRoomKeyRequest(
|
||||||
* @return the session id
|
* @return the session id
|
||||||
*/
|
*/
|
||||||
val sessionId: String?
|
val sessionId: String?
|
||||||
get() = if (null != requestBody) {
|
get() = requestBody?.sessionId
|
||||||
requestBody!!.sessionId
|
|
||||||
} else null
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
package org.matrix.android.sdk.api.session.room.model
|
package org.matrix.android.sdk.api.session.room.model
|
||||||
|
|
||||||
data class EventAnnotationsSummary(
|
data class EventAnnotationsSummary(
|
||||||
var eventId: String,
|
val eventId: String,
|
||||||
var reactionsSummary: List<ReactionAggregatedSummary> = emptyList(),
|
val reactionsSummary: List<ReactionAggregatedSummary> = emptyList(),
|
||||||
var editSummary: EditAggregatedSummary? = null,
|
val editSummary: EditAggregatedSummary? = null,
|
||||||
var pollResponseSummary: PollResponseAggregatedSummary? = null,
|
val pollResponseSummary: PollResponseAggregatedSummary? = null,
|
||||||
var referencesAggregatedSummary: ReferencesAggregatedSummary? = null
|
val referencesAggregatedSummary: ReferencesAggregatedSummary? = null
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,13 +16,11 @@
|
||||||
package org.matrix.android.sdk.api.session.room.model
|
package org.matrix.android.sdk.api.session.room.model
|
||||||
|
|
||||||
data class PollResponseAggregatedSummary(
|
data class PollResponseAggregatedSummary(
|
||||||
|
val aggregatedContent: PollSummaryContent? = null,
|
||||||
var aggregatedContent: PollSummaryContent? = null,
|
|
||||||
|
|
||||||
// If set the poll is closed (Clients SHOULD NOT consider responses after the close event)
|
// If set the poll is closed (Clients SHOULD NOT consider responses after the close event)
|
||||||
var closedTime: Long? = null,
|
val closedTime: Long? = null,
|
||||||
// Clients SHOULD validate that the option in the relationship is a valid option, and ignore the response if invalid
|
// Clients SHOULD validate that the option in the relationship is a valid option, and ignore the response if invalid
|
||||||
var nbOptions: Int = 0,
|
val nbOptions: Int = 0,
|
||||||
// The list of the eventIDs used to build the summary (might be out of sync if chunked received from message chunk)
|
// The list of the eventIDs used to build the summary (might be out of sync if chunked received from message chunk)
|
||||||
val sourceEvents: List<String>,
|
val sourceEvents: List<String>,
|
||||||
val localEchos: List<String>
|
val localEchos: List<String>
|
||||||
|
|
|
@ -56,7 +56,7 @@ data class TimelineEvent(
|
||||||
* It's not unique on the timeline as it's reset on each chunk.
|
* It's not unique on the timeline as it's reset on each chunk.
|
||||||
*/
|
*/
|
||||||
val displayIndex: Int,
|
val displayIndex: Int,
|
||||||
var ownedByThreadChunk: Boolean = false,
|
val ownedByThreadChunk: Boolean = false,
|
||||||
val senderInfo: SenderInfo,
|
val senderInfo: SenderInfo,
|
||||||
val annotations: EventAnnotationsSummary? = null,
|
val annotations: EventAnnotationsSummary? = null,
|
||||||
val readReceipts: List<ReadReceipt> = emptyList()
|
val readReceipts: List<ReadReceipt> = emptyList()
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.matrix.android.sdk.api.session.securestorage
|
||||||
|
|
||||||
data class SsssKeyCreationInfo(
|
data class SsssKeyCreationInfo(
|
||||||
val keyId: String = "",
|
val keyId: String = "",
|
||||||
var content: SecretStorageKeyContent?,
|
val content: SecretStorageKeyContent?,
|
||||||
val recoveryKey: String = "",
|
val recoveryKey: String = "",
|
||||||
val keySpec: SsssKeySpec
|
val keySpec: SsssKeySpec
|
||||||
)
|
)
|
||||||
|
|
|
@ -29,7 +29,7 @@ data class ThreadDetails(
|
||||||
val threadSummarySenderInfo: SenderInfo? = null,
|
val threadSummarySenderInfo: SenderInfo? = null,
|
||||||
val threadSummaryLatestEvent: Event? = null,
|
val threadSummaryLatestEvent: Event? = null,
|
||||||
val lastMessageTimestamp: Long? = null,
|
val lastMessageTimestamp: Long? = null,
|
||||||
var threadNotificationState: ThreadNotificationState = ThreadNotificationState.NO_NEW_MESSAGE,
|
val threadNotificationState: ThreadNotificationState = ThreadNotificationState.NO_NEW_MESSAGE,
|
||||||
val isThread: Boolean = false,
|
val isThread: Boolean = false,
|
||||||
val lastRootThreadEdition: String? = null
|
val lastRootThreadEdition: String? = null
|
||||||
)
|
)
|
||||||
|
|
|
@ -19,9 +19,9 @@ package org.matrix.android.sdk.internal.crypto
|
||||||
import org.matrix.android.sdk.api.session.crypto.model.OutgoingGossipingRequestState
|
import org.matrix.android.sdk.api.session.crypto.model.OutgoingGossipingRequestState
|
||||||
|
|
||||||
internal interface OutgoingGossipingRequest {
|
internal interface OutgoingGossipingRequest {
|
||||||
var recipients: Map<String, List<String>>
|
val recipients: Map<String, List<String>>
|
||||||
var requestId: String
|
val requestId: String
|
||||||
var state: OutgoingGossipingRequestState
|
val state: OutgoingGossipingRequestState
|
||||||
// transaction id for the cancellation, if any
|
// transaction id for the cancellation, if any
|
||||||
// var cancellationTxnId: String?
|
// var cancellationTxnId: String?
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,17 +30,17 @@ internal data class BindThreePidBody(
|
||||||
* Required. The identity server to use. (without "https://")
|
* Required. The identity server to use. (without "https://")
|
||||||
*/
|
*/
|
||||||
@Json(name = "id_server")
|
@Json(name = "id_server")
|
||||||
var identityServerUrlWithoutProtocol: String,
|
val identityServerUrlWithoutProtocol: String,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Required. An access token previously registered with the identity server.
|
* Required. An access token previously registered with the identity server.
|
||||||
*/
|
*/
|
||||||
@Json(name = "id_access_token")
|
@Json(name = "id_access_token")
|
||||||
var identityServerAccessToken: String,
|
val identityServerAccessToken: String,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Required. The session identifier given by the identity server.
|
* Required. The session identifier given by the identity server.
|
||||||
*/
|
*/
|
||||||
@Json(name = "sid")
|
@Json(name = "sid")
|
||||||
var sid: String
|
val sid: String
|
||||||
)
|
)
|
||||||
|
|
|
@ -48,15 +48,17 @@ fun TermPolicies.toLocalizedLoginTerms(userLanguage: String,
|
||||||
val policies = get("policies")
|
val policies = get("policies")
|
||||||
if (policies is Map<*, *>) {
|
if (policies is Map<*, *>) {
|
||||||
policies.keys.forEach { policyName ->
|
policies.keys.forEach { policyName ->
|
||||||
val localizedFlowDataLoginTerms = LocalizedFlowDataLoginTerms()
|
val localizedFlowDataLoginTermsPolicyName = policyName as String
|
||||||
localizedFlowDataLoginTerms.policyName = policyName as String
|
var localizedFlowDataLoginTermsVersion: String? = null
|
||||||
|
var localizedFlowDataLoginTermsLocalizedUrl: String? = null
|
||||||
|
var localizedFlowDataLoginTermsLocalizedName: String? = null
|
||||||
|
|
||||||
val policy = policies[policyName]
|
val policy = policies[policyName]
|
||||||
|
|
||||||
// Enter this policy
|
// Enter this policy
|
||||||
if (policy is Map<*, *>) {
|
if (policy is Map<*, *>) {
|
||||||
// Version
|
// Version
|
||||||
localizedFlowDataLoginTerms.version = policy["version"] as String?
|
localizedFlowDataLoginTermsVersion = policy["version"] as String?
|
||||||
|
|
||||||
var userLanguageUrlAndName: UrlAndName? = null
|
var userLanguageUrlAndName: UrlAndName? = null
|
||||||
var defaultLanguageUrlAndName: UrlAndName? = null
|
var defaultLanguageUrlAndName: UrlAndName? = null
|
||||||
|
@ -86,21 +88,26 @@ fun TermPolicies.toLocalizedLoginTerms(userLanguage: String,
|
||||||
// Copy found language data by priority
|
// Copy found language data by priority
|
||||||
when {
|
when {
|
||||||
userLanguageUrlAndName != null -> {
|
userLanguageUrlAndName != null -> {
|
||||||
localizedFlowDataLoginTerms.localizedUrl = userLanguageUrlAndName!!.url
|
localizedFlowDataLoginTermsLocalizedUrl = userLanguageUrlAndName!!.url
|
||||||
localizedFlowDataLoginTerms.localizedName = userLanguageUrlAndName!!.name
|
localizedFlowDataLoginTermsLocalizedName = userLanguageUrlAndName!!.name
|
||||||
}
|
}
|
||||||
defaultLanguageUrlAndName != null -> {
|
defaultLanguageUrlAndName != null -> {
|
||||||
localizedFlowDataLoginTerms.localizedUrl = defaultLanguageUrlAndName!!.url
|
localizedFlowDataLoginTermsLocalizedUrl = defaultLanguageUrlAndName!!.url
|
||||||
localizedFlowDataLoginTerms.localizedName = defaultLanguageUrlAndName!!.name
|
localizedFlowDataLoginTermsLocalizedName = defaultLanguageUrlAndName!!.name
|
||||||
}
|
}
|
||||||
firstUrlAndName != null -> {
|
firstUrlAndName != null -> {
|
||||||
localizedFlowDataLoginTerms.localizedUrl = firstUrlAndName!!.url
|
localizedFlowDataLoginTermsLocalizedUrl = firstUrlAndName!!.url
|
||||||
localizedFlowDataLoginTerms.localizedName = firstUrlAndName!!.name
|
localizedFlowDataLoginTermsLocalizedName = firstUrlAndName!!.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result.add(localizedFlowDataLoginTerms)
|
result.add(LocalizedFlowDataLoginTerms(
|
||||||
|
policyName = localizedFlowDataLoginTermsPolicyName,
|
||||||
|
version = localizedFlowDataLoginTermsVersion,
|
||||||
|
localizedUrl = localizedFlowDataLoginTermsLocalizedUrl,
|
||||||
|
localizedName = localizedFlowDataLoginTermsLocalizedName
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue