From 5692212dad7bd0bf64ff64589fdf1b6798fb36ea Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Mon, 16 Sep 2024 16:45:53 +0200 Subject: [PATCH] fix to load chat for old server version With server version 23.0.12 it happened that the chat did not load because values were null. Now default values in json model are set (because that's easier than changing the entity). Additionally a check was added in CallActivity that a callStartTime of 0 would not be used (but it should not be used anyway if it would be 0 because then capability should also not be available). Signed-off-by: Marcel Hibbe --- .../main/java/com/nextcloud/talk/activities/CallActivity.kt | 4 +++- .../talk/models/json/conversations/Conversation.kt | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt index 90e3689f1a..6376ce8fe3 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt @@ -1744,7 +1744,9 @@ class CallActivity : CallBaseActivity() { } private fun startCallTimeCounter(callStartTime: Long?) { - if (callStartTime != null && hasSpreedFeatureCapability( + if (callStartTime != null && + callStartTime != 0L && + hasSpreedFeatureCapability( conversationUser!!.capabilities!!.spreedCapability!!, SpreedFeatures.RECORDING_V1 ) ) { diff --git a/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.kt b/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.kt index 2411a39793..7b22165cc4 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.kt @@ -144,16 +144,16 @@ data class Conversation( var callRecording: Int = 0, @JsonField(name = ["avatarVersion"]) - var avatarVersion: String? = null, + var avatarVersion: String? = "", // Be aware that variables with "is" at the beginning will lead to the error: // "@JsonField annotation can only be used on private fields if both getter and setter are present." // Instead, name it with "has" at the beginning: isCustomAvatar -> hasCustomAvatar @JsonField(name = ["isCustomAvatar"]) - var hasCustomAvatar: Boolean? = null, + var hasCustomAvatar: Boolean? = false, @JsonField(name = ["callStartTime"]) - var callStartTime: Long? = null, + var callStartTime: Long? = 0L, @JsonField(name = ["recordingConsent"]) var recordingConsentRequired: Int = 0,