mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add LogIn/LogOut event handlers to NativeShell
This commit is contained in:
parent
98814a5b66
commit
6b5eca7631
1 changed files with 11 additions and 2 deletions
|
@ -8,8 +8,12 @@ class ServerConnections extends ConnectionManager {
|
||||||
super(...arguments);
|
super(...arguments);
|
||||||
this.localApiClient = null;
|
this.localApiClient = null;
|
||||||
|
|
||||||
Events.on(this, 'localusersignedout', function () {
|
Events.on(this, 'localusersignedout', function (eventName, logoutInfo) {
|
||||||
setUserInfo(null, null);
|
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) {
|
onLocalUserSignedIn(user) {
|
||||||
const apiClient = this.getApiClient(user.ServerId);
|
const apiClient = this.getApiClient(user.ServerId);
|
||||||
this.setLocalApiClient(apiClient);
|
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();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue