Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ dependencies {
implementation(libs.opencsv)
implementation(libs.androidx.work.runtime.ktx)
implementation(libs.rxbinding)
implementation(libs.gif.encoder)

if (hasIncludedLibSessionUtilProject) {
implementation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.session.libsession.utilities.recipients.RemoteFile
import org.session.libsignal.utilities.Log
import org.thoughtcrime.securesms.attachments.RemoteFileDownloadWorker
import org.thoughtcrime.securesms.attachments.AvatarDownloadWorker
import org.thoughtcrime.securesms.database.RecipientSettingsDatabase
import org.thoughtcrime.securesms.dependencies.ManagerScope
import org.thoughtcrime.securesms.glide.RecipientAvatarDownloadManager
Expand Down Expand Up @@ -47,11 +47,11 @@ class AvatarCacheCleaner @Inject constructor(

// 4) Map to actual files (same hashing/location as downloader)
val wantedFiles: Set<File> = filesToKeep
.map { RemoteFileDownloadWorker.computeFileName(application, it) }
.map { AvatarDownloadWorker.computeFileName(application, it) }
.toSet()

// 5) Delete everything not wanted in cache/remote_files
val files = RemoteFileDownloadWorker.listDownloadedFiles(application)
val files = AvatarDownloadWorker.listDownloadedFiles(application)
var deleted = 0
for (file in files) {
if (file !in wantedFiles && file.delete()) deleted++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.annimon.stream.Stream;

import org.session.libsession.utilities.Address;
import org.session.libsignal.utilities.Log;

import java.io.File;
import java.io.FileInputStream;
Expand All @@ -22,7 +21,7 @@
/**
* @deprecated We no longer use these address-based avatars. All avatars are now stored as sha256 of
* urls encrypted locally. Look at {@link org.thoughtcrime.securesms.attachments.LocalEncryptedFileOutputStream},
* {@link org.thoughtcrime.securesms.attachments.RemoteFileDownloadWorker},
* {@link org.thoughtcrime.securesms.attachments.AvatarDownloadWorker},
* {@link org.thoughtcrime.securesms.glide.RecipientAvatarDownloadManager} for more information.
*
* Once the migration grace period is over, this class shall be removed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ interface MessageDataProvider {
fun getAttachmentStream(attachmentId: Long): SessionServiceAttachmentStream?
fun getAttachmentPointer(attachmentId: Long): SessionServiceAttachmentPointer?
fun getSignalAttachmentStream(attachmentId: Long): SignalServiceAttachmentStream?
fun getScaledSignalAttachmentStream(attachmentId: Long): SignalServiceAttachmentStream?
suspend fun getScaledSignalAttachmentStream(attachmentId: Long): SignalServiceAttachmentStream?
fun getSignalAttachmentPointer(attachmentId: Long): SignalServiceAttachmentPointer?
fun setAttachmentState(attachmentState: AttachmentState, attachmentId: AttachmentId, messageID: Long)
fun insertAttachment(messageId: Long, attachmentId: AttachmentId, stream : InputStream)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.session.libsession.messaging.file_server

import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrl

data class FileServer(
val url: HttpUrl,
val publicKeyHex: String
) {
constructor(url: String, publicKeyHex: String) : this(url.toHttpUrl(), publicKeyHex)

}

val HttpUrl.isOfficial: Boolean
get() = host.endsWith(".getsession.org", ignoreCase = true)
Loading