Catch huawei init code

pull/1712/head
SessionHero01 3 weeks ago
parent 82c29e9f85
commit db18b8023c
No known key found for this signature in database

@ -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
@ -33,9 +34,13 @@ class HuaweiTokenFetcher @Inject constructor(
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)
}
}
}

Loading…
Cancel
Save