Fix logging for in call close confirmation
This commit is contained in:
parent
041347e30d
commit
9b781826a7
2 changed files with 16 additions and 18 deletions
|
@ -19,7 +19,7 @@ import type { ConversationType } from '../state/ducks/conversations';
|
||||||
import { calling } from '../services/calling';
|
import { calling } from '../services/calling';
|
||||||
import { resolveUsernameByLinkBase64 } from '../services/username';
|
import { resolveUsernameByLinkBase64 } from '../services/username';
|
||||||
import { writeProfile } from '../services/writeProfile';
|
import { writeProfile } from '../services/writeProfile';
|
||||||
import { isInCall as getIsInCall } from '../state/selectors/calling';
|
import { isInCall } from '../state/selectors/calling';
|
||||||
import { getConversationsWithCustomColorSelector } from '../state/selectors/conversations';
|
import { getConversationsWithCustomColorSelector } from '../state/selectors/conversations';
|
||||||
import { getCustomColors } from '../state/selectors/items';
|
import { getCustomColors } from '../state/selectors/items';
|
||||||
import { themeChanged } from '../shims/themeChanged';
|
import { themeChanged } from '../shims/themeChanged';
|
||||||
|
@ -128,7 +128,8 @@ export type IPCEventsCallbacksType = {
|
||||||
showGroupViaLink: (value: string) => Promise<void>;
|
showGroupViaLink: (value: string) => Promise<void>;
|
||||||
showReleaseNotes: () => void;
|
showReleaseNotes: () => void;
|
||||||
showStickerPack: (packId: string, key: string) => void;
|
showStickerPack: (packId: string, key: string) => void;
|
||||||
maybeRequestCloseConfirmation: () => Promise<boolean>;
|
requestCloseConfirmation: () => Promise<boolean>;
|
||||||
|
getIsInCall: () => boolean;
|
||||||
shutdown: () => Promise<void>;
|
shutdown: () => Promise<void>;
|
||||||
unknownSignalLink: () => void;
|
unknownSignalLink: () => void;
|
||||||
getCustomColors: () => Record<string, CustomColorType>;
|
getCustomColors: () => Record<string, CustomColorType>;
|
||||||
|
@ -632,12 +633,7 @@ export function createIPCEvents(
|
||||||
showUnknownSgnlLinkModal();
|
showUnknownSgnlLinkModal();
|
||||||
},
|
},
|
||||||
|
|
||||||
maybeRequestCloseConfirmation: async (): Promise<boolean> => {
|
requestCloseConfirmation: async (): Promise<boolean> => {
|
||||||
const isInCall = getIsInCall(window.reduxStore.getState());
|
|
||||||
if (!isInCall) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await new Promise<void>((resolve, reject) => {
|
await new Promise<void>((resolve, reject) => {
|
||||||
showConfirmationDialog({
|
showConfirmationDialog({
|
||||||
|
@ -655,20 +651,22 @@ export function createIPCEvents(
|
||||||
resolve: () => resolve(),
|
resolve: () => resolve(),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
log.info('Close confirmed by user.');
|
log.info('requestCloseConfirmation: Close confirmed by user.');
|
||||||
if (isInCall) {
|
window.reduxActions.calling.hangUpActiveCall(
|
||||||
window.reduxActions.calling.hangUpActiveCall(
|
'User confirmed in-call close.'
|
||||||
'User confirmed in-call close.'
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch {
|
} catch {
|
||||||
log.info('Close cancelled by user.');
|
log.info('requestCloseConfirmation: Close cancelled by user.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getIsInCall: (): boolean => {
|
||||||
|
return isInCall(window.reduxStore.getState());
|
||||||
|
},
|
||||||
|
|
||||||
unknownSignalLink: () => {
|
unknownSignalLink: () => {
|
||||||
log.warn('unknownSignalLink: Showing error dialog');
|
log.warn('unknownSignalLink: Showing error dialog');
|
||||||
showUnknownSgnlLinkModal();
|
showUnknownSgnlLinkModal();
|
||||||
|
|
|
@ -421,15 +421,15 @@ ipc.on('get-ready-for-shutdown', async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
ipc.on('maybe-request-close-confirmation', async () => {
|
ipc.on('maybe-request-close-confirmation', async () => {
|
||||||
const { maybeRequestCloseConfirmation } = window.Events;
|
const { getIsInCall, requestCloseConfirmation } = window.Events;
|
||||||
if (!maybeRequestCloseConfirmation) {
|
if (!getIsInCall || !getIsInCall() || !requestCloseConfirmation) {
|
||||||
ipc.send('received-close-confirmation', true);
|
ipc.send('received-close-confirmation', true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info('Requesting close confirmation.');
|
log.info('Requesting close confirmation.');
|
||||||
ipc.send('requested-close-confirmation');
|
ipc.send('requested-close-confirmation');
|
||||||
const result = await maybeRequestCloseConfirmation();
|
const result = await requestCloseConfirmation();
|
||||||
ipc.send('received-close-confirmation', result);
|
ipc.send('received-close-confirmation', result);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue