-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes issue #1783 #1790
Fixes issue #1783 #1790
Conversation
…and not all connections. It goes to the home screen after there are no remaining connections.
Pull reviewers statsStats of the last 30 days for popstellar:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement! I think it would be nice to add a small tsdoc for the return value but also let me know what you think of my other remarks/questions :)
@@ -139,7 +139,10 @@ class NetworkManager { | |||
|
|||
if (alwaysPersistConnection) { | |||
// always push the connection to the array so that we can re-connect later | |||
this.connections.push(connection); | |||
// if it doesn't already exist to avoid duplicates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great improvement! Do you think it makes sense to use a set instead of an array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arrays in Typescript have useful functions that Sets do not.
I see that sets can be useful because of the uniqueness of their elements, but due to the above point, I'd say we keep it as an array. I don't think that checking if a connection already exists in the array is going to introduce much overhead considering that the array is probably not going to be that big.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just wondering since I would have assumed that we only need a small set of operations on that but if not we‘ll keep it, sure :)
@@ -162,14 +165,16 @@ class NetworkManager { | |||
} | |||
} | |||
|
|||
public disconnectFrom(address: string, intentional = true): void { | |||
public disconnectFrom(address: string, intentional = true): Number { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a tsdoc describing the return value? Also did you intentionally chose to return Number
and not number
? (https://stackoverflow.com/a/67155149)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tsdoc can be useful to have.
No, it was not intentional and I just learned about the difference between them from the link you shared. Thank you. Will be switching to number
instead.
Quality Gate passed for 'PoP - PoPCHA-Web-Client'Issues Measures |
Quality Gate passed for 'PoP - Be2-Scala'Issues Measures |
Quality Gate passed for 'PoP - Be1-Go'Issues Measures |
Quality Gate passed for 'PoP - Fe2-Android'Issues Measures |
Quality Gate passed for 'PoP - Fe1-Web'Issues Measures |
In case a connection dies, it now only disconnects from that connection and not all connections (considering that there are multiple connections). When there are no remaining connections, it navigates the to the home screen.