Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Fixing crash (#585)
Browse files Browse the repository at this point in the history
- fixing crash when network call fails

Co-authored-by: John Oberhauser <j.git-global@obez.io>
  • Loading branch information
JohnOberhauser and John Oberhauser authored Jun 14, 2024
1 parent 5db7422 commit a9db4c6
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.first
import social.firefly.core.datastore.UserPreferencesDatastoreManager
import social.firefly.core.repository.mastodon.VerificationRepository
import timber.log.Timber

class UpdateAllLoggedInAccounts(
private val verificationRepository: VerificationRepository,
Expand All @@ -16,12 +17,17 @@ class UpdateAllLoggedInAccounts(
async {
val accessToken = dataStore.accessToken.first()
val domain = dataStore.domain.first()
verificationRepository.verifyUserCredentials(
accessToken,
domain,
)
try {
verificationRepository.verifyUserCredentials(
accessToken,
domain,
)
} catch (e: Exception) {
Timber.e(e)
null
}
}
}.map {
}.mapNotNull {
it.await()
}.forEach { account ->
userPreferencesDatastoreManager.dataStores.value.find {
Expand Down

0 comments on commit a9db4c6

Please sign in to comment.