Android Version: 5.0

Hi @YDrall ,
Edit: Oh, sorry, I misinterpreted the animation. The issue here is that logging out takes you back to the contributions screen, yes?
@misaochan Yes, Exactly!
In CommonsApplication we have a loop
Account[] allAccounts = accountManager.getAccountsByType(AccountUtil.accountType());
for (Account allAccount : allAccounts) {
accountManager.removeAccount(allAccount, null, null);
}
The removeAccount() method returns an AccountManagerFuture indicating that removing the account is an asynchronous operation. Also, we are passing null for the second argument - the AccountManagerCallback - which will be called when the operation completes.
I believe the bug stems from a race condition where the account manager still isn't done deleting the account and we transition into the LoginActivity where in onResume() there's a check that skips us on by calling ContributionsActivity.startYourself(this)
I believe that simply calling getResult() on the AccountManagerFuture will cause it to block until the delete finishes. That should make the loop safe and function the way we're expecting it to. I've not been able to reproduce the error on my phone so cant tell if it fixes things though.
Hi, I am brand new to the code base, but the explanation provided by @psh makes much sense. I have been able to reproduce the issue fairly consistently, so I was wondering if I could give a shot at fixing this? Unless of course someone else has already taken care of it.
@Bluesir9 Absolutely, please feel free to try and fix this. Thanks! :)
Do we need to handle any kind of errors in this? As in, if the callback throws an error, should we just swallow it and move on or should some kind of visual indication be shown to the user?
Is this issue still open ? I tested the app on my phone and it worked fine with log in and log out. If it is open, can I work on it ?
@abhishekd08 I am currently working on this one, in fact I am almost done. Have a look around, there are quite a few issues that could use some help!
Is the issue still open @YDrall ? Can i work on it?
@Bluesir9 It would depend on the type of error, but in this case I don't think there is a need to display any visual indication to the user. Please catch potential exceptions and log them, though.
@Kartik2016 and @abhishekd08 Thank you for your interest! However, lets give @Bluesir9 a chance to finish this, shall we? ;) Please feel free to browse through our issues and ask, if a particular one catches your interest. https://github.com/commons-app/apps-android-commons/labels/beginner%20friendly could be a good start (and I will add some more issues to that tonight), but you don't have to restrict yourself to those if you don't want to.
Ok. Thank you. I am an absolute begginer. I'll browse through other begginer friendly issues too.
@misaochan thanks for your support, I am also a complete beginner. I will try to find some other beginner friendly issues.
Closed by PR #856
Most helpful comment
In
CommonsApplicationwe have a loopThe
removeAccount()method returns anAccountManagerFutureindicating that removing the account is an asynchronous operation. Also, we are passing null for the second argument - theAccountManagerCallback- which will be called when the operation completes.I believe the bug stems from a race condition where the account manager still isn't done deleting the account and we transition into the
LoginActivitywhere inonResume()there's a check that skips us on by callingContributionsActivity.startYourself(this)I believe that simply calling
getResult()on theAccountManagerFuturewill cause it to block until the delete finishes. That should make the loop safe and function the way we're expecting it to. I've not been able to reproduce the error on my phone so cant tell if it fixes things though.