diff --git a/src/components/ServerConnections.js b/src/components/ServerConnections.js index 0242e549c..e30bdce0c 100644 --- a/src/components/ServerConnections.js +++ b/src/components/ServerConnections.js @@ -8,8 +8,12 @@ class ServerConnections extends ConnectionManager { super(...arguments); this.localApiClient = null; - Events.on(this, 'localusersignedout', function () { + Events.on(this, 'localusersignedout', function (eventName, logoutInfo) { setUserInfo(null, null); + + if (window.NativeShell && typeof window.NativeShell.onLocalUserSignedOut === 'function') { + window.NativeShell.onLocalUserSignedOut(logoutInfo); + } }); } @@ -62,7 +66,12 @@ class ServerConnections extends ConnectionManager { onLocalUserSignedIn(user) { const apiClient = this.getApiClient(user.ServerId); this.setLocalApiClient(apiClient); - return setUserInfo(user.Id, apiClient); + return setUserInfo(user.Id, apiClient).then(() => { + if (window.NativeShell && typeof window.NativeShell.onLocalUserSignedIn === 'function') { + return window.NativeShell.onLocalUserSignedIn(user, apiClient.accessToken()); + } + return Promise.resolve(); + }); } }