Skip to content

Commit

Permalink
fix chat concurrent modification exception
Browse files Browse the repository at this point in the history
(cherry picked from commit 3751b32)
  • Loading branch information
crackededed committed Jan 29, 2025
1 parent e7b417b commit 8812c1f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ android {
applicationId = "com.github.andreyasadchy.xtra"
minSdk = 21
targetSdk = 35
versionCode = 273
versionName = "2.41.0"
versionCode = 274
versionName = "2.41.1"
}

buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,9 @@ class ChatViewModel @Inject constructor(
}?.let { list.add(it) }
}
if (list.isNotEmpty()) {
_chatMessages.value = mutableListOf<ChatMessage>().apply {
_chatMessages.value = arrayListOf<ChatMessage>().apply {
addAll(list)
addAll(_chatMessages.value)
addAll(_chatMessages.value.toList())
}
if (!scrollDown.value) {
scrollDown.value = true
Expand Down Expand Up @@ -1044,7 +1044,7 @@ class ChatViewModel @Inject constructor(

private fun onClearMessage(message: String, nameDisplay: String?) {
val pair = ChatUtils.parseClearMessage(message)
val deletedMessage = pair.second?.let { targetId -> _chatMessages.value.find { it.id == targetId } }
val deletedMessage = pair.second?.let { targetId -> _chatMessages.value.toList().find { it.id == targetId } }
onMessage(getClearMessage(pair.first, deletedMessage, nameDisplay))
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
activity = "1.10.0"
android-gradle-plugin = "8.8.0"
apollo = "4.1.0"
apollo = "4.1.1"
appcompat = "1.7.0"
coil = "3.0.4"
constraintlayout = "2.2.0"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down

0 comments on commit 8812c1f

Please sign in to comment.