Skip to content

Commit

Permalink
Merge pull request #2302 from NguyenTranHoangSym/SDA-4732
Browse files Browse the repository at this point in the history
SDA-4732: Revamp the call notification
  • Loading branch information
NguyenTranHoangSym authored Feb 27, 2025
2 parents 8231068 + 0785fb9 commit bab5965
Show file tree
Hide file tree
Showing 8 changed files with 319 additions and 84 deletions.
64 changes: 64 additions & 0 deletions spec/callNotification.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,68 @@ describe('Call toast notification component', () => {
externalBadge = wrapper.find('.ext-badge-container');
expect(externalBadge.exists()).toBeTruthy();
});

it('should display check for new federation toast - Unknown User', () => {
const isExternal = true;

ipcRenderer.send(IPC_RENDERER_NOTIFICATION_DATA_CHANNEL, {
...defaultProps,
isExternal,
isFederatedEnabled: true,
callerName: '',
callerNumber: '123',
primaryText: '123 [PHONE]',
});

let federationTypeText = wrapper.find('[data-testid="FEDERATION_TYPE"]');
let federationUnknownUserAvatar = wrapper.find(
'[data-testid="FEDERATION_UNKNOWN_USER_AVATAR"]',
);
let federationPrimaryText = wrapper.find(
'[data-testid="CALL_NOTIFICATION_NAME"]',
);
let avatarBadge = wrapper.find('[data-testid="AVATAR_BADGE"]');

expect(federationTypeText.exists()).toBeTruthy();
expect(federationUnknownUserAvatar.exists()).toBeTruthy();
expect(federationPrimaryText.exists()).toBeTruthy();
expect(avatarBadge.exists()).toBeFalsy();

expect(federationPrimaryText.text()).toBe('123 ');
expect(federationTypeText.text()).toBe('SMS & Voice');
});

it('should display check for new federation toast - Known User', () => {
const isExternal = true;

ipcRenderer.send(IPC_RENDERER_NOTIFICATION_DATA_CHANNEL, {
...defaultProps,
isExternal,
isFederatedEnabled: true,
callerName: 'Helen',
callerNumber: '123',
primaryText: 'Helen',
});
let federationTypeText = wrapper.find('[data-testid="FEDERATION_TYPE"]');
let federationUnknownUserAvatar = wrapper.find(
'[data-testid="FEDERATION_NAMED_USER_AVATAR"]',
);
let federationNumber = wrapper.find(
'[data-testid="FEDERATION_NAMED_USER_NUMBER"]',
);
let federationPrimaryText = wrapper.find(
'[data-testid="CALL_NOTIFICATION_NAME"]',
);
let avatarBadge = wrapper.find('[data-testid="AVATAR_BADGE"]');

expect(federationTypeText.exists()).toBeTruthy();
expect(federationUnknownUserAvatar.exists()).toBeTruthy();
expect(federationPrimaryText.exists()).toBeTruthy();
expect(avatarBadge.exists()).toBeFalsy();
expect(federationNumber.exists()).toBeTruthy();

expect(federationPrimaryText.text()).toBe('Helen');
expect(federationTypeText.text()).toBe('SMS & Voice');
expect(federationNumber.text()).toBe('123');
});
});
9 changes: 9 additions & 0 deletions src/common/api-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,14 @@ export enum KeyCodes {
type Theme = '' | 'light' | 'dark';
type CallType = 'IM' | 'ROOM' | 'OTHER';

export const CallType = { IM: 'IM', ROOM: 'ROOM', OTHER: 'OTHER' };

/**
* Notification
*/
export interface INotificationData {
isPhone?: boolean;
notificationType?: string;
id: number;
title: string;
body: string;
Expand Down Expand Up @@ -330,7 +334,12 @@ export interface ICallNotificationData {
shouldDisplayBadge: boolean;
acceptButtonText: string;
rejectButtonText: string;
isFederatedEnabled?: boolean;
isPhone?: boolean;
notificationType?: string;
zoomFactor: number;
callerNumber: string;
callerName?: string;
}

export enum NotificationActions {
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/assets/federation-user.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/renderer/assets/phone-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/renderer/assets/phone-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit bab5965

Please sign in to comment.