More protobufjs migration

This commit is contained in:
Fedor Indutny 2021-07-09 12:36:10 -07:00 committed by GitHub
parent cf06e6638e
commit ddbbe3a6b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
70 changed files with 3967 additions and 3369 deletions

View file

@ -6,8 +6,8 @@ import { LocalizerType } from './types/Util';
import { ReplacementValuesType } from './types/I18N';
import { missingCaseError } from './util/missingCaseError';
import { AccessControlClass, MemberClass } from './textsecure.d';
import { GroupV2ChangeDetailType, GroupV2ChangeType } from './groups';
import { SignalService as Proto } from './protobuf';
export type SmartContactRendererType = (conversationId: string) => FullJSXType;
export type StringRendererType = (
@ -17,15 +17,16 @@ export type StringRendererType = (
) => FullJSXType;
export type RenderOptionsType = {
AccessControlEnum: typeof AccessControlClass.AccessRequired;
from?: string;
i18n: LocalizerType;
ourConversationId: string;
renderContact: SmartContactRendererType;
renderString: StringRendererType;
RoleEnum: typeof MemberClass.Role;
};
const AccessControlEnum = Proto.AccessControl.AccessRequired;
const RoleEnum = Proto.Member.Role;
export function renderChange(
change: GroupV2ChangeType,
options: RenderOptionsType
@ -45,13 +46,11 @@ export function renderChangeDetail(
options: RenderOptionsType
): FullJSXType {
const {
AccessControlEnum,
from,
i18n,
ourConversationId,
renderContact,
renderString,
RoleEnum,
} = options;
const fromYou = Boolean(from && from === ourConversationId);