Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ configurations.configureEach {
exclude(module = "commons-logging")
}

val canonicalVersionCode = 434
val canonicalVersionName = "1.30.1"
val canonicalVersionCode = 435
val canonicalVersionName = "1.30.2"

val postFixSize = 10
val abiPostFix = mapOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ class MessageParser @Inject constructor(
val envelop = SessionProtocol.decodeFor1o1(
myEd25519PrivKey = currentUserEd25519PrivKey,
payload = data,
nowEpochMs = snodeClock.currentTimeMills(),
proBackendPubKey = proBackendKey,
)

Expand Down Expand Up @@ -208,7 +207,6 @@ class MessageParser @Inject constructor(
val decoded = SessionProtocol.decodeForGroup(
payload = data,
myEd25519PrivKey = currentUserEd25519PrivKey,
nowEpochMs = snodeClock.currentTimeMills(),
groupEd25519PublicKey = groupId.pubKeyBytes,
groupEd25519PrivateKeys = keys.toTypedArray(),
proBackendPubKey = proBackendKey
Expand Down Expand Up @@ -238,7 +236,7 @@ class MessageParser @Inject constructor(

val decoded = SessionProtocol.decodeForCommunity(
payload = Base64.decode(msg.data),
nowEpochMs = snodeClock.currentTimeMills(),
timestampMs = snodeClock.currentTimeMills(),
proBackendPubKey = proBackendKey,
)

Expand Down Expand Up @@ -276,7 +274,7 @@ class MessageParser @Inject constructor(

val decoded = SessionProtocol.decodeForCommunity(
payload = plaintext.data,
nowEpochMs = snodeClock.currentTimeMills(),
timestampMs = snodeClock.currentTimeMills(),
proBackendPubKey = proBackendKey,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ class ReceivedMessageProcessor @Inject constructor(

var maxOutgoingMessageTimestamp: Long = 0L

val currentUserEd25519KeyPair: KeyPair by lazy(LazyThreadSafetyMode.NONE) {
val currentUserEd25519KeyPair: KeyPair by lazy {
requireNotNull(storage.getUserED25519KeyPair()) {
"No current user ED25519 key pair available"
}
Expand All @@ -524,7 +524,7 @@ class ReceivedMessageProcessor @Inject constructor(
val currentUserPublicKey: String get() = currentUserId.hexString


val contactConfigTimestamp: Long by lazy(LazyThreadSafetyMode.NONE) {
val contactConfigTimestamp: Long by lazy {
configFactory.getConfigTimestamp(UserConfigType.CONTACTS, currentUserPublicKey)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ data class RetrieveMessageResponse(
@SerialName("data")
val dataB64: String? = null,
) {
val data: ByteArray by lazy(LazyThreadSafetyMode.NONE) {
val data: ByteArray by lazy {
Base64.decode(dataB64, Base64.DEFAULT)
}

Expand Down
9 changes: 4 additions & 5 deletions app/src/main/java/org/session/libsession/utilities/Address.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import kotlinx.serialization.Serializable
import org.session.libsession.messaging.open_groups.OpenGroup
import org.session.libsignal.utilities.AccountId
import org.session.libsignal.utilities.IdPrefix
import org.session.libsignal.utilities.Log
import org.session.libsignal.utilities.Util
import java.util.LinkedList
import org.session.libsignal.utilities.Log
import kotlin.text.startsWith

@Serializable(with = AddressSerializer::class)
sealed interface Address : Parcelable, Comparable<Address> {
Expand Down Expand Up @@ -81,7 +80,7 @@ sealed interface Address : Parcelable, Comparable<Address> {
}

data class LegacyGroup(val groupPublicKeyHex: String) : Conversable, GroupLike {
override val address: String by lazy(LazyThreadSafetyMode.NONE) {
override val address: String by lazy {
GroupUtil.doubleEncodeGroupID(groupPublicKeyHex)
}

Expand All @@ -101,7 +100,7 @@ sealed interface Address : Parcelable, Comparable<Address> {
override val accountId: AccountId
get() = blindedId.blindedId

override val address: String by lazy(LazyThreadSafetyMode.NONE) {
override val address: String by lazy {
"${URI_PREFIX}${blindedId.blindedId.hexString}"
.toUri()
.buildUpon()
Expand Down Expand Up @@ -136,7 +135,7 @@ sealed interface Address : Parcelable, Comparable<Address> {
}
}

override val address: String by lazy(LazyThreadSafetyMode.NONE) {
override val address: String by lazy {
"${URI_PREFIX}${Uri.encode(serverUrl)}"
.toUri()
.buildUpon()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@ data class LoggedInState(
}
}

private val paddedSeed: ByteArray by lazy(LazyThreadSafetyMode.NONE) {
private val paddedSeed: ByteArray by lazy {
seed.data + ByteArray(16)
}

val accountEd25519KeyPair: KeyPair by lazy(LazyThreadSafetyMode.NONE) {
val accountEd25519KeyPair: KeyPair by lazy {
ED25519.generate(paddedSeed)
}

val accountX25519KeyPair: KeyPair by lazy(LazyThreadSafetyMode.NONE) {
val accountX25519KeyPair: KeyPair by lazy {
Curve25519.fromED25519(accountEd25519KeyPair)
}

val accountId: AccountId by lazy(LazyThreadSafetyMode.NONE) {
val accountId: AccountId by lazy {
AccountId(IdPrefix.STANDARD, accountX25519KeyPair.pubKey.data)
}

val proMasterPrivateKey: ByteArray by lazy(LazyThreadSafetyMode.NONE) {
val proMasterPrivateKey: ByteArray by lazy {
ED25519.generateProMasterKey(paddedSeed)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.mapNotNull
import org.session.libsession.snode.SnodeClock
import org.session.libsession.utilities.ConfigFactoryProtocol
import org.session.libsession.utilities.TextSecurePreferences
import org.session.libsignal.exceptions.NonRetryableException
import org.session.libsignal.utilities.Log
import org.thoughtcrime.securesms.auth.LoginStateRepository
Expand Down Expand Up @@ -48,8 +49,14 @@ class FetchProDetailsWorker @AssistedInject constructor(
private val loginStateRepository: LoginStateRepository,
private val snodeClock: SnodeClock,
private val configFactory: ConfigFactoryProtocol,
private val prefs: TextSecurePreferences,
) : CoroutineWorker(context, params) {
override suspend fun doWork(): Result {
if (!prefs.forcePostPro()) {
Log.d(TAG, "Pro details fetch skipped because pro is not enabled")
return Result.success()
}

val proMasterKey =
requireNotNull(loginStateRepository.peekLoginState()?.seeded?.proMasterPrivateKey) {
"User must be logged in to fetch pro details"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.stateIn
import org.session.libsession.snode.SnodeClock
import org.session.libsession.utilities.TextSecurePreferences
import org.session.libsignal.utilities.Log
import org.thoughtcrime.securesms.auth.LoginStateRepository
import org.thoughtcrime.securesms.debugmenu.DebugLogGroup
Expand All @@ -29,6 +30,7 @@ class ProDetailsRepository @Inject constructor(
private val snodeClock: SnodeClock,
@ManagerScope scope: CoroutineScope,
loginStateRepository: LoginStateRepository,
private val prefs: TextSecurePreferences,
) {
sealed interface LoadState {
val lastUpdated: Pair<ProDetails, Instant>?
Expand Down Expand Up @@ -83,6 +85,11 @@ class ProDetailsRepository @Inject constructor(
* made regardless of the freshness of the last update.
*/
fun requestRefresh(force: Boolean = false) {
if (!prefs.forcePostPro()) {
Log.d(DebugLogGroup.PRO_DATA.label, "Pro hasn't been enabled, skipping refresh")
return
}

val currentState = loadState.value
if (!force && (currentState is LoadState.Loading || currentState is LoadState.Loaded) &&
currentState.lastUpdated?.second?.plusSeconds(MIN_UPDATE_INTERVAL_SECONDS)
Expand Down
10 changes: 0 additions & 10 deletions app/src/main/proto/Utils.proto

This file was deleted.

40 changes: 0 additions & 40 deletions app/src/main/proto/WebSocketResources.proto

This file was deleted.

2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ kotlinVersion = "2.2.21"
kryoVersion = "5.6.2"
kspVersion = "2.3.3"
legacySupportV13Version = "1.0.0"
libsessionUtilAndroidVersion = "1.0.9-7-g7866645"
libsessionUtilAndroidVersion = "1.1.0-2-g39d4ac8"
media3ExoplayerVersion = "1.8.0"
mockitoCoreVersion = "5.20.0"
navVersion = "2.9.5"
Expand Down