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

Commit 70087113 authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

chore: add debug instruction to find where to triggers notification. Commit to...

chore: add debug instruction to find where to triggers notification. Commit to remove before merging MR
parent 59681d50
Loading
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
package at.bitfire.davdroid.servicedetection

import android.content.Context
import android.util.Log
import at.bitfire.dav4jvm.DavResource
import at.bitfire.dav4jvm.Property
import at.bitfire.dav4jvm.Response
@@ -483,8 +484,10 @@ class DavResourceFinder(
     *   - Re-throws the exception if it signals that the current thread was interrupted to stop the current operation.
     */
    private fun processException(e: Exception) {
        if (e is UnauthorizedException)
        if (e is UnauthorizedException) {
            encountered401 = true
            Log.d("DAVResourceFinder.processException()", "encountered401 is set to true")
        }
        else if ((e is InterruptedIOException && e !is SocketTimeoutException) || e is InterruptedException)
            throw e

+5 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ package at.bitfire.davdroid.ui.setup
import android.app.Application
import android.app.Dialog
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -68,6 +69,7 @@ class DetectConfigurationFragment: Fragment() {
            } else if(requireActivity().intent.getBooleanExtra(LoginActivity.RETRY_ON_401, false) && loginModel.configuration?.encountered401 == true) {
                // murena account has encounters 401, most-probably user put wrong accountId (ex: abc@murena.io instead of abc@e.email)
                // do nothing, EeloAuthenticatorFragment will retry with another time with another user email
                Log.d("DetectConfigurationFragment.onCreate()", "encountered error 401. L72")
                return@observe
            } else {
                requireActivity().intent.putExtra(LoginActivity.RETRY_ON_401, false)
@@ -139,8 +141,10 @@ class DetectConfigurationFragment: Fragment() {

        override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
            var message = getString(R.string.login_no_caldav_carddav)
            if (model.configuration?.encountered401 == true)
            if (model.configuration?.encountered401 == true) {
                message += "\n\n" + getString(R.string.login_username_password_wrong)
                Log.d("DetectConfigurationFragment.NothingDetectedFragment.onCreateDialog()", "config encountered401")
            }

            return MaterialAlertDialogBuilder(requireActivity(), R.style.CustomAlertDialogStyle)
                    .setTitle(R.string.login_configuration_detection)
+3 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.Context
import android.content.Intent
import android.net.ConnectivityManager
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -130,6 +131,7 @@ class EeloAuthenticatorFragment : Fragment() {
        if (requireActivity().intent.getBooleanExtra(LoginActivity.RETRY_ON_401, false) && switchUserName()) {
            // user wants to login with murena account, but most probably provided wrong accountId as email.
            // switching email is done, retry login
            Log.d("EeloAuthenticatorFragment.onResume()", "encountered error 401 L134.")
            login()
            requireActivity().intent.putExtra(LoginActivity.RETRY_ON_401, false) // disable retry option to mitigate infinite looping
        }
@@ -231,6 +233,7 @@ class EeloAuthenticatorFragment : Fragment() {
    // if user in any case provide wrong accountId as email (ex: abc@murena.io instead of abc@e.email)
    private fun addSupportRetryOn401IfPossible(serverUrl: String) {
        if ("https://${Constants.EELO_SYNC_HOST}" == serverUrl) {
            Log.d("EeloAuthenticatoFragment.addSupportRetryOn401IfPossible", "intent.putExtra (retryon on 401 = true) L236")
            requireActivity().intent.putExtra(LoginActivity.RETRY_ON_401, true)
        }
    }