build: trying to track down broken retrieve avatar job

This commit is contained in:
0x330a 2023-06-22 15:16:44 +10:00
parent 05f8dc6d43
commit 8d0f946791
No known key found for this signature in database
GPG Key ID: 267811D6E6A2698C
3 changed files with 6 additions and 10 deletions

View File

@ -240,6 +240,7 @@ android {
buildTypes {
release {
debuggable true
minifyEnabled false
}
debug {

View File

@ -549,15 +549,8 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
for (groupInfo in communities) {
val groupBaseCommunity = groupInfo.community
if (groupBaseCommunity.fullUrl() !in existingJoinUrls) {
if (groupBaseCommunity.fullUrl() in existingJoinUrls) {
// add it
try {
val (threadId, _) = OpenGroupManager.add(groupBaseCommunity.baseUrl, groupBaseCommunity.room, groupBaseCommunity.pubKeyHex, context)
threadDb.setPinned(threadId, groupInfo.priority == PRIORITY_PINNED)
} catch (e: Exception) {
Log.e("Loki", "Failed to get Open Group Info on syncing config",e)
}
} else {
val (threadId, _) = existingCommunities.entries.first { (_, v) -> v.joinURL == groupInfo.community.fullUrl() }
threadDb.setPinned(threadId, groupInfo.priority == PRIORITY_PINNED)
}

View File

@ -34,14 +34,14 @@ class RetrieveProfileAvatarJob(private val profileAvatar: String?, val recipient
}
override suspend fun execute(dispatcherName: String) {
val delegate = delegate ?: return
val context = MessagingModuleConfiguration.shared.context
val storage = MessagingModuleConfiguration.shared.storage
val recipient = Recipient.from(context, recipientAddress, true)
val profileKey = recipient.resolve().profileKey
if (profileKey == null || (profileKey.size != 32 && profileKey.size != 16)) {
Log.w(TAG, "Recipient profile key is gone!")
return
return delegate.handleJobFailedPermanently(this, dispatcherName, Exception("Recipient profile key is gone!"))
}
// Commit '78d1e9d' (fix: open group threads and avatar downloads) had this commented out so
@ -85,9 +85,11 @@ class RetrieveProfileAvatarJob(private val profileAvatar: String?, val recipient
storage.setProfileAvatar(recipient, profileAvatar)
} catch (e: Exception) {
Log.e("Loki", "Failed to download profile avatar", e)
return delegate.handleJobFailedPermanently(this, dispatcherName, e)
} finally {
downloadDestination.delete()
}
return delegate.handleJobSucceeded(this, dispatcherName)
}
override fun serialize(): Data {