mattermost-desktop/api-types/lib/index.d.ts
Devin Binnie e1c957e774
Various QoL fixes for Desktop App (#2999)
* Some ESLint fixes

* Add login/logout signal to API, clear mentions on logout and flush cookies on login/logout

* Fix issue where local and HTTP-only servers would not validate correctly

* Reduce noise of renderer logging, adjust a few local renderer logs to be louder when needed

* Fallback to beginning of hostname for servers that don't change the site name

* Fix Save Image crash

* Update the name for insecure servers too

* Fix test

* Fix lint

* Reduce repetition
2024-04-08 09:12:35 -04:00

64 lines
2.6 KiB
TypeScript

export type DesktopSourcesOptions = {
types: Array<'screen' | 'window'>;
thumbnailSize?: {
height: number;
width: number;
};
fetchWindowIcons?: boolean;
};
export type DesktopCaptureSource = {
id: string;
name: string;
thumbnailURL: string;
};
export type DesktopAPI = {
isDev: () => Promise<boolean>;
getAppInfo: () => Promise<{
name: string;
version: string;
}>;
reactAppInitialized: () => void;
setSessionExpired: (isExpired: boolean) => void;
onUserActivityUpdate: (listener: (userIsActive: boolean, idleTime: number, isSystemEvent: boolean) => void) => () => void;
onLogin: () => void;
onLogout: () => void;
sendNotification: (title: string, body: string, channelId: string, teamId: string, url: string, silent: boolean, soundName: string) => Promise<{
result: string;
reason?: string;
data?: string;
}>;
onNotificationClicked: (listener: (channelId: string, teamId: string, url: string) => void) => () => void;
setUnreadsAndMentions: (isUnread: boolean, mentionCount: number) => void;
requestBrowserHistoryStatus: () => Promise<{
canGoBack: boolean;
canGoForward: boolean;
}>;
onBrowserHistoryStatusUpdated: (listener: (canGoBack: boolean, canGoForward: boolean) => void) => () => void;
onBrowserHistoryPush: (listener: (pathName: string) => void) => () => void;
sendBrowserHistoryPush: (path: string) => void;
joinCall: (opts: {
callID: string;
title: string;
rootID: string;
channelURL: string;
}) => Promise<{
callID: string;
sessionID: string;
}>;
leaveCall: () => void;
callsWidgetConnected: (callID: string, sessionID: string) => void;
resizeCallsWidget: (width: number, height: number) => void;
sendCallsError: (err: string, callID?: string, errMsg?: string) => void;
onCallsError: (listener: (err: string, callID?: string, errMsg?: string) => void) => () => void;
getDesktopSources: (opts: DesktopSourcesOptions) => Promise<DesktopCaptureSource[]>;
openScreenShareModal: () => void;
onOpenScreenShareModal: (listener: () => void) => () => void;
shareScreen: (sourceID: string, withAudio: boolean) => void;
onScreenShared: (listener: (sourceID: string, withAudio: boolean) => void) => () => void;
sendJoinCallRequest: (callId: string) => void;
onJoinCallRequest: (listener: (callID: string) => void) => () => void;
openLinkFromCalls: (url: string) => void;
focusPopout: () => void;
unregister: (channel: string) => void;
};