Repository navigation
Maintain session with server - #141
Conversation
…for server >= 9.1
…ient instances that keep session or not depending on the server version
|
@davivel, thanks for your PR! By analyzing the history of the files in this pull request, we identified @jabarros and @LukasReschke to be potential reviewers. |
| @Override | ||
| public OwnCloudClient removeClientFor(OwnCloudAccount account) { | ||
| OwnCloudClient clientRemoved = mSimpleFactoryManager.removeClientFor(account); | ||
| OwnCloudClient clientRemoved2 = mSingleSessionManager.removeClientFor(account); |
There was a problem hiding this comment.
Using a number in a variable is not such a good idea.If in the future you have more clientRemoved variables, you will continue increasing the number and the variable name will not help to distinguish it from others. You could use instead clientRemovedFactory and clientRemovedSession or something like that.
There was a problem hiding this comment.
Sure.
But if in the future we have to add more vars there, please, kill me :D
| public OwnCloudClient removeClientFor(OwnCloudAccount account) { | ||
| OwnCloudClient clientRemoved = mSimpleFactoryManager.removeClientFor(account); | ||
| OwnCloudClient clientRemoved2 = mSingleSessionManager.removeClientFor(account); | ||
| if (clientRemoved2 != null) { |
There was a problem hiding this comment.
Is there any reason why you are checking clientRemoved2 before than clientRemoved? I would do first the clientRemoved null checking, because this variable has been created before but It's not really important to change... 😉
There was a problem hiding this comment.
Indeed, there is. In the case that something goes terribly wrong and both variables are not NULL, I expect less troubles if we return the session-based client and let the caller do whatever it needs to do with it that if we return the other one and prevent the caller do whatever it needs. The factory-based client is all the time creating instance, that are used once an then become trash for the app; the session-based client is not used so happily.
There was a problem hiding this comment.
Got it, thanks for the explanation
|
👍 |
No description provided.