Loading app/src/main/kotlin/at/bitfire/davdroid/db/ServiceDao.kt +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ interface ServiceDao { suspend fun getByAccountAndType(accountName: String, @ServiceType type: String): Service? @Query("SELECT * FROM service WHERE accountName=:accountName") suspend fun getByAccountName(accountName: String): Service? suspend fun getByAccountName(accountName: String): List<Service?> @Query("SELECT * FROM service WHERE accountName=:accountName AND type=:type") fun getByAccountAndTypeFlow(accountName: String, @ServiceType type: String): Flow<Service?> Loading app/src/main/kotlin/com/owncloud/android/ui/activity/SsoGrantPermissionViewModel.kt +7 −3 Original line number Diff line number Diff line Loading @@ -117,11 +117,15 @@ class SsoGrantPermissionViewModel @Inject constructor( private suspend fun getUserId(account: Account): String { val accountManager = AccountManager.get(context) val userId = accountManager.getUserData(account, AccountUtils.Constants.KEY_USER_ID) if (!userId.isNullOrBlank()) return userId accountManager.getUserData(account, AccountUtils.Constants.KEY_USER_ID) ?.takeIf { it.isNotBlank() } ?.let { return it } val principalUrl = database.serviceDao() .getByAccountName(account.name)?.principal?.toString() .getByAccountName(account.name) .firstOrNull() ?.principal ?.toString() return principalUrl?.let { UserIdFetcher.fetch(it) } ?: account.name } Loading Loading
app/src/main/kotlin/at/bitfire/davdroid/db/ServiceDao.kt +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ interface ServiceDao { suspend fun getByAccountAndType(accountName: String, @ServiceType type: String): Service? @Query("SELECT * FROM service WHERE accountName=:accountName") suspend fun getByAccountName(accountName: String): Service? suspend fun getByAccountName(accountName: String): List<Service?> @Query("SELECT * FROM service WHERE accountName=:accountName AND type=:type") fun getByAccountAndTypeFlow(accountName: String, @ServiceType type: String): Flow<Service?> Loading
app/src/main/kotlin/com/owncloud/android/ui/activity/SsoGrantPermissionViewModel.kt +7 −3 Original line number Diff line number Diff line Loading @@ -117,11 +117,15 @@ class SsoGrantPermissionViewModel @Inject constructor( private suspend fun getUserId(account: Account): String { val accountManager = AccountManager.get(context) val userId = accountManager.getUserData(account, AccountUtils.Constants.KEY_USER_ID) if (!userId.isNullOrBlank()) return userId accountManager.getUserData(account, AccountUtils.Constants.KEY_USER_ID) ?.takeIf { it.isNotBlank() } ?.let { return it } val principalUrl = database.serviceDao() .getByAccountName(account.name)?.principal?.toString() .getByAccountName(account.name) .firstOrNull() ?.principal ?.toString() return principalUrl?.let { UserIdFetcher.fetch(it) } ?: account.name } Loading