fix: videoconf ringing iOS push notification params are not compatible with what the mobile app expects (#30805)

pull/27636/merge
Pierre Lehnen 2 years ago committed by GitHub
parent 3488f6b024
commit e9adcfb676
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      apps/meteor/app/push/server/apn.ts
  2. 1
      apps/meteor/app/push/server/definition.ts
  3. 14
      apps/meteor/app/push/server/push.ts
  4. 3
      apps/meteor/server/services/video-conference/service.ts

@ -65,7 +65,7 @@ export const sendAPN = ({
note.payload.messageFrom = notification.from;
note.priority = priority;
note.topic = `${notification.topic}${notification.apn?.topicSuffix || ''}`;
note.topic = notification.topic;
note.mutableContent = true;
void apnConnection.send(note, userToken).then((response) => {

@ -26,7 +26,6 @@ export type PendingPushNotification = {
notId?: number;
apn?: {
category?: string;
topicSuffix?: string;
};
gcm?: {
style?: string;

@ -201,13 +201,12 @@ class PushClass {
}
private getGatewayNotificationData(notification: PendingPushNotification): Omit<GatewayNotification, 'uniqueId'> {
// Gateway accepts every attribute from the PendingPushNotification type, except for the priority and apn.topicSuffix
const { priority: _priority, apn, ...notifData } = notification;
const { topicSuffix: _topicSuffix, ...apnData } = apn || ({} as RequiredField<PendingPushNotification, 'apn'>['apn']);
// Gateway currently accepts every attribute from the PendingPushNotification type, except for the priority
// If new attributes are added to the PendingPushNotification type, they'll need to be removed here as well.
const { priority: _priority, ...notifData } = notification;
return {
...notifData,
...(notification.apn ? { apn: { ...apnData } } : {}),
};
}
@ -221,8 +220,6 @@ class PushClass {
return;
}
const { topicSuffix = '' } = notification.apn || {};
const gatewayNotification = this.getGatewayNotificationData(notification);
for (const gateway of this.options.gateways) {
@ -230,7 +227,7 @@ class PushClass {
if ('apn' in app.token && app.token.apn) {
countApn.push(app._id);
return this.sendGatewayPush(gateway, 'apn', app.token.apn, { topic: `${app.appName}${topicSuffix}`, ...gatewayNotification });
return this.sendGatewayPush(gateway, 'apn', app.token.apn, { topic: app.appName, ...gatewayNotification });
}
if ('gcm' in app.token && app.token.gcm) {
@ -318,7 +315,6 @@ class PushClass {
contentAvailable: Match.Optional(Match.Integer),
apn: Match.Optional({
category: Match.Optional(String),
topicSuffix: Match.Optional(String),
}),
gcm: Match.Optional({
image: Match.Optional(String),
@ -357,7 +353,7 @@ class PushClass {
...(this.hasApnOptions(options)
? {
apn: {
...pick(options.apn, 'category', 'topicSuffix'),
...pick(options.apn, 'category'),
},
}
: {}),

@ -627,8 +627,7 @@ export class VideoConfService extends ServiceClassInternal implements IVideoConf
image: RocketChatAssets.getURL('Assets_favicon_192'),
},
apn: {
category: 'MESSAGE_NOREPLY',
topicSuffix: '.voip',
category: 'VIDEOCONF',
},
});
}

Loading…
Cancel
Save