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

Commit 5792b76a authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

chore: improve according to code review

- update constants variable name
- fix log level
parent c971f582
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ class HttpClient private constructor(
            okHttpClient.cache?.close()
            authService?.dispose()
        } catch (e: Exception) {
           Logger.log.log(Level.SEVERE, "failed to clear resource on close httpClient", e)
           Logger.log.log(Level.INFO, "failed to clear resource on close httpClient", e)
        }
    }

+2 −4
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
@@ -18,14 +17,13 @@ import androidx.fragment.app.viewModels
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import at.bitfire.davdroid.Constants
import at.bitfire.davdroid.ECloudAccountHelper
import at.bitfire.davdroid.R
import at.bitfire.davdroid.db.Credentials
import at.bitfire.davdroid.log.Logger
import at.bitfire.davdroid.servicedetection.DavResourceFinder
import at.bitfire.davdroid.ui.DebugInfoActivity
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import at.bitfire.davdroid.ECloudAccountHelper
import java.lang.ref.WeakReference
import java.net.URI
import java.util.logging.Level
@@ -47,7 +45,7 @@ class DetectConfigurationFragment: Fragment() {
            return
        }

        val blockOnUnauthorizedException = (accountType == getString(R.string.eelo_account_type)) && !EeloAuthenticatorModel.enableOpenIdSupport
        val blockOnUnauthorizedException = (accountType == getString(R.string.eelo_account_type)) && !EeloAuthenticatorModel.ENABLE_OIDC_SUPPORT

        val baseURI = loginModel.baseURI ?: return

+4 −4
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ class EeloAuthenticatorFragment : Fragment() {
        passwordEditText = v.root.findViewById(R.id.urlpwd_password)
        passwordHolder = v.root.findViewById(R.id.password_holder)

        passwordHolder.isVisible = !EeloAuthenticatorModel.enableOpenIdSupport
        passwordHolder.isVisible = !EeloAuthenticatorModel.ENABLE_OIDC_SUPPORT

        serverToggleButton.setOnClickListener { expandCollapse() }

@@ -87,7 +87,7 @@ class EeloAuthenticatorFragment : Fragment() {

        val tfaButton = v.root.findViewById<View>(R.id.twofa_info_button)
        tfaButton.setOnClickListener { show2FAInfoDialog() }
        tfaButton.isVisible = !EeloAuthenticatorModel.enableOpenIdSupport
        tfaButton.isVisible = !EeloAuthenticatorModel.ENABLE_OIDC_SUPPORT

        userIdEditText.doOnTextChanged { text, _, _, _ ->
            val domain = computeDomain(text)
@@ -205,7 +205,7 @@ class EeloAuthenticatorFragment : Fragment() {
    private fun login() {
        handleNoNetworkAvailable()

        val handleOpenIdAuth = EeloAuthenticatorModel.enableOpenIdSupport && !toggleButtonState
        val handleOpenIdAuth = EeloAuthenticatorModel.ENABLE_OIDC_SUPPORT && !toggleButtonState
        val userId = userIdEditText.text.toString()
        val password = passwordEditText.text.toString()

@@ -306,7 +306,7 @@ class EeloAuthenticatorFragment : Fragment() {
            serverUrlEditText.isEnabled = false
            toggleButtonState = false

            if(!EeloAuthenticatorModel.enableOpenIdSupport) {
            if(!EeloAuthenticatorModel.ENABLE_OIDC_SUPPORT) {
                return
            }

+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ class EeloAuthenticatorModel(application: Application) : AndroidViewModel(applic
    companion object {
        // as https://gitlab.e.foundation/e/backlog/-/issues/6287 is blocked, the openId implementation is not ready yet.
        // But we want to push the changes so later we won't face any conflict. So we are disabling the openId feature for now.
        const val enableOpenIdSupport = true
        const val ENABLE_OIDC_SUPPORT = true
    }

    private var initialized = false