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

Verified Commit e4a5ac15 authored by Romain Hunault's avatar Romain Hunault 💻
Browse files

refactor(auth): rename Murena offline access flow helper

Rename isOfflineAccessRequested() to hasRequestedOfflineAccess() to make the condition read as flow state instead of granted access.

The previous name made the negated branch look backwards in onAuthenticationComplete(), while the flag actually tracks whether the offline_access step has already been requested. The new wording matches the intent extra semantics without implying that offline access has already been granted.
parent b1a9de53
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ class MurenaOpenIdAuthFragment : OpenIdAuthenticationBaseFragment(IdentityProvid
    }

    override fun onAuthenticationComplete(userData: JSONObject) {
        if (!isOfflineAccessRequested()) {
        if (!hasRequestedOfflineAccess()) {
            requestOfflineAccess()
            return
        }
@@ -82,7 +82,7 @@ class MurenaOpenIdAuthFragment : OpenIdAuthenticationBaseFragment(IdentityProvid
        proceedNext(userName, "$baseUrl$userName")
    }

    private fun isOfflineAccessRequested(): Boolean {
    private fun hasRequestedOfflineAccess(): Boolean {
        return requireActivity().intent.getBooleanExtra(
            LoginActivity.MURENA_OFFLINE_ACCESS_REQUESTED,
            false