Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Maintain session with server - #141

Merged
davivel merged 3 commits into
masterfrom
maintain_session_with_server
Dec 16, 2016
Merged

davivel merged 3 commits into
masterfrom
maintain_session_with_server

Conversation

@davivel

@davivel davivel commented Dec 15, 2016

Copy link
Copy Markdown
Contributor

No description provided.

@mention-bot

Copy link
Copy Markdown

@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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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... 😉

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@davigonz davigonz Dec 16, 2016 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks for the explanation

@davigonz

Copy link
Copy Markdown
Contributor

👍

@davivel
davivel merged commit 8ced17a into master Dec 16, 2016
@davivel
davivel deleted the maintain_session_with_server branch December 16, 2016 09:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants