MCPcopy Create free account
hub / github.com/CommE2E/comm / buildNotifsForPlatform

Function buildNotifsForPlatform

lib/push/send-utils.js:505–598  ·  view source on GitHub ↗
(
  input: BuildNotifsForPlatformInput<
    PlatformType,
    NotifCreatorinputBase,
    TargetedNotificationType,
    NotifCreatorInput,
  >,
  largeNotifToEncryptionResultPromises?: {
    [string]: Promise<LargeNotifEncryptionResult>,
  },
)

Source from the content-addressed store, hash-verified

503};
504
505async function buildNotifsForPlatform<
506 PlatformType: Platform,
507 NotifCreatorinputBase,
508 TargetedNotificationType,
509 NotifCreatorInput: { +platformDetails: PlatformDetails, ... },
510>(
511 input: BuildNotifsForPlatformInput<
512 PlatformType,
513 NotifCreatorinputBase,
514 TargetedNotificationType,
515 NotifCreatorInput,
516 >,
517 largeNotifToEncryptionResultPromises?: {
518 [string]: Promise<LargeNotifEncryptionResult>,
519 },
520): Promise<{
521 +targetedNotificationsWithPlatform: $ReadOnlyArray<{
522 +platform: PlatformType,
523 +targetedNotification: TargetedNotificationType,
524 }>,
525 +largeNotifDataArray?: $ReadOnlyArray<LargeNotifData>,
526}> {
527 const {
528 encryptedNotifUtilsAPI,
529 versionToDevices,
530 notifCreatorCallback,
531 notifCreatorInputBase,
532 platform,
533 transformInputBase,
534 } = input;
535
536 const promises: Array<
537 Promise<{
538 +targetedNotificationsWithPlatform: $ReadOnlyArray<{
539 +platform: PlatformType,
540 +targetedNotification: TargetedNotificationType,
541 }>,
542 +largeNotifData?: LargeNotifData,
543 }>,
544 > = [];
545
546 for (const [versionKey, devices] of versionToDevices) {
547 const { codeVersion, stateVersion, majorDesktopVersion } =
548 stringToVersionKey(versionKey);
549
550 const platformDetails = {
551 platform,
552 codeVersion,
553 stateVersion,
554 majorDesktopVersion,
555 };
556
557 const inputData = transformInputBase(
558 notifCreatorInputBase,
559 platformDetails,
560 );
561
562 promises.push(

Callers 3

Calls 2

stringToVersionKeyFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected