Merge pull request #1014 from session-foundation/release/1.21.1

Release 1.21.1
pull/1713/head
SessionHero01 2 months ago committed by GitHub
commit 222994a17e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -83,7 +83,8 @@ local ci_dep_mirror(want_mirror) = (if want_mirror then ' -DLOCAL_MIRROR=https:/
'apt-get update --allow-releaseinfo-change',
'apt-get install -y ninja-build openjdk-17-jdk',
'update-java-alternatives -s java-1.17.0-openjdk-amd64',
'./gradlew assemblePlayDebug',
'./gradlew assemblePlayDebug assembleWebsiteDebug',
'./gradlew -Phuawei=1 assembleHuaweiDebug',
'./scripts/drone-static-upload.sh'
],
}

@ -15,8 +15,8 @@ configurations.configureEach {
exclude module: "commons-logging"
}
def canonicalVersionCode = 396
def canonicalVersionName = "1.21.0"
def canonicalVersionCode = 397
def canonicalVersionName = "1.21.1"
def postFixSize = 10
def abiPostFix = ['armeabi-v7a' : 1,

@ -9,6 +9,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.session.libsession.messaging.notifications.TokenFetcher
import org.session.libsignal.utilities.Log
import javax.inject.Inject
import javax.inject.Singleton
@ -25,13 +26,22 @@ class HuaweiTokenFetcher @Inject constructor(
this.token.value = token
}
override suspend fun resetToken() {
withContext(Dispatchers.Default) {
HmsInstanceId.getInstance(context).deleteToken(APP_ID, TOKEN_SCOPE)
}
}
init {
GlobalScope.launch {
val instanceId = HmsInstanceId.getInstance(context)
withContext(Dispatchers.Default) {
instanceId.getToken(APP_ID, TOKEN_SCOPE)
try {
val instanceId = HmsInstanceId.getInstance(context)
withContext(Dispatchers.Default) {
instanceId.getToken(APP_ID, TOKEN_SCOPE)
}
} catch (e: Exception) {
Log.e("HuaweiTokenFetcher", "Failed to fetch token", e)
}
}
}
}

@ -40,7 +40,6 @@ import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ProcessLifecycleOwner;
import androidx.work.Configuration;
import com.google.firebase.messaging.FirebaseMessaging;
import com.squareup.phrase.Phrase;
import org.conscrypt.Conscrypt;

@ -3,7 +3,6 @@ package org.thoughtcrime.securesms.util
import android.annotation.SuppressLint
import android.app.Application
import android.content.Intent
import com.google.firebase.messaging.FirebaseMessaging
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext
@ -15,11 +14,12 @@ import org.thoughtcrime.securesms.dependencies.ConfigFactory
import org.thoughtcrime.securesms.home.HomeActivity
import javax.inject.Inject
import androidx.core.content.edit
import kotlinx.coroutines.tasks.await
import org.session.libsession.messaging.notifications.TokenFetcher
class ClearDataUtils @Inject constructor(
private val application: Application,
private val configFactory: ConfigFactory,
private val tokenFetcher: TokenFetcher,
) {
// Method to clear the local data - returns true on success otherwise false
@SuppressLint("ApplySharedPref")
@ -36,9 +36,9 @@ class ClearDataUtils @Inject constructor(
// The token deletion is nice but not critical, so don't let it block the rest of the process
runCatching {
FirebaseMessaging.getInstance().deleteToken().await()
tokenFetcher.resetToken()
}.onFailure { e ->
Log.w("ClearDataUtils", "Failed to delete Firebase token: ${e.message}", e)
Log.w("ClearDataUtils", "Failed to reset push notification token: ${e.message}", e)
}
}
}

@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.notifications
import com.google.firebase.messaging.FirebaseMessaging
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.tasks.await
import org.session.libsession.messaging.notifications.TokenFetcher
import javax.inject.Inject
import javax.inject.Singleton
@ -19,4 +20,8 @@ class FirebaseTokenFetcher @Inject constructor(): TokenFetcher {
override fun onNewToken(token: String) {
this.token.value = token
}
override suspend fun resetToken() {
FirebaseMessaging.getInstance().deleteToken().await()
}
}

@ -5,7 +5,7 @@ import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
import org.session.libsession.messaging.notifications.TokenFetcher
@Module
@InstallIn(SingletonComponent::class)

@ -1,9 +1,15 @@
package org.thoughtcrime.securesms.notifications
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import org.session.libsession.messaging.notifications.TokenFetcher
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class NoOpTokenFetcher @Inject constructor() : TokenFetcher {
override suspend fun fetch(): String? = null
override val token: StateFlow<String?> = MutableStateFlow(null)
override fun onNewToken(token: String) {}
override suspend fun resetToken() {}
}

@ -12,4 +12,5 @@ interface TokenFetcher {
val token: StateFlow<String?>
fun onNewToken(token: String)
suspend fun resetToken()
}

@ -107,21 +107,20 @@ class Poller(
Log.d(TAG, "Polling...")
isPolling = true
var pollDelay = RETRY_INTERVAL_MS
try {
// check if the polling pool is empty
if (pollPool.isEmpty()){
// if it is empty, fill it with the snodes from our swarm
pollPool.addAll(SnodeAPI.getSwarm(userPublicKey).await())
}
// check if the polling pool is empty
if(pollPool.isEmpty()){
// if it is empty, fill it with the snodes from our swarm
pollPool.addAll(SnodeAPI.getSwarm(userPublicKey).await())
}
// randomly get a snode from the pool
val currentNode = pollPool.random()
// randomly get a snode from the pool
val currentNode = pollPool.random()
// remove that snode from the pool
pollPool.remove(currentNode)
// remove that snode from the pool
pollPool.remove(currentNode)
var pollDelay = RETRY_INTERVAL_MS
try {
poll(currentNode)
retryScalingFactor = 1f
} catch (e: Exception){

Loading…
Cancel
Save