Add login/logout signal to Desktop App API (#26701)

This commit is contained in:
Devin Binnie 2024-04-09 09:16:07 -04:00 committed by GitHub
parent 9698cfcc19
commit 65c6717e6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 11 additions and 6 deletions

View File

@ -13,7 +13,7 @@
"@mattermost/client": "*", "@mattermost/client": "*",
"@mattermost/compass-components": "^0.2.12", "@mattermost/compass-components": "^0.2.12",
"@mattermost/compass-icons": "0.1.39", "@mattermost/compass-icons": "0.1.39",
"@mattermost/desktop-api": "5.7.0-1", "@mattermost/desktop-api": "5.8.0-4",
"@mattermost/types": "*", "@mattermost/types": "*",
"@mui/base": "5.0.0-alpha.127", "@mui/base": "5.0.0-alpha.127",
"@mui/material": "5.11.16", "@mui/material": "5.11.16",

View File

@ -44,6 +44,7 @@ import SubMenuModal from 'components/widgets/menu/menu_modals/submenu_modal/subm
import WebSocketClient from 'client/web_websocket_client'; import WebSocketClient from 'client/web_websocket_client';
import {getHistory} from 'utils/browser_history'; import {getHistory} from 'utils/browser_history';
import {ActionTypes, PostTypes, RHSStates, ModalIdentifiers, PreviousViewedTypes} from 'utils/constants'; import {ActionTypes, PostTypes, RHSStates, ModalIdentifiers, PreviousViewedTypes} from 'utils/constants';
import DesktopApp from 'utils/desktop_api';
import {filterAndSortTeamsByDisplayName} from 'utils/team_utils'; import {filterAndSortTeamsByDisplayName} from 'utils/team_utils';
import * as Utils from 'utils/utils'; import * as Utils from 'utils/utils';
@ -249,6 +250,7 @@ export function emitUserLoggedOutEvent(redirectTo = '/', shouldSignalLogout = tr
dispatch(logout()).then(() => { dispatch(logout()).then(() => {
if (shouldSignalLogout) { if (shouldSignalLogout) {
BrowserStore.signalLogout(); BrowserStore.signalLogout();
DesktopApp.signalLogout();
} }
WebsocketActions.close(); WebsocketActions.close();

View File

@ -106,6 +106,7 @@ export default class LoggedIn extends React.PureComponent<Props> {
if (this.isValidState() && !this.props.mfaRequired) { if (this.isValidState() && !this.props.mfaRequired) {
BrowserStore.signalLogin(); BrowserStore.signalLogin();
DesktopApp.signalLogin();
} }
} }

View File

@ -206,6 +206,8 @@ class DesktopAppAPI {
updateUnreadsAndMentions = (isUnread: boolean, mentionCount: number) => updateUnreadsAndMentions = (isUnread: boolean, mentionCount: number) =>
window.desktopAPI?.setUnreadsAndMentions && window.desktopAPI.setUnreadsAndMentions(isUnread, mentionCount); window.desktopAPI?.setUnreadsAndMentions && window.desktopAPI.setUnreadsAndMentions(isUnread, mentionCount);
setSessionExpired = (expired: boolean) => window.desktopAPI?.setSessionExpired && window.desktopAPI.setSessionExpired(expired); setSessionExpired = (expired: boolean) => window.desktopAPI?.setSessionExpired && window.desktopAPI.setSessionExpired(expired);
signalLogin = () => window.desktopAPI?.onLogin && window.desktopAPI?.onLogin();
signalLogout = () => window.desktopAPI?.onLogout && window.desktopAPI?.onLogout();
/********************************************************************* /*********************************************************************
* Helper functions for legacy code * Helper functions for legacy code

View File

@ -62,7 +62,7 @@
"@mattermost/client": "*", "@mattermost/client": "*",
"@mattermost/compass-components": "^0.2.12", "@mattermost/compass-components": "^0.2.12",
"@mattermost/compass-icons": "0.1.39", "@mattermost/compass-icons": "0.1.39",
"@mattermost/desktop-api": "5.7.0-1", "@mattermost/desktop-api": "5.8.0-4",
"@mattermost/types": "*", "@mattermost/types": "*",
"@mui/base": "5.0.0-alpha.127", "@mui/base": "5.0.0-alpha.127",
"@mui/material": "5.11.16", "@mui/material": "5.11.16",
@ -4290,11 +4290,11 @@
"link": true "link": true
}, },
"node_modules/@mattermost/desktop-api": { "node_modules/@mattermost/desktop-api": {
"version": "5.7.0-1", "version": "5.8.0-4",
"resolved": "https://registry.npmjs.org/@mattermost/desktop-api/-/desktop-api-5.7.0-1.tgz", "resolved": "https://registry.npmjs.org/@mattermost/desktop-api/-/desktop-api-5.8.0-4.tgz",
"integrity": "sha512-3VdmrdiGwqXpLGomRWiDt8L2LMlOyeAP+S9uKm82JpRt8HoVFeSe9fu39VV9pbnA8O6u6wfnwGUXFeasmmIIkQ==", "integrity": "sha512-oEbh3ByDgM432LrjO9JsRnIwqBIAkF6bJaQkHjYeQAYwkI4/s4CSQ4kZcfMiO9hE0MjfF1VeXnGTBv9wyWsbAw==",
"peerDependencies": { "peerDependencies": {
"typescript": "^4.3" "typescript": "^4.3.0 || ^5.0.0"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
"typescript": { "typescript": {