mirror of
https://github.com/etesync/android
synced 2024-12-23 15:18:14 +00:00
Improve logging for login/account creation
This commit is contained in:
parent
2b88ad6896
commit
bf1acb1ff5
@ -70,10 +70,10 @@ class BaseConfigurationFinder(protected val context: Context, protected val cred
|
|||||||
val userInfoManager = UserInfoManager(authenticatedHttpClient, uri.toHttpUrlOrNull()!!)
|
val userInfoManager = UserInfoManager(authenticatedHttpClient, uri.toHttpUrlOrNull()!!)
|
||||||
userInfo = userInfoManager.fetch(credentials.userName)
|
userInfo = userInfoManager.fetch(credentials.userName)
|
||||||
} catch (e: Exceptions.HttpException) {
|
} catch (e: Exceptions.HttpException) {
|
||||||
Logger.log.warning(e.message)
|
Logger.log.warning(e.localizedMessage)
|
||||||
exception = e
|
exception = e
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
Logger.log.warning(e.message)
|
Logger.log.warning(e.localizedMessage)
|
||||||
exception = e
|
exception = e
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,6 +98,7 @@ class BaseConfigurationFinder(protected val context: Context, protected val cred
|
|||||||
val etebase = Account.login(client, credentials.userName, credentials.password)
|
val etebase = Account.login(client, credentials.userName, credentials.password)
|
||||||
etebaseSession = etebase.save(null)
|
etebaseSession = etebase.save(null)
|
||||||
} catch (e: EtebaseException) {
|
} catch (e: EtebaseException) {
|
||||||
|
Logger.log.warning(e.localizedMessage)
|
||||||
exception = e
|
exception = e
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,8 +115,10 @@ class BaseConfigurationFinder(protected val context: Context, protected val cred
|
|||||||
fun findInitialConfiguration(): Configuration {
|
fun findInitialConfiguration(): Configuration {
|
||||||
try {
|
try {
|
||||||
if (isServerEtebase()) {
|
if (isServerEtebase()) {
|
||||||
|
Logger.log.fine("Attempting to login to etebase")
|
||||||
return findInitialConfigurationEtebase()
|
return findInitialConfigurationEtebase()
|
||||||
} else {
|
} else {
|
||||||
|
Logger.log.fine("Attempting to login to EteSync legacy")
|
||||||
return findInitialConfigurationLegacy()
|
return findInitialConfigurationLegacy()
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
@ -39,6 +39,7 @@ class DetectConfigurationFragment : DialogFragment(), LoaderManager.LoaderCallba
|
|||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
Logger.log.fine("DetectConfigurationFragment: loading")
|
||||||
loaderManager.initLoader(0, arguments, this)
|
loaderManager.initLoader(0, arguments, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,17 +50,20 @@ class DetectConfigurationFragment : DialogFragment(), LoaderManager.LoaderCallba
|
|||||||
override fun onLoadFinished(loader: Loader<Configuration>, data: Configuration?) {
|
override fun onLoadFinished(loader: Loader<Configuration>, data: Configuration?) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
if (data.isFailed) {
|
if (data.isFailed) {
|
||||||
|
Logger.log.warning("Failed login configuration ${data.error?.localizedMessage}")
|
||||||
// no service found: show error message
|
// no service found: show error message
|
||||||
requireFragmentManager().beginTransaction()
|
requireFragmentManager().beginTransaction()
|
||||||
.add(NothingDetectedFragment.newInstance(data.error!!.localizedMessage), null)
|
.add(NothingDetectedFragment.newInstance(data.error!!.localizedMessage), null)
|
||||||
.commitAllowingStateLoss()
|
.commitAllowingStateLoss()
|
||||||
} else if (data.isLegacy) {
|
} else if (data.isLegacy) {
|
||||||
// legacy service found: continue
|
// legacy service found: continue
|
||||||
|
Logger.log.info("Found legacy account - asking for encryption details")
|
||||||
requireFragmentManager().beginTransaction()
|
requireFragmentManager().beginTransaction()
|
||||||
.replace(android.R.id.content, EncryptionDetailsFragment.newInstance(data))
|
.replace(android.R.id.content, EncryptionDetailsFragment.newInstance(data))
|
||||||
.addToBackStack(null)
|
.addToBackStack(null)
|
||||||
.commitAllowingStateLoss()
|
.commitAllowingStateLoss()
|
||||||
} else {
|
} else {
|
||||||
|
Logger.log.info("Found Etebase account account")
|
||||||
requireFragmentManager().beginTransaction()
|
requireFragmentManager().beginTransaction()
|
||||||
.replace(android.R.id.content, CreateAccountFragment.newInstance(data))
|
.replace(android.R.id.content, CreateAccountFragment.newInstance(data))
|
||||||
.addToBackStack(null)
|
.addToBackStack(null)
|
||||||
|
Loading…
Reference in New Issue
Block a user