Introduce Service Id Types

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
Fedor Indutny 2023-08-10 18:43:33 +02:00 committed by Jamie Kyle
parent 414c0a58d3
commit 366b875fd2
269 changed files with 5832 additions and 5550 deletions

View file

@ -9,8 +9,21 @@ import { MessageBody } from './MessageBody';
import { setupI18n } from '../../util/setupI18n';
import enMessages from '../../../_locales/en/messages.json';
import { BodyRange } from '../../types/BodyRange';
import { generateAci } from '../../types/ServiceId';
import { RenderLocation } from './MessageTextRenderer';
const SERVICE_ID_1 = generateAci();
const SERVICE_ID_2 = generateAci();
const SERVICE_ID_3 = generateAci();
const SERVICE_ID_4 = generateAci();
const SERVICE_ID_5 = generateAci();
const SERVICE_ID_6 = generateAci();
const SERVICE_ID_7 = generateAci();
const SERVICE_ID_8 = generateAci();
const SERVICE_ID_9 = generateAci();
const SERVICE_ID_10 = generateAci();
const SERVICE_ID_11 = generateAci();
const i18n = setupI18n('en', enMessages);
export default {
@ -115,7 +128,7 @@ export function Mention(): JSX.Element {
{
start: 5,
length: 1,
mentionUuid: 'tuv',
mentionUuid: SERVICE_ID_1,
replacementText: 'Bender B Rodriguez 🤖',
conversationID: 'x',
},
@ -137,21 +150,21 @@ export function MultipleMentions(): JSX.Element {
{
start: 2,
length: 1,
mentionUuid: 'def',
mentionUuid: SERVICE_ID_2,
replacementText: 'Philip J Fry',
conversationID: 'x',
},
{
start: 4,
length: 1,
mentionUuid: 'abc',
mentionUuid: SERVICE_ID_3,
replacementText: 'Professor Farnsworth',
conversationID: 'x',
},
{
start: 0,
length: 1,
mentionUuid: 'xyz',
mentionUuid: SERVICE_ID_4,
replacementText: 'Yancy Fry',
conversationID: 'x',
},
@ -179,21 +192,21 @@ export function ComplexMessageBody(): JSX.Element {
{
start: 78,
length: 1,
mentionUuid: 'wer',
mentionUuid: SERVICE_ID_5,
replacementText: 'Acid Burn',
conversationID: 'x',
},
{
start: 80,
length: 1,
mentionUuid: 'xox',
mentionUuid: SERVICE_ID_6,
replacementText: 'Cereal Killer',
conversationID: 'x',
},
{
start: 4,
length: 1,
mentionUuid: 'ldo',
mentionUuid: SERVICE_ID_6,
replacementText: 'Zero Cool',
conversationID: 'x',
},
@ -311,14 +324,14 @@ export function FormattingSpoiler(): JSX.Element {
{
start: 54,
length: 1,
mentionUuid: 'a',
mentionUuid: SERVICE_ID_7,
conversationID: 'a',
replacementText: '🅰️ Alice',
},
{
start: 60,
length: 1,
mentionUuid: 'b',
mentionUuid: SERVICE_ID_8,
conversationID: 'b',
replacementText: '🅱️ Bob',
},
@ -371,35 +384,35 @@ export function FormattingNesting(): JSX.Element {
{
start: 29,
length: 1,
mentionUuid: 'a',
mentionUuid: SERVICE_ID_7,
conversationID: 'a',
replacementText: '🅰️ Alice',
},
{
start: 61,
length: 1,
mentionUuid: 'b',
mentionUuid: SERVICE_ID_8,
conversationID: 'b',
replacementText: '🅱️ Bob',
},
{
start: 68,
length: 1,
mentionUuid: 'c',
mentionUuid: SERVICE_ID_9,
conversationID: 'c',
replacementText: 'Charlie',
},
{
start: 80,
length: 1,
mentionUuid: 'd',
mentionUuid: SERVICE_ID_10,
conversationID: 'd',
replacementText: 'Dan',
},
{
start: 105,
length: 1,
mentionUuid: 'e',
mentionUuid: SERVICE_ID_11,
conversationID: 'e',
replacementText: 'Eve',
},
@ -439,7 +452,7 @@ export function FormattingComplex(): JSX.Element {
{
start: 24,
length: 1,
mentionUuid: 'abc',
mentionUuid: SERVICE_ID_3,
conversationID: 'x',
replacementText: '🤖 Hello',
},
@ -471,7 +484,7 @@ export function FormattingComplex(): JSX.Element {
{
start: 491,
length: 1,
mentionUuid: 'abc',
mentionUuid: SERVICE_ID_3,
conversationID: 'x',
replacementText: '🤖 Hello',
},