cozy/cozy-bar

Properly unmount the bar on mobile app

Opened this issue · 1 comments

On Banks' mobile app, when the user logouts, we have to destroy the cozy-bar. Today, we are doing it by removing the DOM node (https://github.com/cozy/cozy-banks/blob/b794e588cbac644a3275ab28ef92f6ef13eb541b/src/ducks/mobile/utils.js#L12). But since the bar is adding some styles on the body when it's opened, we had to also remove these styles (https://github.com/cozy/cozy-banks/blob/b794e588cbac644a3275ab28ef92f6ef13eb541b/src/ducks/mobile/utils.js#L13).

It seems we should expose an API to just ask to unmount the cozy-bar (like destroy, unmount, whatever) so all these things could be managed properly by the bar. What do you think?

I agree, that it would be cleaner. To go a tiny bit further, I think the cozy-bar should act like a plugin of cozy-client. Links already act a bit like this, especially the cozy-pouch-link, their register method is called on login and their unregister method on logout. It's already a problem for me that the bar is relying on its own token (as the token can go stale etc...(, it should for me rely on the token of cozy-client.

It may be done later, but I think it would be a clean way to kill several birds with one stone.