Skip to content

Commit 939f331

Browse files
Merge pull request #1647 from session-foundation/merge-1.29.0
Bring 1.29.0 to dev
2 parents adeddde + 79bd64e commit 939f331

File tree

67 files changed

+2946
-1805
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2946
-1805
lines changed

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ configurations.configureEach {
2626
exclude(module = "commons-logging")
2727
}
2828

29-
val canonicalVersionCode = 429
29+
val canonicalVersionCode = 430
3030
val canonicalVersionName = "1.30.0"
3131

3232
val postFixSize = 10

app/src/firebaseCommon/kotlin/org/thoughtcrime/securesms/notifications/FirebaseTokenFetcher.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ class FirebaseTokenFetcher @Inject constructor(): TokenFetcher {
1212
override val token = MutableStateFlow<String?>(null)
1313

1414
init {
15+
fetchToken()
16+
}
17+
18+
private fun fetchToken() {
1519
FirebaseMessaging.getInstance()
1620
.token
1721
.addOnSuccessListener(this::onNewToken)
@@ -23,5 +27,6 @@ class FirebaseTokenFetcher @Inject constructor(): TokenFetcher {
2327

2428
override suspend fun resetToken() {
2529
FirebaseMessaging.getInstance().deleteToken().await()
30+
fetchToken()
2631
}
2732
}

app/src/main/java/org/session/libsession/avatars/AvatarCacheCleaner.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import kotlinx.coroutines.launch
77
import kotlinx.coroutines.withContext
88
import org.session.libsession.utilities.recipients.RemoteFile
99
import org.session.libsignal.utilities.Log
10-
import org.thoughtcrime.securesms.attachments.RemoteFileDownloadWorker
10+
import org.thoughtcrime.securesms.attachments.AvatarDownloadManager
1111
import org.thoughtcrime.securesms.database.RecipientSettingsDatabase
1212
import org.thoughtcrime.securesms.dependencies.ManagerScope
1313
import org.thoughtcrime.securesms.glide.RecipientAvatarDownloadManager
@@ -47,11 +47,11 @@ class AvatarCacheCleaner @Inject constructor(
4747

4848
// 4) Map to actual files (same hashing/location as downloader)
4949
val wantedFiles: Set<File> = filesToKeep
50-
.map { RemoteFileDownloadWorker.computeFileName(application, it) }
50+
.map { AvatarDownloadManager.computeFileName(application, it) }
5151
.toSet()
5252

5353
// 5) Delete everything not wanted in cache/remote_files
54-
val files = RemoteFileDownloadWorker.listDownloadedFiles(application)
54+
val files = AvatarDownloadManager.listDownloadedFiles(application)
5555
var deleted = 0
5656
for (file in files) {
5757
if (file !in wantedFiles && file.delete()) deleted++

app/src/main/java/org/session/libsession/avatars/AvatarHelper.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.annimon.stream.Stream;
99

1010
import org.session.libsession.utilities.Address;
11-
import org.session.libsignal.utilities.Log;
1211

1312
import java.io.File;
1413
import java.io.FileInputStream;
@@ -22,7 +21,7 @@
2221
/**
2322
* @deprecated We no longer use these address-based avatars. All avatars are now stored as sha256 of
2423
* urls encrypted locally. Look at {@link org.thoughtcrime.securesms.attachments.LocalEncryptedFileOutputStream},
25-
* {@link org.thoughtcrime.securesms.attachments.RemoteFileDownloadWorker},
24+
* {@link org.thoughtcrime.securesms.attachments.AvatarDownloadWorker},
2625
* {@link org.thoughtcrime.securesms.glide.RecipientAvatarDownloadManager} for more information.
2726
*
2827
* Once the migration grace period is over, this class shall be removed.

app/src/main/java/org/session/libsession/database/MessageDataProvider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ interface MessageDataProvider {
3030
fun getAttachmentStream(attachmentId: Long): SessionServiceAttachmentStream?
3131
fun getAttachmentPointer(attachmentId: Long): SessionServiceAttachmentPointer?
3232
fun getSignalAttachmentStream(attachmentId: Long): SignalServiceAttachmentStream?
33-
fun getScaledSignalAttachmentStream(attachmentId: Long): SignalServiceAttachmentStream?
33+
suspend fun getScaledSignalAttachmentStream(attachmentId: Long): SignalServiceAttachmentStream?
3434
fun getSignalAttachmentPointer(attachmentId: Long): SignalServiceAttachmentPointer?
3535
fun setAttachmentState(attachmentState: AttachmentState, attachmentId: AttachmentId, messageID: Long)
3636
fun insertAttachment(messageId: Long, attachmentId: AttachmentId, stream : InputStream)

app/src/main/java/org/session/libsession/database/StorageProtocol.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ interface StorageProtocol {
9393
fun removeReceivedMessageTimestamps(timestamps: Set<Long>)
9494
fun getAttachmentsForMessage(mmsMessageId: Long): List<DatabaseAttachment>
9595
fun getMessageBy(threadId: Long, timestamp: Long, author: String): MessageRecord?
96+
@Deprecated("We shouldn't be querying messages by timestamp alone. Use `getMessageBy` when possible ")
97+
fun getMessageByTimestamp(timestamp: Long, author: String, getQuote: Boolean): MessageRecord?
9698
fun updateSentTimestamp(messageId: MessageId, newTimestamp: Long)
9799
fun markAsResyncing(messageId: MessageId)
98100
fun markAsSyncing(messageId: MessageId)
@@ -182,6 +184,14 @@ interface StorageProtocol {
182184
runThreadUpdate: Boolean
183185
): MessageId?
184186
fun markConversationAsRead(threadId: Long, lastSeenTime: Long, force: Boolean = false, updateNotification: Boolean = true)
187+
188+
/**
189+
* Marks the conversation as read up to and including the message with [messageId]. It will
190+
* take the reactions associated with messages prior to and including that message into account.
191+
*
192+
* It will not do anything if the last seen of this thread is already set in the future.
193+
*/
194+
fun markConversationAsReadUpToMessage(messageId: MessageId)
185195
fun markConversationAsUnread(threadId: Long)
186196
fun getLastSeen(threadId: Long): Long
187197
fun ensureMessageHashesAreSender(hashes: Set<String>, sender: String, closedGroupId: String): Boolean
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.session.libsession.messaging.file_server
2+
3+
import kotlinx.serialization.Serializable
4+
import okhttp3.HttpUrl
5+
import okhttp3.HttpUrl.Companion.toHttpUrl
6+
import org.session.libsession.utilities.serializable.HttpSerializer
7+
8+
@Serializable
9+
data class FileServer(
10+
@Serializable(with = HttpSerializer::class)
11+
val url: HttpUrl,
12+
val ed25519PublicKeyHex: String
13+
) {
14+
constructor(url: String, ed25519PublicKeyHex: String) : this(url.toHttpUrl(), ed25519PublicKeyHex)
15+
}
16+
17+
val HttpUrl.isOfficial: Boolean
18+
get() = host.endsWith(".getsession.org", ignoreCase = true)

0 commit comments

Comments
 (0)