format code

Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
sowjanyakch 2024-12-05 15:51:27 +01:00
parent 27538a77ff
commit a9168b3f9d
No known key found for this signature in database
GPG Key ID: F7AA2A8B65B50220
10 changed files with 66 additions and 65 deletions

View File

@ -204,6 +204,4 @@ interface NcApiCoroutines {
@Header("Authorization") authorization: String, @Header("Authorization") authorization: String,
@Url url: String @Url url: String
): UserAbsenceOverall ): UserAbsenceOverall
} }

View File

@ -618,9 +618,14 @@ class ChatActivity :
) )
if (currentConversation?.type == ConversationEnums.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL && if (currentConversation?.type == ConversationEnums.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL &&
currentConversation?.status == "dnd"){ currentConversation?.status == "dnd"
) {
conversationUser?.let { user -> conversationUser?.let { user ->
chatViewModel.outOfOfficeStatusOfUser(credentials, user.baseUrl!!, currentConversation!!.name) chatViewModel.outOfOfficeStatusOfUser(
credentials,
user.baseUrl!!,
currentConversation!!.name
)
} }
} }
@ -698,8 +703,11 @@ class ChatActivity :
if (currentConversation?.type == ConversationEnums.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL) { if (currentConversation?.type == ConversationEnums.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL) {
conversationUser?.let { user -> conversationUser?.let { user ->
val credentials = ApiUtils.getCredentials(user.username, user.token) val credentials = ApiUtils.getCredentials(user.username, user.token)
chatViewModel.outOfOfficeStatusOfUser(credentials!!, user.baseUrl!!, chatViewModel.outOfOfficeStatusOfUser(
currentConversation!!.displayName) credentials!!,
user.baseUrl!!,
currentConversation!!.displayName
)
} }
} }
@ -1074,15 +1082,12 @@ class ChatActivity :
when (uiState) { when (uiState) {
is ChatViewModel.OutOfOfficeUIState.Error -> { is ChatViewModel.OutOfOfficeUIState.Error -> {
Log.e(TAG, "Error in outOfOfficeState", uiState.exception) Log.e(TAG, "Error in outOfOfficeState", uiState.exception)
} }
ChatViewModel.OutOfOfficeUIState.None -> { ChatViewModel.OutOfOfficeUIState.None -> {
} }
is ChatViewModel.OutOfOfficeUIState.Success -> { is ChatViewModel.OutOfOfficeUIState.Success -> {
binding.outOfOfficeContainer.visibility = View.VISIBLE binding.outOfOfficeContainer.visibility = View.VISIBLE
val startDateTimestamp: Long = uiState.userAbsence.startDate.toLong() val startDateTimestamp: Long = uiState.userAbsence.startDate.toLong()
val endDateTimestamp: Long = uiState.userAbsence.endDate.toLong() val endDateTimestamp: Long = uiState.userAbsence.endDate.toLong()
@ -1114,7 +1119,6 @@ class ChatActivity :
binding.outOfOfficeContainer.findViewById<TextView>(R.id.userAbsencePeriod).text = "$startDateString - $endDateString" binding.outOfOfficeContainer.findViewById<TextView>(R.id.userAbsencePeriod).text = "$startDateString - $endDateString"
} }
if (uiState.userAbsence.replacementUserDisplayName != null) { if (uiState.userAbsence.replacementUserDisplayName != null) {
binding.outOfOfficeContainer.findViewById<TextView>(R.id.absenceReplacement).text = String.format( binding.outOfOfficeContainer.findViewById<TextView>(R.id.absenceReplacement).text = String.format(
context.resources.getString(R.string.user_absence_replacement), context.resources.getString(R.string.user_absence_replacement),
@ -1126,7 +1130,6 @@ class ChatActivity :
binding.outOfOfficeContainer.findViewById<TextView>(R.id.userAbsenceLongMessage).text = uiState.userAbsence.message binding.outOfOfficeContainer.findViewById<TextView>(R.id.userAbsenceLongMessage).text = uiState.userAbsence.message
} }
} }
} }
} }
@ -3950,4 +3953,3 @@ class ChatActivity :
const val NO_OFFLINE_MESSAGES_FOUND = "NO_OFFLINE_MESSAGES_FOUND" const val NO_OFFLINE_MESSAGES_FOUND = "NO_OFFLINE_MESSAGES_FOUND"
} }
} }

View File

@ -65,5 +65,4 @@ interface ChatNetworkDataSource {
fun setChatReadMarker(credentials: String, url: String, previousMessageId: Int): Observable<GenericOverall> fun setChatReadMarker(credentials: String, url: String, previousMessageId: Int): Observable<GenericOverall>
fun editChatMessage(credentials: String, url: String, text: String): Observable<ChatOverallSingleMessage> fun editChatMessage(credentials: String, url: String, text: String): Observable<ChatOverallSingleMessage>
suspend fun getOutOfOfficeStatusForUser(credentials: String, baseUrl: String, userId: String): UserAbsenceOverall suspend fun getOutOfOfficeStatusForUser(credentials: String, baseUrl: String, userId: String): UserAbsenceOverall
} }

View File

@ -181,9 +181,14 @@ class RetrofitChatNetwork(private val ncApi: NcApi, private val ncApiCoroutines:
return ncApi.editChatMessage(credentials, url, text).map { it } return ncApi.editChatMessage(credentials, url, text).map { it }
} }
override suspend fun getOutOfOfficeStatusForUser(credentials: String, baseUrl: String, userId:String): override suspend fun getOutOfOfficeStatusForUser(
UserAbsenceOverall { credentials: String,
return ncApiCoroutines.getOutOfOfficeStatusForUser(credentials, baseUrl: String,
ApiUtils.getUrlForOutOfOffice(baseUrl,userId)) userId: String
): UserAbsenceOverall {
return ncApiCoroutines.getOutOfOfficeStatusForUser(
credentials,
ApiUtils.getUrlForOutOfOffice(baseUrl, userId)
)
} }
} }

View File

@ -787,7 +787,6 @@ class ChatViewModel @Inject constructor(
const val JOIN_ROOM_RETRY_COUNT: Long = 3 const val JOIN_ROOM_RETRY_COUNT: Long = 3
} }
sealed class OutOfOfficeUIState { sealed class OutOfOfficeUIState {
data object None : OutOfOfficeUIState() data object None : OutOfOfficeUIState()
data class Success(val userAbsence: UserAbsenceData) : OutOfOfficeUIState() data class Success(val userAbsence: UserAbsenceData) : OutOfOfficeUIState()

View File

@ -30,7 +30,7 @@ data class UserAbsenceData(
@JsonField(name = ["replacementUserId"]) @JsonField(name = ["replacementUserId"])
var replacementUserId: String?, var replacementUserId: String?,
@JsonField(name = ["replacementUserDisplayName"]) @JsonField(name = ["replacementUserDisplayName"])
var replacementUserDisplayName: String?, var replacementUserDisplayName: String?
) : Parcelable { ) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : constructor() :

View File

@ -24,4 +24,3 @@ data class UserAbsenceOCS(
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null, null) constructor() : this(null, null)
} }

View File

@ -21,4 +21,3 @@ data class UserAbsenceOverall(
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null) constructor() : this(null)
} }