Skip to content
Merged
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 @@ -25,8 +25,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 @@ -22,6 +22,7 @@ import org.session.libsession.snode.SnodeClock
import org.session.libsession.utilities.ConfigFactoryProtocol
import org.session.libsession.utilities.withMutableUserConfigs
import org.session.libsession.utilities.withUserConfigs
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 @@ -50,8 +51,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