mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-11 19:07:40 +00:00
Fixed a few issues with the GroupAvatarDownloadJob
Added a method to remove the Group avatar Fixed an issue where the recipient diffing on the HomeActivity wasn't working properly Fixed an issue where the GroupAvatarDownloadJob could be scheduled even when there was already one scheduled
This commit is contained in:
@@ -80,6 +80,7 @@ interface StorageProtocol {
|
||||
// Open Group Metadata
|
||||
fun updateTitle(groupID: String, newValue: String)
|
||||
fun updateProfilePicture(groupID: String, newValue: ByteArray)
|
||||
fun removeProfilePicture(groupID: String)
|
||||
fun hasDownloadedProfilePicture(groupID: String): Boolean
|
||||
fun setUserCount(room: String, server: String, newValue: Int)
|
||||
|
||||
|
@@ -68,8 +68,8 @@ class GroupAvatarDownloadJob(val server: String, val room: String, val imageId:
|
||||
|
||||
override fun create(data: Data): GroupAvatarDownloadJob {
|
||||
return GroupAvatarDownloadJob(
|
||||
data.getString(ROOM),
|
||||
data.getString(SERVER),
|
||||
data.getString(ROOM),
|
||||
if (data.hasString(IMAGE_ID)) { data.getString(IMAGE_ID) } else { null }
|
||||
)
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ data class OpenGroup(
|
||||
val server = json.get("server").asText().lowercase(Locale.US)
|
||||
val displayName = json.get("displayName").asText()
|
||||
val publicKey = json.get("publicKey").asText()
|
||||
val imageId = json.get("imageId")?.asText()
|
||||
val imageId = if (json.hasNonNull("imageId")) { json.get("imageId")?.asText() } else { null }
|
||||
val canWrite = json.get("canWrite")?.asText()?.toBoolean() ?: true
|
||||
val infoUpdates = json.get("infoUpdates")?.asText()?.toIntOrNull() ?: 0
|
||||
OpenGroup(server = server, room = room, name = displayName, publicKey = publicKey, imageId = imageId, canWrite = canWrite, infoUpdates = infoUpdates)
|
||||
|
@@ -159,6 +159,7 @@ class OpenGroupPoller(private val server: String, private val executorService: S
|
||||
})
|
||||
}
|
||||
|
||||
// Update the group avatar
|
||||
if (
|
||||
(
|
||||
pollInfo.details != null &&
|
||||
@@ -174,7 +175,14 @@ class OpenGroupPoller(private val server: String, private val executorService: S
|
||||
storage.getGroupAvatarDownloadJob(openGroup.server, openGroup.room, existingOpenGroup.imageId) == null
|
||||
)
|
||||
) {
|
||||
JobQueue.shared.add(GroupAvatarDownloadJob(roomToken, server, existingOpenGroup.imageId))
|
||||
JobQueue.shared.add(GroupAvatarDownloadJob(server, roomToken, existingOpenGroup.imageId))
|
||||
}
|
||||
else if (
|
||||
pollInfo.details != null &&
|
||||
pollInfo.details.imageId == null &&
|
||||
existingOpenGroup.imageId != null
|
||||
) {
|
||||
storage.removeProfilePicture(dbGroupId)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user