Skip to content

Commit ace5153

Browse files
Merge branch 'dev' into techdebt/remove-guava
2 parents 7e12a72 + 625c667 commit ace5153

File tree

4 files changed

+30
-21
lines changed

4 files changed

+30
-21
lines changed

app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,9 @@ class ConversationViewModel @AssistedInject constructor(
11381138
showMessage(application.getString(R.string.banUserBanned))
11391139

11401140
// ..so we can now delete all their messages in this thread from local storage & remove the views.
1141-
repository.deleteAllLocalMessagesInThreadFromSenderOfMessage(messageRecord)
1141+
withContext(Dispatchers.IO) {
1142+
repository.deleteAllLocalMessagesInThreadFromSenderOfMessage(messageRecord)
1143+
}
11421144
}
11431145
.onFailure {
11441146
showMessage(application.getString(R.string.banErrorFailed))

app/src/main/java/org/thoughtcrime/securesms/groups/GroupLeavingWorker.kt

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,24 @@ class GroupLeavingWorker @AssistedInject constructor(
140140

141141
// We now have an admin option to leave group so we need a way of Deleting the group
142142
// even if there are more admins
143-
if (weAreTheOnlyAdmin || deleteGroup) {
144-
configFactory.withMutableGroupConfigs(groupId) { configs ->
145-
configs.groupInfo.destroyGroup()
143+
if ((weAreTheOnlyAdmin || deleteGroup)) {
144+
try {
145+
configFactory.withMutableGroupConfigs(groupId) { configs ->
146+
configs.groupInfo.destroyGroup()
147+
}
148+
149+
// Must wait until the config is pushed, otherwise if we go through the rest
150+
// of the code it will destroy the conversation, destroying the necessary configs
151+
// along the way, we won't be able to push the "destroyed" state anymore.
152+
configFactory.waitUntilGroupConfigsPushed(groupId, timeoutMills = 0L)
153+
} catch (e: CancellationException) {
154+
throw e
155+
} catch (e: Throwable) {
156+
// If the destruction of group can't be done, there's nothing
157+
// else we can do. So we will proceed with the rest where
158+
// we remove the group entry from the database.
159+
Log.e(TAG, "Error while destroying group $groupId. Proceeding...", e)
146160
}
147-
148-
// Must wait until the config is pushed, otherwise if we go through the rest
149-
// of the code it will destroy the conversation, destroying the necessary configs
150-
// along the way, we won't be able to push the "destroyed" state anymore.
151-
configFactory.waitUntilGroupConfigsPushed(groupId, timeoutMills = 0L)
152161
}
153162
}
154163

app/src/main/java/org/thoughtcrime/securesms/groups/GroupManagerV2Impl.kt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -589,21 +589,19 @@ class GroupManagerV2Impl @Inject constructor(
589589
}
590590

591591
// Send out the promote message to the members concurrently
592-
val promoteMessage = GroupUpdated(
593-
GroupUpdateMessage.newBuilder()
594-
.setPromoteMessage(
595-
GroupUpdatePromoteMessage.newBuilder()
596-
.setGroupIdentitySeed(ByteString.copyFrom(adminKey).substring(0, 32))
597-
.setName(groupName)
598-
)
599-
.build()
600-
)
601-
602592
val promotionDeferred = members.associateWith { member ->
603593
async {
604594
// The promotion message shouldn't be persisted to avoid being retried automatically
605595
messageSender.sendNonDurably(
606-
message = promoteMessage,
596+
message = GroupUpdated(
597+
GroupUpdateMessage.newBuilder()
598+
.setPromoteMessage(
599+
GroupUpdatePromoteMessage.newBuilder()
600+
.setGroupIdentitySeed(ByteString.copyFrom(adminKey).substring(0, 32))
601+
.setName(groupName)
602+
)
603+
.build()
604+
),
607605
address = Address.fromSerialized(member.hexString),
608606
isSyncMessage = false,
609607
)

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ kotlinVersion = "2.3.0"
2929
kryoVersion = "5.6.2"
3030
kspVersion = "2.3.5"
3131
legacySupportV13Version = "1.0.0"
32-
libsessionUtilAndroidVersion = "1.1.0-4-gcbf7eba"
32+
libsessionUtilAndroidVersion = "1.1.0-5-gb9061a4"
3333
media3ExoplayerVersion = "1.9.2"
3434
mockitoCoreVersion = "5.21.0"
3535
navVersion = "2.9.6"

0 commit comments

Comments
 (0)