Streamlined system messages
This commit is contained in:
parent
1973224adb
commit
2b08cbfdfe
57 changed files with 864 additions and 937 deletions
|
@ -110,3 +110,53 @@ export function getCallingNotificationText(
|
|||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
type CallingIconType =
|
||||
| 'audio-incoming'
|
||||
| 'audio-missed'
|
||||
| 'audio-outgoing'
|
||||
| 'phone'
|
||||
| 'video'
|
||||
| 'video-incoming'
|
||||
| 'video-missed'
|
||||
| 'video-outgoing';
|
||||
|
||||
function getDirectCallingIcon({
|
||||
wasIncoming,
|
||||
wasVideoCall,
|
||||
acceptedTime,
|
||||
}: DirectCallNotificationType): CallingIconType {
|
||||
const wasAccepted = Boolean(acceptedTime);
|
||||
|
||||
// video
|
||||
if (wasVideoCall) {
|
||||
if (wasAccepted) {
|
||||
return wasIncoming ? 'video-incoming' : 'video-outgoing';
|
||||
}
|
||||
return 'video-missed';
|
||||
}
|
||||
|
||||
if (wasAccepted) {
|
||||
return wasIncoming ? 'audio-incoming' : 'audio-outgoing';
|
||||
}
|
||||
|
||||
return 'audio-missed';
|
||||
}
|
||||
|
||||
export function getCallingIcon(
|
||||
notification: CallingNotificationType
|
||||
): CallingIconType {
|
||||
switch (notification.callMode) {
|
||||
case CallMode.Direct:
|
||||
return getDirectCallingIcon(notification);
|
||||
case CallMode.Group:
|
||||
return 'video';
|
||||
default:
|
||||
window.log.error(
|
||||
`getCallingNotificationText: missing case ${missingCaseError(
|
||||
notification
|
||||
)}`
|
||||
);
|
||||
return 'phone';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue