Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b106dbb2 authored by mitulsheth's avatar mitulsheth
Browse files

feat: Murena Workspace Login and SSO 3

parent 65185bc6
Loading
Loading
Loading
Loading
Loading
+11 −14
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ package earth.maps.cardinal.data.murena
import android.accounts.Account
import android.accounts.AccountManager
import android.content.Context
import android.os.Build
import android.util.Log
import dagger.hilt.android.qualifiers.ApplicationContext
import earth.maps.cardinal.domain.murena.MurenaAccountConstants
@@ -36,7 +35,7 @@ class MurenaAccountProvider @Inject constructor(
        get() = AccountManager.get(context)

    fun getMurenaAccounts(): List<Account> {
        return queryVisibleMurenaAccounts()
        return findVisibleMurenaAccounts()
    }

    fun getPrimaryMurenaAccount(): Account? {
@@ -47,7 +46,7 @@ class MurenaAccountProvider @Inject constructor(
        return getPrimaryMurenaAccount() != null
    }

    private fun queryVisibleMurenaAccounts(): List<Account> {
    private fun findVisibleMurenaAccounts(): List<Account> {
        val accountType = MurenaAccountConstants.MURENA_ACCOUNT_TYPE
        val accountsByType = queryAccounts("getAccountsByType") {
            accountManager.getAccountsByType(accountType).toList()
@@ -56,7 +55,6 @@ class MurenaAccountProvider @Inject constructor(
            return accountsByType
        }

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        val accountsForPackage = queryAccounts("getAccountsByTypeForPackage") {
            accountManager.getAccountsByTypeForPackage(accountType, context.packageName).toList()
        }
@@ -68,7 +66,6 @@ class MurenaAccountProvider @Inject constructor(
        if (visibilityAccounts.isNotEmpty()) {
            return visibilityAccounts
        }
        }

        return emptyList()
    }