Skip to content
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

trigger onDisconnect when disconnect method is called #76

Merged
merged 4 commits into from
Nov 28, 2017

Conversation

faogustavo
Copy link
Contributor

No description provided.

@faogustavo faogustavo changed the title trigger on disconnect when disconnect method is called trigger onDisconnect when disconnect method is called Nov 13, 2017
As the management of connection status in on JS, we should keep the default callbacks to ensure this data. Without then, if I remove all listeners and add a new for connect/disconnect, I will not be able to disconnect again :)
NativeAppEventEmitter.addListener(map.loginError, this.onLoginError),
NativeAppEventEmitter.addListener(map.login, this.onLogin),
];

Copy link
Owner

Choose a reason for hiding this comment

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

Could you clarify this change? Why this.listener = this.listeners? Why to add listeners within removeListeners method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wow, sorry, that wasn't right. Already fixed it.
The change is to invoke onDisconnected when disconnected by code.
All callbacks must be setted again because all logic (if the lib is connected or not) is on the JS, so we need to listen the events to change the values.
When I did not added that all default listeners, and I got disconnected (eg. logout button), and remove all listeners, I was not able to create a new connection (JS var did not updated). Keeping these prevent this to occur.

@aksonov aksonov merged commit 123c078 into aksonov:master Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants