Skip to content

Commit

Permalink
Merge pull request #4278 from nextcloud/set_empty_status_message
Browse files Browse the repository at this point in the history
Set empty status message
  • Loading branch information
sowjanyakch authored Sep 27, 2024
2 parents cfd04e5 + 25846fe commit f44885b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ data class Conversation(
@JsonField(name = ["actorType"])
var actorType: String = "",

var password: String? = null, //check if this can be removed.Does not belong to api response but is used internally?
var password: String? = null, // check if this can be removed.Does not belong to api response but is used internally?

@JsonField(name = ["isFavorite"])
var favorite: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import android.widget.AdapterView.OnItemSelectedListener
import android.widget.ArrayAdapter
import android.widget.ImageView
import android.widget.TextView
import androidx.core.widget.doAfterTextChanged
import androidx.fragment.app.DialogFragment
import androidx.recyclerview.widget.LinearLayoutManager
import autodagger.AutoInjector
Expand Down Expand Up @@ -177,6 +176,10 @@ class SetStatusDialogFragment :

setupGeneralStatusOptions()

if (currentStatus?.icon == null) {
binding.emoji.setText(getString(R.string.default_emoji))
}

binding.clearStatus.setOnClickListener { clearStatus() }
binding.setStatus.setOnClickListener { setStatusMessage() }
binding.emoji.setOnClickListener { openEmojiPopup() }
Expand Down Expand Up @@ -214,18 +217,13 @@ class SetStatusDialogFragment :
viewThemeUtils.material.colorMaterialButtonPrimaryTonal(binding.setStatus)

viewThemeUtils.material.colorTextInputLayout(binding.customStatusInputContainer)

binding.customStatusInput.doAfterTextChanged { text ->
binding.setStatus.isEnabled = !text.isNullOrEmpty()
}
}

private fun setupCurrentStatus() {
currentStatus?.let {
binding.emoji.setText(it.icon)
binding.customStatusInput.text?.clear()
binding.customStatusInput.setText(it.message?.trim())
binding.setStatus.isEnabled = it.message?.isEmpty() == false
visualizeStatus(it.status)

if (it.clearAt > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ConversationConversionTest(
val conversationEntity = conversationJson.asEntity(1)
assertNotNull(conversationEntity)

val apiVersion : Int = jsonFileName.substringAfterLast("APIv").first().digitToInt()
val apiVersion: Int = jsonFileName.substringAfterLast("APIv").first().digitToInt()

checkConversationEntity(conversationEntity, apiVersion)

Expand All @@ -61,10 +61,7 @@ class ConversationConversionTest(
checkConversationEntity(conversationEntityConvertedBack, apiVersion)
}

private fun checkConversationEntity(
conversationEntity: ConversationEntity,
apiVersion: Int
) {
private fun checkConversationEntity(conversationEntity: ConversationEntity, apiVersion: Int) {
assertEquals("1@juwd77g6", conversationEntity.internalId)
assertEquals(1, conversationEntity.accountId)

Expand Down

0 comments on commit f44885b

Please sign in to comment.