Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 0528cf8
Author: Filip Misztal <filip.jan.misztal@gmail.com>
Date:   Fri Sep 22 13:09:03 2023 +0200

    Use "use" to be more safe in case of failures + Nice syntax (#92)

    * Use use to be more safe

    * Even more idiomatic Kotlin

    ---------

    Co-authored-by: filip-misztal <filip.misztal@schibsted.com>
  • Loading branch information
bogdan-niculescu-sch committed Sep 22, 2023
1 parent 0c43bcf commit b7a9de4
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,15 @@ internal class SessionInfoManager(context: Context) {
}

private fun isSessionPresent(authority: String): Boolean {
val cursor =
contentResolver.query(
Uri.parse("content://${authority}/sessions"),
null,
null,
null,
null
)
val isSessionPresent = cursor?.count != null && cursor.count > 0
cursor?.close()
return isSessionPresent
return contentResolver.query(
Uri.parse("content://${authority}/sessions"),
null,
null,
null,
null
)?.use {
it.count > 0
} ?: false
}

suspend fun isUserLoggedInOnTheDevice(): Boolean {
Expand Down

0 comments on commit b7a9de4

Please sign in to comment.