( pinMessage?: Proto.DataMessage.PinMessage | null )
| 353 | } |
| 354 | |
| 355 | function processPinMessage( |
| 356 | pinMessage?: Proto.DataMessage.PinMessage | null |
| 357 | ): ProcessedPinMessage | undefined { |
| 358 | if (pinMessage == null) { |
| 359 | return undefined; |
| 360 | } |
| 361 | |
| 362 | const targetSentTimestamp = toNumber(pinMessage.targetSentTimestamp); |
| 363 | strictAssert(targetSentTimestamp, 'Missing targetSentTimestamp'); |
| 364 | |
| 365 | const targetAuthorAci = fromAciUuidBytes(pinMessage.targetAuthorAciBinary); |
| 366 | strictAssert(targetAuthorAci, 'Missing targetAuthorAciBinary'); |
| 367 | |
| 368 | let pinDuration: DurationInSeconds | null; |
| 369 | if (pinMessage.pinDuration?.pinDurationForever) { |
| 370 | pinDuration = null; |
| 371 | } else { |
| 372 | strictAssert( |
| 373 | pinMessage.pinDuration?.pinDurationSeconds, |
| 374 | 'Missing pinDurationSeconds' |
| 375 | ); |
| 376 | pinDuration = DurationInSeconds.fromSeconds( |
| 377 | pinMessage.pinDuration.pinDurationSeconds |
| 378 | ); |
| 379 | } |
| 380 | |
| 381 | return { |
| 382 | targetSentTimestamp, |
| 383 | targetAuthorAci, |
| 384 | pinDuration, |
| 385 | }; |
| 386 | } |
| 387 | |
| 388 | function processPollCreate( |
| 389 | pollCreate?: Proto.DataMessage.PollCreate | null |
no test coverage detected