Loading app/src/main/java/at/bitfire/davdroid/ReLoginWithOidcActivity.kt +19 −21 Original line number Diff line number Diff line Loading @@ -61,51 +61,49 @@ class ReLoginWithOidcActivity : AppCompatActivity() { private fun logoutAccount(account: Account) { val callback: (AliasFuture) -> Unit = { future -> val success = future.result.getBoolean(KEY_BOOLEAN_RESULT) val success = try { future.result.getBoolean(KEY_BOOLEAN_RESULT) } catch (exception: Exception) { Logger.log.warning("Cannot remove account: ${account.name} : ${exception.message}") false } if (success) { isAccountRemoved = true Logger.log.info("Vincent: Account removed. Now will sign in again with OIDC") loginAccount(eAccountType) } else { Logger.log.info("failed to remove /e/OS account") Handler(Looper.getMainLooper()).post { finishAndRemoveTask() } } } try { Logger.log.info("Vincent: about to call accountManager.removeAccount") accountManager.removeAccount(account, this, callback, null) } catch (exception: Exception) { Logger.log.warning("Cannot remove account: ${account.name} : ${exception.message}") finishAndRemoveTask() } } private fun loginAccount(accountType: String) { val callback: (AliasFuture) -> Unit = { future -> try { val accountName = future.result?.getString(KEY_ACCOUNT_NAME) if (accountName != null) { Logger.log.info("Account $accountName logged again") Logger.log.info("Vincent: Account $accountName logged again") } else { Logger.log.warning("No new account relogged") Logger.log.warning("Vincent: No new account relogged") } } catch (exception: Exception) { Logger.log.warning("${exception.javaClass}: can't add account: ${exception.message}") } Handler(Looper.getMainLooper()).post { finishAndRemoveTask() } } try { accountManager.addAccount(accountType,null, null, null, this, callback, null) } catch (exception: Exception) { Logger.log.warning("${exception.javaClass}: can't add account: ${exception.message}") finishAndRemoveTask() } } companion object { Loading Loading
app/src/main/java/at/bitfire/davdroid/ReLoginWithOidcActivity.kt +19 −21 Original line number Diff line number Diff line Loading @@ -61,51 +61,49 @@ class ReLoginWithOidcActivity : AppCompatActivity() { private fun logoutAccount(account: Account) { val callback: (AliasFuture) -> Unit = { future -> val success = future.result.getBoolean(KEY_BOOLEAN_RESULT) val success = try { future.result.getBoolean(KEY_BOOLEAN_RESULT) } catch (exception: Exception) { Logger.log.warning("Cannot remove account: ${account.name} : ${exception.message}") false } if (success) { isAccountRemoved = true Logger.log.info("Vincent: Account removed. Now will sign in again with OIDC") loginAccount(eAccountType) } else { Logger.log.info("failed to remove /e/OS account") Handler(Looper.getMainLooper()).post { finishAndRemoveTask() } } } try { Logger.log.info("Vincent: about to call accountManager.removeAccount") accountManager.removeAccount(account, this, callback, null) } catch (exception: Exception) { Logger.log.warning("Cannot remove account: ${account.name} : ${exception.message}") finishAndRemoveTask() } } private fun loginAccount(accountType: String) { val callback: (AliasFuture) -> Unit = { future -> try { val accountName = future.result?.getString(KEY_ACCOUNT_NAME) if (accountName != null) { Logger.log.info("Account $accountName logged again") Logger.log.info("Vincent: Account $accountName logged again") } else { Logger.log.warning("No new account relogged") Logger.log.warning("Vincent: No new account relogged") } } catch (exception: Exception) { Logger.log.warning("${exception.javaClass}: can't add account: ${exception.message}") } Handler(Looper.getMainLooper()).post { finishAndRemoveTask() } } try { accountManager.addAccount(accountType,null, null, null, this, callback, null) } catch (exception: Exception) { Logger.log.warning("${exception.javaClass}: can't add account: ${exception.message}") finishAndRemoveTask() } } companion object { Loading