Skip to content

Commit

Permalink
fix: ANR relater to isFederated function
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamadJaara committed Feb 5, 2024
1 parent e688160 commit e888167
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class FederatedIdMapperImpl internal constructor(
private val sessionRepository: SessionRepository,
) : FederatedIdMapper {

private fun isFederationEnabled() = sessionRepository.isFederated(selfUserId).fold(
private suspend fun isFederationEnabled() = sessionRepository.isFederated(selfUserId).fold(
{ false },
{ it }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ interface SessionRepository {
suspend fun ssoId(userId: UserId): Either<StorageFailure, SsoIdEntity?>
suspend fun updatePersistentWebSocketStatus(userId: UserId, isPersistentWebSocketEnabled: Boolean): Either<StorageFailure, Unit>
suspend fun updateSsoIdAndScimInfo(userId: UserId, ssoId: SsoId?, managedBy: ManagedByDTO?): Either<StorageFailure, Unit>
fun isFederated(userId: UserId): Either<StorageFailure, Boolean>
suspend fun isFederated(userId: UserId): Either<StorageFailure, Boolean>
suspend fun getAllValidAccountPersistentWebSocketStatus(): Either<StorageFailure, Flow<List<PersistentWebSocketStatus>>>
suspend fun persistentWebSocketStatus(userId: UserId): Either<StorageFailure, Boolean>
suspend fun cookieLabel(userId: UserId): Either<StorageFailure, String?>
Expand Down Expand Up @@ -195,7 +195,7 @@ internal class SessionDataSource internal constructor(
accountsDAO.updateSsoIdAndScimInfo(userId.toDao(), idMapper.toSsoIdEntity(ssoId), managedBy?.toDao())
}

override fun isFederated(userId: UserId): Either<StorageFailure, Boolean> = wrapStorageRequest {
override suspend fun isFederated(userId: UserId): Either<StorageFailure, Boolean> = wrapStorageRequest {
accountsDAO.isFederated(userId.toDao())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ interface AccountsDAO {
suspend fun allValidAccountList(): List<AccountInfoEntity>
fun observerValidAccountList(): Flow<List<AccountInfoEntity>>
suspend fun observeAllAccountList(): Flow<List<AccountInfoEntity>>
fun isFederated(userIDEntity: UserIDEntity): Boolean?
suspend fun isFederated(userIDEntity: UserIDEntity): Boolean?
suspend fun doesValidAccountExists(userIDEntity: UserIDEntity): Boolean
suspend fun currentAccount(): AccountInfoEntity?
fun observerCurrentAccount(): Flow<AccountInfoEntity?>
Expand Down Expand Up @@ -189,8 +189,9 @@ internal class AccountsDAOImpl internal constructor(
.flowOn(queriesContext)
.mapToList()

override fun isFederated(userIDEntity: UserIDEntity): Boolean? =
override suspend fun isFederated(userIDEntity: UserIDEntity): Boolean? = withContext(queriesContext) {
queries.isFederationEnabled(userIDEntity).executeAsOneOrNull()
}

override suspend fun doesValidAccountExists(userIDEntity: UserIDEntity): Boolean = withContext(queriesContext) {
queries.doesValidAccountExist(userIDEntity).executeAsOne()
Expand Down

0 comments on commit e888167

Please sign in to comment.