diff --git a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultVoterViewHolder.kt b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultVoterViewHolder.kt index 946fec775..851125552 100644 --- a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultVoterViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultVoterViewHolder.kt @@ -30,7 +30,6 @@ import com.nextcloud.talk.databinding.PollResultVoterItemBinding import com.nextcloud.talk.extensions.loadFederatedUserAvatar import com.nextcloud.talk.extensions.loadGuestAvatar import com.nextcloud.talk.extensions.loadUserAvatar -import com.nextcloud.talk.models.json.converters.EnumActorTypeConverter import com.nextcloud.talk.models.json.participants.Participant import com.nextcloud.talk.polls.model.PollDetails import com.nextcloud.talk.ui.theme.ViewThemeUtils @@ -55,7 +54,7 @@ class PollResultVoterViewHolder( } private fun loadAvatar(pollDetail: PollDetails, avatar: ImageView) { - when (EnumActorTypeConverter().getFromString(pollDetail.actorType)) { + when (pollDetail.actorType) { Participant.ActorType.GUESTS -> { var displayName = NextcloudTalkApplication.sharedApplication?.resources?.getString(R.string.nc_guest) if (!TextUtils.isEmpty(pollDetail.actorDisplayName)) { diff --git a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultVotersOverviewViewHolder.kt b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultVotersOverviewViewHolder.kt index 856b890ce..c12a94a43 100644 --- a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultVotersOverviewViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultVotersOverviewViewHolder.kt @@ -34,7 +34,6 @@ import com.nextcloud.talk.databinding.PollResultVotersOverviewItemBinding import com.nextcloud.talk.extensions.loadFederatedUserAvatar import com.nextcloud.talk.extensions.loadGuestAvatar import com.nextcloud.talk.extensions.loadUserAvatar -import com.nextcloud.talk.models.json.converters.EnumActorTypeConverter import com.nextcloud.talk.models.json.participants.Participant import com.nextcloud.talk.polls.model.PollDetails import com.nextcloud.talk.utils.DisplayUtils @@ -86,7 +85,7 @@ class PollResultVotersOverviewViewHolder( } private fun loadAvatar(pollDetail: PollDetails, avatar: ImageView) { - when (EnumActorTypeConverter().getFromString(pollDetail.actorType)) { + when (pollDetail.actorType) { Participant.ActorType.GUESTS -> { var displayName = NextcloudTalkApplication.sharedApplication?.resources?.getString(R.string.nc_guest) if (!TextUtils.isEmpty(pollDetail.actorDisplayName)) { diff --git a/app/src/main/java/com/nextcloud/talk/polls/model/Poll.kt b/app/src/main/java/com/nextcloud/talk/polls/model/Poll.kt index f96e0009e..526fdce96 100644 --- a/app/src/main/java/com/nextcloud/talk/polls/model/Poll.kt +++ b/app/src/main/java/com/nextcloud/talk/polls/model/Poll.kt @@ -20,12 +20,14 @@ package com.nextcloud.talk.polls.model +import com.nextcloud.talk.models.json.participants.Participant + data class Poll( val id: String, val question: String?, val options: List?, val votes: Map?, - val actorType: String?, + val actorType: Participant.ActorType?, val actorId: String?, val actorDisplayName: String?, val status: Int, diff --git a/app/src/main/java/com/nextcloud/talk/polls/model/PollDetails.kt b/app/src/main/java/com/nextcloud/talk/polls/model/PollDetails.kt index 6b025bf8f..542a6f77f 100644 --- a/app/src/main/java/com/nextcloud/talk/polls/model/PollDetails.kt +++ b/app/src/main/java/com/nextcloud/talk/polls/model/PollDetails.kt @@ -20,8 +20,10 @@ package com.nextcloud.talk.polls.model +import com.nextcloud.talk.models.json.participants.Participant + data class PollDetails( - val actorType: String?, + val actorType: Participant.ActorType?, val actorId: String?, val actorDisplayName: String?, val optionId: Int diff --git a/app/src/main/java/com/nextcloud/talk/polls/repositories/model/PollDetailsResponse.kt b/app/src/main/java/com/nextcloud/talk/polls/repositories/model/PollDetailsResponse.kt index 336a81226..9d1dd4a74 100644 --- a/app/src/main/java/com/nextcloud/talk/polls/repositories/model/PollDetailsResponse.kt +++ b/app/src/main/java/com/nextcloud/talk/polls/repositories/model/PollDetailsResponse.kt @@ -22,13 +22,15 @@ package com.nextcloud.talk.polls.repositories.model import android.os.Parcelable import com.bluelinelabs.logansquare.annotation.JsonField import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.models.json.converters.EnumActorTypeConverter +import com.nextcloud.talk.models.json.participants.Participant import kotlinx.parcelize.Parcelize @Parcelize @JsonObject data class PollDetailsResponse( - @JsonField(name = ["actorType"]) - var actorType: String? = null, + @JsonField(name = ["actorType"], typeConverter = EnumActorTypeConverter::class) + var actorType: Participant.ActorType? = null, @JsonField(name = ["actorId"]) var actorId: String, diff --git a/app/src/main/java/com/nextcloud/talk/polls/repositories/model/PollResponse.kt b/app/src/main/java/com/nextcloud/talk/polls/repositories/model/PollResponse.kt index 948d8698c..9f82a18f7 100644 --- a/app/src/main/java/com/nextcloud/talk/polls/repositories/model/PollResponse.kt +++ b/app/src/main/java/com/nextcloud/talk/polls/repositories/model/PollResponse.kt @@ -22,6 +22,8 @@ package com.nextcloud.talk.polls.repositories.model import android.os.Parcelable import com.bluelinelabs.logansquare.annotation.JsonField import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.models.json.converters.EnumActorTypeConverter +import com.nextcloud.talk.models.json.participants.Participant import kotlinx.parcelize.Parcelize @Parcelize @@ -39,8 +41,8 @@ data class PollResponse( @JsonField(name = ["votes"]) var votes: Map? = null, - @JsonField(name = ["actorType"]) - var actorType: String? = null, + @JsonField(name = ["actorType"], typeConverter = EnumActorTypeConverter::class) + var actorType: Participant.ActorType? = null, @JsonField(name = ["actorId"]) var actorId: String? = null,