Enable usernames
This commit is contained in:
parent
38da3d3152
commit
43de83f0de
26 changed files with 196 additions and 438 deletions
|
@ -22,11 +22,9 @@ export type ConfigKeyType =
|
|||
| 'desktop.internalUser'
|
||||
| 'desktop.mediaQuality.levels'
|
||||
| 'desktop.messageCleanup'
|
||||
| 'desktop.pnp'
|
||||
| 'desktop.retryRespondMaxAge'
|
||||
| 'desktop.senderKey.retry'
|
||||
| 'desktop.senderKeyMaxAge'
|
||||
| 'desktop.usernames'
|
||||
| 'global.attachments.maxBytes'
|
||||
| 'global.attachments.maxReceiveBytes'
|
||||
| 'global.calling.maxGroupCallRingSize'
|
||||
|
|
|
@ -653,7 +653,6 @@ export function ComposeNoResults(): JSX.Element {
|
|||
mode: LeftPaneMode.Compose,
|
||||
composeContacts: [],
|
||||
composeGroups: [],
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
regionCode: 'US',
|
||||
searchTerm: '',
|
||||
|
@ -671,7 +670,6 @@ export function ComposeSomeContactsNoSearchTerm(): JSX.Element {
|
|||
mode: LeftPaneMode.Compose,
|
||||
composeContacts: defaultConversations,
|
||||
composeGroups: [],
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
regionCode: 'US',
|
||||
searchTerm: '',
|
||||
|
@ -689,7 +687,6 @@ export function ComposeSomeContactsWithASearchTerm(): JSX.Element {
|
|||
mode: LeftPaneMode.Compose,
|
||||
composeContacts: defaultConversations,
|
||||
composeGroups: [],
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
regionCode: 'US',
|
||||
searchTerm: 'ar',
|
||||
|
@ -707,7 +704,6 @@ export function ComposeSomeGroupsNoSearchTerm(): JSX.Element {
|
|||
mode: LeftPaneMode.Compose,
|
||||
composeContacts: [],
|
||||
composeGroups: defaultGroups,
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
regionCode: 'US',
|
||||
searchTerm: '',
|
||||
|
@ -725,7 +721,6 @@ export function ComposeSomeGroupsWithSearchTerm(): JSX.Element {
|
|||
mode: LeftPaneMode.Compose,
|
||||
composeContacts: [],
|
||||
composeGroups: defaultGroups,
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
regionCode: 'US',
|
||||
searchTerm: 'ar',
|
||||
|
@ -743,7 +738,6 @@ export function ComposeSearchIsValidUsername(): JSX.Element {
|
|||
mode: LeftPaneMode.Compose,
|
||||
composeContacts: [],
|
||||
composeGroups: [],
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
regionCode: 'US',
|
||||
searchTerm: 'someone',
|
||||
|
@ -761,7 +755,6 @@ export function ComposeSearchIsValidUsernameFetchingUsername(): JSX.Element {
|
|||
mode: LeftPaneMode.Compose,
|
||||
composeContacts: [],
|
||||
composeGroups: [],
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {
|
||||
'username:someone': true,
|
||||
},
|
||||
|
@ -773,42 +766,6 @@ export function ComposeSearchIsValidUsernameFetchingUsername(): JSX.Element {
|
|||
);
|
||||
}
|
||||
|
||||
export function ComposeSearchIsValidUsernameButFlagIsNotEnabled(): JSX.Element {
|
||||
return (
|
||||
<LeftPaneInContainer
|
||||
{...useProps({
|
||||
modeSpecificProps: {
|
||||
mode: LeftPaneMode.Compose,
|
||||
composeContacts: [],
|
||||
composeGroups: [],
|
||||
isUsernamesEnabled: false,
|
||||
uuidFetchState: {},
|
||||
regionCode: 'US',
|
||||
searchTerm: 'someone',
|
||||
},
|
||||
})}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export function ComposeSearchIsPartialPhoneNumber(): JSX.Element {
|
||||
return (
|
||||
<LeftPaneInContainer
|
||||
{...useProps({
|
||||
modeSpecificProps: {
|
||||
mode: LeftPaneMode.Compose,
|
||||
composeContacts: [],
|
||||
composeGroups: [],
|
||||
isUsernamesEnabled: false,
|
||||
uuidFetchState: {},
|
||||
regionCode: 'US',
|
||||
searchTerm: '+1(212)555',
|
||||
},
|
||||
})}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export function ComposeSearchIsValidPhoneNumber(): JSX.Element {
|
||||
return (
|
||||
<LeftPaneInContainer
|
||||
|
@ -817,7 +774,6 @@ export function ComposeSearchIsValidPhoneNumber(): JSX.Element {
|
|||
mode: LeftPaneMode.Compose,
|
||||
composeContacts: [],
|
||||
composeGroups: [],
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
regionCode: 'US',
|
||||
searchTerm: '2125555454',
|
||||
|
@ -835,7 +791,6 @@ export function ComposeSearchIsValidPhoneNumberFetchingPhoneNumber(): JSX.Elemen
|
|||
mode: LeftPaneMode.Compose,
|
||||
composeContacts: [],
|
||||
composeGroups: [],
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {
|
||||
'e164:+12125555454': true,
|
||||
},
|
||||
|
@ -855,7 +810,6 @@ export function ComposeAllKindsOfResultsNoSearchTerm(): JSX.Element {
|
|||
mode: LeftPaneMode.Compose,
|
||||
composeContacts: defaultConversations,
|
||||
composeGroups: defaultGroups,
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
regionCode: 'US',
|
||||
searchTerm: '',
|
||||
|
@ -873,7 +827,6 @@ export function ComposeAllKindsOfResultsWithASearchTerm(): JSX.Element {
|
|||
mode: LeftPaneMode.Compose,
|
||||
composeContacts: defaultConversations,
|
||||
composeGroups: defaultGroups,
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
regionCode: 'US',
|
||||
searchTerm: 'someone',
|
||||
|
@ -952,7 +905,6 @@ export function ChooseGroupMembersPartialPhoneNumber(): JSX.Element {
|
|||
groupSizeHardLimit: 1001,
|
||||
isShowingRecommendedGroupSizeModal: false,
|
||||
isShowingMaximumGroupSizeModal: false,
|
||||
isUsernamesEnabled: true,
|
||||
ourE164: undefined,
|
||||
ourUsername: undefined,
|
||||
searchTerm: '+1(212) 555',
|
||||
|
@ -976,7 +928,6 @@ export function ChooseGroupMembersValidPhoneNumber(): JSX.Element {
|
|||
groupSizeHardLimit: 1001,
|
||||
isShowingRecommendedGroupSizeModal: false,
|
||||
isShowingMaximumGroupSizeModal: false,
|
||||
isUsernamesEnabled: true,
|
||||
ourE164: undefined,
|
||||
ourUsername: undefined,
|
||||
searchTerm: '+1(212) 555 5454',
|
||||
|
@ -1000,7 +951,6 @@ export function ChooseGroupMembersUsername(): JSX.Element {
|
|||
groupSizeHardLimit: 1001,
|
||||
isShowingRecommendedGroupSizeModal: false,
|
||||
isShowingMaximumGroupSizeModal: false,
|
||||
isUsernamesEnabled: true,
|
||||
ourE164: undefined,
|
||||
ourUsername: undefined,
|
||||
searchTerm: '@signal',
|
||||
|
|
|
@ -104,7 +104,6 @@ export default {
|
|||
isAutoLaunchSupported: true,
|
||||
isHideMenuBarSupported: true,
|
||||
isNotificationAttentionSupported: true,
|
||||
isPhoneNumberSharingSupported: true,
|
||||
isSyncSupported: true,
|
||||
isSystemTraySupported: true,
|
||||
isMinimizeToAndStartInSystemTraySupported: true,
|
||||
|
@ -206,12 +205,10 @@ export const PNPSharingDisabled = Template.bind({});
|
|||
PNPSharingDisabled.args = {
|
||||
whoCanSeeMe: PhoneNumberSharingMode.Nobody,
|
||||
whoCanFindMe: PhoneNumberDiscoverability.Discoverable,
|
||||
isPhoneNumberSharingSupported: true,
|
||||
};
|
||||
|
||||
export const PNPDiscoverabilityDisabled = Template.bind({});
|
||||
PNPDiscoverabilityDisabled.args = {
|
||||
whoCanSeeMe: PhoneNumberSharingMode.Nobody,
|
||||
whoCanFindMe: PhoneNumberDiscoverability.NotDiscoverable,
|
||||
isPhoneNumberSharingSupported: true,
|
||||
};
|
||||
|
|
|
@ -126,7 +126,6 @@ export type PropsDataType = {
|
|||
isAutoLaunchSupported: boolean;
|
||||
isHideMenuBarSupported: boolean;
|
||||
isNotificationAttentionSupported: boolean;
|
||||
isPhoneNumberSharingSupported: boolean;
|
||||
isSyncSupported: boolean;
|
||||
isSystemTraySupported: boolean;
|
||||
isMinimizeToAndStartInSystemTraySupported: boolean;
|
||||
|
@ -286,7 +285,6 @@ export function Preferences({
|
|||
isAutoDownloadUpdatesSupported,
|
||||
isAutoLaunchSupported,
|
||||
isHideMenuBarSupported,
|
||||
isPhoneNumberSharingSupported,
|
||||
isNotificationAttentionSupported,
|
||||
isSyncSupported,
|
||||
isSystemTraySupported,
|
||||
|
@ -1193,20 +1191,18 @@ export function Preferences({
|
|||
{i18n('icu:Preferences__button--privacy')}
|
||||
</div>
|
||||
</div>
|
||||
{isPhoneNumberSharingSupported ? (
|
||||
<button
|
||||
type="button"
|
||||
className="Preferences__link"
|
||||
onClick={() => setPage(Page.PNP)}
|
||||
>
|
||||
<h3 className="Preferences__padding">
|
||||
{i18n('icu:Preferences__pnp__row--title')}
|
||||
</h3>
|
||||
<div className="Preferences__padding Preferences__description">
|
||||
{i18n('icu:Preferences__pnp__row--body')}
|
||||
</div>
|
||||
</button>
|
||||
) : null}
|
||||
<button
|
||||
type="button"
|
||||
className="Preferences__link"
|
||||
onClick={() => setPage(Page.PNP)}
|
||||
>
|
||||
<h3 className="Preferences__padding">
|
||||
{i18n('icu:Preferences__pnp__row--title')}
|
||||
</h3>
|
||||
<div className="Preferences__padding Preferences__description">
|
||||
{i18n('icu:Preferences__pnp__row--body')}
|
||||
</div>
|
||||
</button>
|
||||
<SettingsRow>
|
||||
<Control
|
||||
left={i18n('icu:Preferences--blocked')}
|
||||
|
|
|
@ -26,9 +26,6 @@ export default {
|
|||
component: ProfileEditor,
|
||||
title: 'Components/ProfileEditor',
|
||||
argTypes: {
|
||||
isUsernameFlagEnabled: {
|
||||
control: { type: 'checkbox' },
|
||||
},
|
||||
usernameEditState: {
|
||||
control: { type: 'radio' },
|
||||
options: {
|
||||
|
@ -64,7 +61,6 @@ export default {
|
|||
|
||||
usernameLink: 'https://signal.me/#eu/testtest',
|
||||
usernameLinkColor: Proto.AccountRecord.UsernameLink.Color.PURPLE,
|
||||
isUsernameFlagEnabled: false,
|
||||
usernameEditState: UsernameEditState.Editing,
|
||||
usernameLinkState: UsernameLinkState.Ready,
|
||||
|
||||
|
@ -148,34 +144,25 @@ WithCustomAbout.args = {
|
|||
aboutText: 'Live. Laugh. Love',
|
||||
};
|
||||
|
||||
export const WithUsernameFlagEnabled = Template.bind({});
|
||||
WithUsernameFlagEnabled.args = {
|
||||
isUsernameFlagEnabled: true,
|
||||
};
|
||||
|
||||
export const WithUsernameFlagEnabledAndUsername = Template.bind({});
|
||||
WithUsernameFlagEnabledAndUsername.args = {
|
||||
isUsernameFlagEnabled: true,
|
||||
export const WithUsername = Template.bind({});
|
||||
WithUsername.args = {
|
||||
username: 'signaluser.123',
|
||||
};
|
||||
|
||||
export const DeletingUsername = Template.bind({});
|
||||
DeletingUsername.args = {
|
||||
isUsernameFlagEnabled: true,
|
||||
username: 'signaluser.123',
|
||||
usernameEditState: UsernameEditState.Deleting,
|
||||
};
|
||||
|
||||
export const ConfirmingDelete = Template.bind({});
|
||||
ConfirmingDelete.args = {
|
||||
isUsernameFlagEnabled: true,
|
||||
username: 'signaluser.123',
|
||||
usernameEditState: UsernameEditState.ConfirmingDelete,
|
||||
};
|
||||
|
||||
export const Corrupted = Template.bind({});
|
||||
Corrupted.args = {
|
||||
isUsernameFlagEnabled: true,
|
||||
username: 'signaluser.123',
|
||||
usernameCorrupted: true,
|
||||
};
|
||||
|
|
|
@ -77,7 +77,6 @@ export type PropsDataType = {
|
|||
firstName: string;
|
||||
hasCompletedUsernameLinkOnboarding: boolean;
|
||||
i18n: LocalizerType;
|
||||
isUsernameFlagEnabled: boolean;
|
||||
userAvatarData: ReadonlyArray<AvatarDataType>;
|
||||
username?: string;
|
||||
initialEditState?: EditState;
|
||||
|
@ -152,7 +151,6 @@ export function ProfileEditor({
|
|||
hasCompletedUsernameLinkOnboarding,
|
||||
i18n,
|
||||
initialEditState = EditState.None,
|
||||
isUsernameFlagEnabled,
|
||||
markCompletedUsernameLinkOnboarding,
|
||||
onEditStateChanged,
|
||||
onProfileChanged,
|
||||
|
@ -548,168 +546,165 @@ export function ProfileEditor({
|
|||
/>
|
||||
);
|
||||
} else if (editState === EditState.None) {
|
||||
let maybeUsernameRows: JSX.Element | undefined;
|
||||
if (isUsernameFlagEnabled) {
|
||||
let actions: JSX.Element | undefined;
|
||||
let alwaysShowActions = false;
|
||||
let actions: JSX.Element | undefined;
|
||||
let alwaysShowActions = false;
|
||||
|
||||
if (usernameEditState === UsernameEditState.Deleting) {
|
||||
actions = (
|
||||
<ConversationDetailsIcon
|
||||
ariaLabel={i18n('icu:ProfileEditor--username--deleting-username')}
|
||||
icon={IconType.spinner}
|
||||
disabled
|
||||
fakeButton
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
const menuOptions = [
|
||||
{
|
||||
group: 'copy',
|
||||
icon: 'ProfileEditor__username-menu__copy-icon',
|
||||
label: i18n('icu:ProfileEditor--username--copy'),
|
||||
onClick: () => {
|
||||
assertDev(
|
||||
username !== undefined,
|
||||
'Should not be visible without username'
|
||||
);
|
||||
void window.navigator.clipboard.writeText(username);
|
||||
showToast({ toastType: ToastType.CopiedUsername });
|
||||
},
|
||||
},
|
||||
{
|
||||
// Different group to display a divider above it
|
||||
group: 'delete',
|
||||
|
||||
icon: 'ProfileEditor__username-menu__trash-icon',
|
||||
label: i18n('icu:ProfileEditor--username--delete'),
|
||||
onClick: () => {
|
||||
setUsernameEditState(UsernameEditState.ConfirmingDelete);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
if (usernameCorrupted) {
|
||||
actions = (
|
||||
<i
|
||||
className="ProfileEditor__error-icon"
|
||||
title={i18n('icu:ProfileEditor__username__error-icon')}
|
||||
/>
|
||||
);
|
||||
alwaysShowActions = true;
|
||||
} else if (username) {
|
||||
actions = (
|
||||
<ContextMenu
|
||||
i18n={i18n}
|
||||
menuOptions={menuOptions}
|
||||
popperOptions={{ placement: 'bottom', strategy: 'absolute' }}
|
||||
moduleClassName="ProfileEditor__username-menu"
|
||||
ariaLabel={i18n('icu:ProfileEditor--username--context-menu')}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let maybeUsernameLinkRow: JSX.Element | undefined;
|
||||
if (username && !usernameCorrupted) {
|
||||
let linkActions: JSX.Element | undefined;
|
||||
|
||||
if (usernameLinkCorrupted) {
|
||||
linkActions = (
|
||||
<i
|
||||
className="ProfileEditor__error-icon"
|
||||
title={i18n('icu:ProfileEditor__username-link__error-icon')}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
maybeUsernameLinkRow = (
|
||||
<PanelRow
|
||||
className="ProfileEditor__row"
|
||||
icon={
|
||||
<i className="ProfileEditor__icon--container ProfileEditor__icon ProfileEditor__icon--username-link" />
|
||||
}
|
||||
label={i18n('icu:ProfileEditor__username-link')}
|
||||
onClick={() => {
|
||||
if (usernameLinkCorrupted) {
|
||||
setIsResettingUsernameLink(true);
|
||||
return;
|
||||
}
|
||||
|
||||
setEditState(EditState.UsernameLink);
|
||||
}}
|
||||
alwaysShowActions
|
||||
actions={linkActions}
|
||||
/>
|
||||
);
|
||||
|
||||
if (!hasCompletedUsernameLinkOnboarding) {
|
||||
const tooltip = (
|
||||
<div className="ProfileEditor__username-link__tooltip__container">
|
||||
<div className="ProfileEditor__username-link__tooltip__icon" />
|
||||
|
||||
<div className="ProfileEditor__username-link__tooltip__content">
|
||||
<h3>
|
||||
{i18n('icu:ProfileEditor__username-link__tooltip__title')}
|
||||
</h3>
|
||||
<p>{i18n('icu:ProfileEditor__username-link__tooltip__body')}</p>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
className="ProfileEditor__username-link__tooltip__close"
|
||||
onClick={markCompletedUsernameLinkOnboarding}
|
||||
aria-label={i18n('icu:close')}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
maybeUsernameLinkRow = (
|
||||
<Tooltip
|
||||
className="ProfileEditor__username-link__tooltip"
|
||||
direction={TooltipPlacement.Bottom}
|
||||
sticky
|
||||
content={tooltip}
|
||||
>
|
||||
{maybeUsernameLinkRow}
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
maybeUsernameRows = (
|
||||
<>
|
||||
<hr className="ProfileEditor__divider" />
|
||||
<PanelRow
|
||||
className="ProfileEditor__row"
|
||||
icon={
|
||||
<i className="ProfileEditor__icon--container ProfileEditor__icon ProfileEditor__icon--username" />
|
||||
}
|
||||
label={
|
||||
(!usernameCorrupted && username) ||
|
||||
i18n('icu:ProfileEditor--username')
|
||||
}
|
||||
onClick={() => {
|
||||
if (usernameCorrupted) {
|
||||
setIsResettingUsername(true);
|
||||
return;
|
||||
}
|
||||
|
||||
openUsernameReservationModal();
|
||||
setEditState(EditState.Username);
|
||||
}}
|
||||
alwaysShowActions={alwaysShowActions}
|
||||
actions={actions}
|
||||
/>
|
||||
{maybeUsernameLinkRow}
|
||||
<div className="ProfileEditor__info">
|
||||
{username
|
||||
? i18n('icu:ProfileEditor--info--pnp')
|
||||
: i18n('icu:ProfileEditor--info--pnp--no-username')}
|
||||
</div>
|
||||
</>
|
||||
if (usernameEditState === UsernameEditState.Deleting) {
|
||||
actions = (
|
||||
<ConversationDetailsIcon
|
||||
ariaLabel={i18n('icu:ProfileEditor--username--deleting-username')}
|
||||
icon={IconType.spinner}
|
||||
disabled
|
||||
fakeButton
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
const menuOptions = [
|
||||
{
|
||||
group: 'copy',
|
||||
icon: 'ProfileEditor__username-menu__copy-icon',
|
||||
label: i18n('icu:ProfileEditor--username--copy'),
|
||||
onClick: () => {
|
||||
assertDev(
|
||||
username !== undefined,
|
||||
'Should not be visible without username'
|
||||
);
|
||||
void window.navigator.clipboard.writeText(username);
|
||||
showToast({ toastType: ToastType.CopiedUsername });
|
||||
},
|
||||
},
|
||||
{
|
||||
// Different group to display a divider above it
|
||||
group: 'delete',
|
||||
|
||||
icon: 'ProfileEditor__username-menu__trash-icon',
|
||||
label: i18n('icu:ProfileEditor--username--delete'),
|
||||
onClick: () => {
|
||||
setUsernameEditState(UsernameEditState.ConfirmingDelete);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
if (usernameCorrupted) {
|
||||
actions = (
|
||||
<i
|
||||
className="ProfileEditor__error-icon"
|
||||
title={i18n('icu:ProfileEditor__username__error-icon')}
|
||||
/>
|
||||
);
|
||||
alwaysShowActions = true;
|
||||
} else if (username) {
|
||||
actions = (
|
||||
<ContextMenu
|
||||
i18n={i18n}
|
||||
menuOptions={menuOptions}
|
||||
popperOptions={{ placement: 'bottom', strategy: 'absolute' }}
|
||||
moduleClassName="ProfileEditor__username-menu"
|
||||
ariaLabel={i18n('icu:ProfileEditor--username--context-menu')}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let maybeUsernameLinkRow: JSX.Element | undefined;
|
||||
if (username && !usernameCorrupted) {
|
||||
let linkActions: JSX.Element | undefined;
|
||||
|
||||
if (usernameLinkCorrupted) {
|
||||
linkActions = (
|
||||
<i
|
||||
className="ProfileEditor__error-icon"
|
||||
title={i18n('icu:ProfileEditor__username-link__error-icon')}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
maybeUsernameLinkRow = (
|
||||
<PanelRow
|
||||
className="ProfileEditor__row"
|
||||
icon={
|
||||
<i className="ProfileEditor__icon--container ProfileEditor__icon ProfileEditor__icon--username-link" />
|
||||
}
|
||||
label={i18n('icu:ProfileEditor__username-link')}
|
||||
onClick={() => {
|
||||
if (usernameLinkCorrupted) {
|
||||
setIsResettingUsernameLink(true);
|
||||
return;
|
||||
}
|
||||
|
||||
setEditState(EditState.UsernameLink);
|
||||
}}
|
||||
alwaysShowActions
|
||||
actions={linkActions}
|
||||
/>
|
||||
);
|
||||
|
||||
if (!hasCompletedUsernameLinkOnboarding) {
|
||||
const tooltip = (
|
||||
<div className="ProfileEditor__username-link__tooltip__container">
|
||||
<div className="ProfileEditor__username-link__tooltip__icon" />
|
||||
|
||||
<div className="ProfileEditor__username-link__tooltip__content">
|
||||
<h3>
|
||||
{i18n('icu:ProfileEditor__username-link__tooltip__title')}
|
||||
</h3>
|
||||
<p>{i18n('icu:ProfileEditor__username-link__tooltip__body')}</p>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
className="ProfileEditor__username-link__tooltip__close"
|
||||
onClick={markCompletedUsernameLinkOnboarding}
|
||||
aria-label={i18n('icu:close')}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
maybeUsernameLinkRow = (
|
||||
<Tooltip
|
||||
className="ProfileEditor__username-link__tooltip"
|
||||
direction={TooltipPlacement.Bottom}
|
||||
sticky
|
||||
content={tooltip}
|
||||
>
|
||||
{maybeUsernameLinkRow}
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const usernameRows = (
|
||||
<>
|
||||
<hr className="ProfileEditor__divider" />
|
||||
<PanelRow
|
||||
className="ProfileEditor__row"
|
||||
icon={
|
||||
<i className="ProfileEditor__icon--container ProfileEditor__icon ProfileEditor__icon--username" />
|
||||
}
|
||||
label={
|
||||
(!usernameCorrupted && username) ||
|
||||
i18n('icu:ProfileEditor--username')
|
||||
}
|
||||
onClick={() => {
|
||||
if (usernameCorrupted) {
|
||||
setIsResettingUsername(true);
|
||||
return;
|
||||
}
|
||||
|
||||
openUsernameReservationModal();
|
||||
setEditState(EditState.Username);
|
||||
}}
|
||||
alwaysShowActions={alwaysShowActions}
|
||||
actions={actions}
|
||||
/>
|
||||
{maybeUsernameLinkRow}
|
||||
<div className="ProfileEditor__info">
|
||||
{username
|
||||
? i18n('icu:ProfileEditor--info--pnp')
|
||||
: i18n('icu:ProfileEditor--info--pnp--no-username')}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
content = (
|
||||
<>
|
||||
<AvatarPreview
|
||||
|
@ -771,7 +766,7 @@ export function ProfileEditor({
|
|||
<div className="ProfileEditor__info">
|
||||
{i18n('icu:ProfileEditor--info--general')}
|
||||
</div>
|
||||
{maybeUsernameRows}
|
||||
{usernameRows}
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -70,7 +70,6 @@ const createProps = (
|
|||
i18n={i18n}
|
||||
lookupConversationWithoutServiceId={lookupConversationWithoutServiceId}
|
||||
showUserNotFoundModal={action('showUserNotFoundModal')}
|
||||
isUsernamesEnabled
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
|
|
@ -65,7 +65,6 @@ export type StatePropsType = {
|
|||
removeSelectedContact: (_: string) => void;
|
||||
setSearchTerm: (_: string) => void;
|
||||
toggleSelectedContact: (conversationId: string) => void;
|
||||
isUsernamesEnabled: boolean;
|
||||
} & Pick<
|
||||
LookupConversationWithoutServiceIdActionsType,
|
||||
'lookupConversationWithoutServiceId'
|
||||
|
@ -97,29 +96,22 @@ export function ChooseGroupMembersModal({
|
|||
toggleSelectedContact,
|
||||
lookupConversationWithoutServiceId,
|
||||
showUserNotFoundModal,
|
||||
isUsernamesEnabled,
|
||||
}: PropsType): JSX.Element {
|
||||
const [focusRef] = useRestoreFocus();
|
||||
|
||||
const parsedUsername = getUsernameFromSearch(searchTerm);
|
||||
let username: string | undefined;
|
||||
let isUsernameChecked = false;
|
||||
let isUsernameVisible = false;
|
||||
if (isUsernamesEnabled) {
|
||||
username = parsedUsername;
|
||||
const username = getUsernameFromSearch(searchTerm);
|
||||
|
||||
isUsernameChecked = selectedContacts.some(
|
||||
contact => contact.username === username
|
||||
);
|
||||
const isUsernameChecked = selectedContacts.some(
|
||||
contact => contact.username === username
|
||||
);
|
||||
|
||||
isUsernameVisible =
|
||||
Boolean(username) &&
|
||||
username !== ourUsername &&
|
||||
candidateContacts.every(contact => contact.username !== username);
|
||||
}
|
||||
const isUsernameVisible =
|
||||
Boolean(username) &&
|
||||
username !== ourUsername &&
|
||||
candidateContacts.every(contact => contact.username !== username);
|
||||
|
||||
let phoneNumber: ParsedE164Type | undefined;
|
||||
if (!parsedUsername) {
|
||||
if (!username) {
|
||||
phoneNumber = parseAndFormatPhoneNumber(searchTerm, regionCode);
|
||||
}
|
||||
|
||||
|
|
|
@ -126,7 +126,6 @@ const createProps = (
|
|||
ourE164={undefined}
|
||||
ourUsername={undefined}
|
||||
showUserNotFoundModal={action('showUserNotFoundModal')}
|
||||
isUsernamesEnabled
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
|
|
@ -34,7 +34,6 @@ export type LeftPaneChooseGroupMembersPropsType = {
|
|||
groupSizeHardLimit: number;
|
||||
isShowingRecommendedGroupSizeModal: boolean;
|
||||
isShowingMaximumGroupSizeModal: boolean;
|
||||
isUsernamesEnabled: boolean;
|
||||
ourE164: string | undefined;
|
||||
ourUsername: string | undefined;
|
||||
searchTerm: string;
|
||||
|
@ -73,7 +72,6 @@ export class LeftPaneChooseGroupMembersHelper extends LeftPaneHelper<LeftPaneCho
|
|||
candidateContacts,
|
||||
isShowingMaximumGroupSizeModal,
|
||||
isShowingRecommendedGroupSizeModal,
|
||||
isUsernamesEnabled,
|
||||
groupSizeRecommendedLimit,
|
||||
groupSizeHardLimit,
|
||||
ourE164,
|
||||
|
@ -101,18 +99,14 @@ export class LeftPaneChooseGroupMembersHelper extends LeftPaneHelper<LeftPaneCho
|
|||
username !== ourUsername &&
|
||||
this.candidateContacts.every(contact => contact.username !== username);
|
||||
|
||||
if (isUsernamesEnabled) {
|
||||
if (isUsernameVisible) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
this.isUsernameChecked = selectedContacts.some(
|
||||
contact => contact.username === this.username
|
||||
);
|
||||
} else {
|
||||
this.isUsernameChecked = false;
|
||||
if (isUsernameVisible) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
this.isUsernameChecked = selectedContacts.some(
|
||||
contact => contact.username === this.username
|
||||
);
|
||||
|
||||
const phoneNumber = parseAndFormatPhoneNumber(searchTerm, regionCode);
|
||||
if (
|
||||
!isUsernameVisible &&
|
||||
|
|
|
@ -28,7 +28,6 @@ export type LeftPaneComposePropsType = {
|
|||
regionCode: string | undefined;
|
||||
searchTerm: string;
|
||||
uuidFetchState: UUIDFetchStateType;
|
||||
isUsernamesEnabled: boolean;
|
||||
};
|
||||
|
||||
enum TopButton {
|
||||
|
@ -58,7 +57,6 @@ export class LeftPaneComposeHelper extends LeftPaneHelper<LeftPaneComposePropsTy
|
|||
composeGroups,
|
||||
regionCode,
|
||||
searchTerm,
|
||||
isUsernamesEnabled,
|
||||
uuidFetchState,
|
||||
}: Readonly<LeftPaneComposePropsType>) {
|
||||
super();
|
||||
|
@ -70,15 +68,10 @@ export class LeftPaneComposeHelper extends LeftPaneHelper<LeftPaneComposePropsTy
|
|||
|
||||
const username = getUsernameFromSearch(this.searchTerm);
|
||||
|
||||
if (isUsernamesEnabled) {
|
||||
this.username = username;
|
||||
this.isUsernameVisible =
|
||||
isUsernamesEnabled &&
|
||||
Boolean(username) &&
|
||||
this.composeContacts.every(contact => contact.username !== username);
|
||||
} else {
|
||||
this.isUsernameVisible = false;
|
||||
}
|
||||
this.username = username;
|
||||
this.isUsernameVisible =
|
||||
Boolean(username) &&
|
||||
this.composeContacts.every(contact => contact.username !== username);
|
||||
|
||||
const phoneNumber = parseAndFormatPhoneNumber(searchTerm, regionCode);
|
||||
if (!username && phoneNumber) {
|
||||
|
|
|
@ -63,7 +63,6 @@ export class SettingsChannel extends EventEmitter {
|
|||
this.installCallback('getAvailableIODevices');
|
||||
this.installCallback('isPrimary');
|
||||
this.installCallback('syncRequest');
|
||||
this.installCallback('isPhoneNumberSharingEnabled');
|
||||
|
||||
// Getters only. These are set by the primary device
|
||||
this.installSetting('blockedCount', { setter: false });
|
||||
|
|
|
@ -73,12 +73,6 @@ export const getServerTimeSkew = createSelector(
|
|||
(state: ItemsStateType): number => state.serverTimeSkew || 0
|
||||
);
|
||||
|
||||
export const getUsernamesEnabled = createSelector(
|
||||
getRemoteConfig,
|
||||
(remoteConfig: ConfigMapType): boolean =>
|
||||
isRemoteConfigFlagEnabled(remoteConfig, 'desktop.usernames')
|
||||
);
|
||||
|
||||
export const getHasCompletedUsernameOnboarding = createSelector(
|
||||
getItems,
|
||||
(state: ItemsStateType): boolean =>
|
||||
|
|
|
@ -12,7 +12,6 @@ import type { StatePropsType } from '../../components/conversation/conversation-
|
|||
import { ChooseGroupMembersModal } from '../../components/conversation/conversation-details/AddGroupMembersModal/ChooseGroupMembersModal';
|
||||
|
||||
import { getIntl, getTheme, getRegionCode } from '../selectors/user';
|
||||
import { getUsernamesEnabled } from '../selectors/items';
|
||||
import {
|
||||
getCandidateContactsForNewGroup,
|
||||
getConversationByIdSelector,
|
||||
|
@ -59,7 +58,6 @@ const mapStateToProps = (
|
|||
ourUsername: getMe(state).username,
|
||||
selectedContacts,
|
||||
lookupConversationWithoutServiceId,
|
||||
isUsernamesEnabled: getUsernamesEnabled(state),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ import { getPreferredBadgeSelector } from '../selectors/badges';
|
|||
import { hasNetworkDialog } from '../selectors/network';
|
||||
import {
|
||||
getPreferredLeftPaneWidth,
|
||||
getUsernamesEnabled,
|
||||
getUsernameCorrupted,
|
||||
getUsernameLinkCorrupted,
|
||||
getNavTabsCollapsed,
|
||||
|
@ -178,7 +177,6 @@ const getModeSpecificProps = (
|
|||
composeGroups: getFilteredComposeGroups(state),
|
||||
regionCode: getRegionCode(state),
|
||||
searchTerm: getComposerConversationSearchTerm(state),
|
||||
isUsernamesEnabled: getUsernamesEnabled(state),
|
||||
uuidFetchState: getComposerUUIDFetchState(state),
|
||||
};
|
||||
case ComposerStep.ChooseGroupMembers:
|
||||
|
@ -197,7 +195,6 @@ const getModeSpecificProps = (
|
|||
regionCode: getRegionCode(state),
|
||||
searchTerm: getComposerConversationSearchTerm(state),
|
||||
selectedContacts: getComposeSelectedContacts(state),
|
||||
isUsernamesEnabled: getUsernamesEnabled(state),
|
||||
uuidFetchState: getComposerUUIDFetchState(state),
|
||||
};
|
||||
case ComposerStep.SetGroupMetadata:
|
||||
|
|
|
@ -13,7 +13,6 @@ import type { StateType } from '../reducer';
|
|||
import { getIntl } from '../selectors/user';
|
||||
import {
|
||||
getEmojiSkinTone,
|
||||
getUsernamesEnabled,
|
||||
getHasCompletedUsernameLinkOnboarding,
|
||||
getUsernameCorrupted,
|
||||
getUsernameLinkColor,
|
||||
|
@ -52,7 +51,6 @@ function mapStateToProps(
|
|||
} = getMe(state);
|
||||
const recentEmojis = selectRecentEmojis(state);
|
||||
const skinTone = getEmojiSkinTone(state);
|
||||
const isUsernameFlagEnabled = getUsernamesEnabled(state);
|
||||
const hasCompletedUsernameLinkOnboarding =
|
||||
getHasCompletedUsernameLinkOnboarding(state);
|
||||
const usernameEditState = getUsernameEditState(state);
|
||||
|
@ -75,7 +73,6 @@ function mapStateToProps(
|
|||
hasError: state.globalModals.profileEditorHasError,
|
||||
initialEditState: state.globalModals.profileEditorInitialEditState,
|
||||
i18n: getIntl(state),
|
||||
isUsernameFlagEnabled,
|
||||
recentEmojis,
|
||||
skinTone,
|
||||
userAvatarData,
|
||||
|
|
|
@ -25,10 +25,7 @@ import type { ConversationsStateType } from '../ducks/conversations';
|
|||
import { useToastActions } from '../ducks/toast';
|
||||
import { useGlobalModalActions } from '../ducks/globalModals';
|
||||
import { NavTab } from '../ducks/nav';
|
||||
import {
|
||||
getUsernamesEnabled,
|
||||
getHasCompletedUsernameOnboarding,
|
||||
} from '../selectors/items';
|
||||
import { getHasCompletedUsernameOnboarding } from '../selectors/items';
|
||||
import { ToastManager } from '../../components/ToastManager';
|
||||
import type { WidthBreakpoint } from '../../components/_util';
|
||||
|
||||
|
@ -42,7 +39,6 @@ export function SmartToastManager({
|
|||
containerWidthBreakpoint,
|
||||
}: SmartPropsType): JSX.Element {
|
||||
const i18n = useSelector(getIntl);
|
||||
const isUsernameFlagEnabled = useSelector(getUsernamesEnabled);
|
||||
const hasCompletedUsernameOnboarding = useSelector(
|
||||
getHasCompletedUsernameOnboarding
|
||||
);
|
||||
|
@ -69,7 +65,6 @@ export function SmartToastManager({
|
|||
let megaphone: AnyActionableMegaphone | undefined;
|
||||
|
||||
if (
|
||||
isUsernameFlagEnabled &&
|
||||
!hasCompletedUsernameOnboarding &&
|
||||
!username &&
|
||||
globalModals.usernameOnboardingState === UsernameOnboardingState.NeverShown
|
||||
|
|
|
@ -14,12 +14,12 @@ describe('RemoteConfig', () => {
|
|||
const aci = normalizeAci('95b9729c-51ea-4ddb-b516-652befe78062', 'test');
|
||||
|
||||
describe('#innerIsBucketValueEnabled', () => {
|
||||
// Note: bucketValue is 627610 for 'desktop.pnp' key
|
||||
// Note: bucketValue is 376321 for 'desktop.internalUser' key
|
||||
|
||||
it('returns true for 100% wildcard', () => {
|
||||
assert.strictEqual(
|
||||
innerIsBucketValueEnabled(
|
||||
'desktop.pnp',
|
||||
'desktop.internalUser',
|
||||
'*:1000000',
|
||||
'+12125550000',
|
||||
aci
|
||||
|
@ -31,7 +31,7 @@ describe('RemoteConfig', () => {
|
|||
it('returns true for 70% on country code 1', () => {
|
||||
assert.strictEqual(
|
||||
innerIsBucketValueEnabled(
|
||||
'desktop.pnp',
|
||||
'desktop.internalUser',
|
||||
'1:700000',
|
||||
'+12125550000',
|
||||
aci
|
||||
|
@ -40,11 +40,11 @@ describe('RemoteConfig', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('returns false for 50% on country code 1', () => {
|
||||
it('returns false for 30% on country code 1', () => {
|
||||
assert.strictEqual(
|
||||
innerIsBucketValueEnabled(
|
||||
'desktop.pnp',
|
||||
'1:500000',
|
||||
'desktop.internalUser',
|
||||
'1:300000',
|
||||
'+12125550000',
|
||||
aci
|
||||
),
|
||||
|
|
|
@ -8,7 +8,6 @@ import {
|
|||
getPinnedConversationIds,
|
||||
getPreferredLeftPaneWidth,
|
||||
getPreferredReactionEmoji,
|
||||
getUsernamesEnabled,
|
||||
} from '../../../state/selectors/items';
|
||||
import type { StateType } from '../../../state/reducer';
|
||||
import type { ItemsStateType } from '../../../state/ducks/items';
|
||||
|
@ -145,36 +144,4 @@ describe('both/state/selectors/items', () => {
|
|||
assert.deepStrictEqual(actual, preferredReactionEmoji);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getUsernamesEnabled', () => {
|
||||
it('returns false if the flag is missing or disabled', () => {
|
||||
[
|
||||
{},
|
||||
{ remoteConfig: {} },
|
||||
{
|
||||
remoteConfig: {
|
||||
'desktop.usernames': {
|
||||
name: 'desktop.usernames' as const,
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
].forEach(itemsState => {
|
||||
const state = getRootState(itemsState);
|
||||
assert.isFalse(getUsernamesEnabled(state));
|
||||
});
|
||||
});
|
||||
|
||||
it('returns true if the flag is enabled', () => {
|
||||
const state = getRootState({
|
||||
remoteConfig: {
|
||||
'desktop.usernames': {
|
||||
name: 'desktop.usernames' as const,
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
assert.isTrue(getUsernamesEnabled(state));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,7 +16,6 @@ describe('LeftPaneChooseGroupMembersHelper', () => {
|
|||
candidateContacts: [],
|
||||
isShowingRecommendedGroupSizeModal: false,
|
||||
isShowingMaximumGroupSizeModal: false,
|
||||
isUsernamesEnabled: true,
|
||||
ourE164: undefined,
|
||||
ourUsername: undefined,
|
||||
groupSizeRecommendedLimit: 22,
|
||||
|
@ -55,7 +54,6 @@ describe('LeftPaneChooseGroupMembersHelper', () => {
|
|||
candidateContacts: [],
|
||||
searchTerm: 'foo bar',
|
||||
selectedContacts: [getDefaultConversation()],
|
||||
isUsernamesEnabled: false,
|
||||
}).getRowCount(),
|
||||
0
|
||||
);
|
||||
|
@ -101,7 +99,6 @@ describe('LeftPaneChooseGroupMembersHelper', () => {
|
|||
candidateContacts: [],
|
||||
searchTerm: 'foo bar',
|
||||
selectedContacts: [getDefaultConversation()],
|
||||
isUsernamesEnabled: false,
|
||||
}).getRow(0)
|
||||
);
|
||||
});
|
||||
|
@ -115,7 +112,6 @@ describe('LeftPaneChooseGroupMembersHelper', () => {
|
|||
...defaults,
|
||||
candidateContacts,
|
||||
searchTerm: 'foo bar',
|
||||
isUsernamesEnabled: false,
|
||||
selectedContacts: [candidateContacts[1]],
|
||||
});
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: '',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
});
|
||||
|
||||
|
@ -47,7 +46,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: '',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
}).getRowCount(),
|
||||
1
|
||||
|
@ -61,7 +59,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: '',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
}).getRowCount(),
|
||||
4
|
||||
|
@ -75,7 +72,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [getDefaultGroupListItem(), getDefaultGroupListItem()],
|
||||
regionCode: 'US',
|
||||
searchTerm: '',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
}).getRowCount(),
|
||||
7
|
||||
|
@ -89,27 +85,12 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [getDefaultGroupListItem(), getDefaultGroupListItem()],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'someone.01',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
}).getRowCount(),
|
||||
8
|
||||
);
|
||||
});
|
||||
|
||||
it('if usernames are disabled, two less rows are shown', () => {
|
||||
assert.strictEqual(
|
||||
new LeftPaneComposeHelper({
|
||||
composeContacts: [getDefaultConversation(), getDefaultConversation()],
|
||||
composeGroups: [getDefaultGroupListItem(), getDefaultGroupListItem()],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'someone.54321',
|
||||
isUsernamesEnabled: false,
|
||||
uuidFetchState: {},
|
||||
}).getRowCount(),
|
||||
6
|
||||
);
|
||||
});
|
||||
|
||||
it('returns the number of conversations + the headers, but not for a phone number', () => {
|
||||
assert.strictEqual(
|
||||
new LeftPaneComposeHelper({
|
||||
|
@ -117,7 +98,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'foobar.01',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
}).getRowCount(),
|
||||
2
|
||||
|
@ -128,7 +108,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'foobar.01',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
}).getRowCount(),
|
||||
5
|
||||
|
@ -139,7 +118,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [getDefaultGroupListItem()],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'foobar.01',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
}).getRowCount(),
|
||||
7
|
||||
|
@ -153,7 +131,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: '+16505551234',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
}).getRowCount(),
|
||||
2
|
||||
|
@ -167,7 +144,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'someone.02',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
}).getRowCount(),
|
||||
2
|
||||
|
@ -181,7 +157,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: '+16505551234',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
}).getRowCount(),
|
||||
5
|
||||
|
@ -196,7 +171,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: '',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
});
|
||||
|
||||
|
@ -216,7 +190,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: '',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
});
|
||||
|
||||
|
@ -250,7 +223,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups,
|
||||
regionCode: 'US',
|
||||
searchTerm: '',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
});
|
||||
|
||||
|
@ -279,20 +251,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('returns no rows if searching, no results, and usernames are disabled', () => {
|
||||
const helper = new LeftPaneComposeHelper({
|
||||
composeContacts: [],
|
||||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'foo bar',
|
||||
isUsernamesEnabled: false,
|
||||
uuidFetchState: {},
|
||||
});
|
||||
|
||||
assert.isUndefined(helper.getRow(0));
|
||||
assert.isUndefined(helper.getRow(1));
|
||||
});
|
||||
|
||||
it('returns one row per contact if searching', () => {
|
||||
const composeContacts = [
|
||||
getDefaultConversation(),
|
||||
|
@ -303,7 +261,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'foo bar',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
});
|
||||
|
||||
|
@ -325,7 +282,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: '+1(650) 555 12 34',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
});
|
||||
|
||||
|
@ -353,7 +309,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: username,
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {
|
||||
[`username:${username}`]: true,
|
||||
},
|
||||
|
@ -381,7 +336,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: '+1(650) 555 12 34',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
});
|
||||
|
||||
|
@ -419,7 +373,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'foo bar',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
});
|
||||
|
||||
|
@ -434,7 +387,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'foo bar',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
});
|
||||
|
||||
|
@ -455,7 +407,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'foo bar',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
});
|
||||
|
||||
|
@ -465,7 +416,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'different search',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
})
|
||||
);
|
||||
|
@ -475,7 +425,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'last search',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
})
|
||||
);
|
||||
|
@ -487,7 +436,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: '',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
});
|
||||
|
||||
|
@ -497,7 +445,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: '',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
})
|
||||
);
|
||||
|
@ -509,7 +456,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'foo bar',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
});
|
||||
|
||||
|
@ -519,7 +465,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: '',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
})
|
||||
);
|
||||
|
@ -529,7 +474,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: '+16505551234',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
})
|
||||
);
|
||||
|
@ -541,7 +485,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: '',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
});
|
||||
|
||||
|
@ -551,7 +494,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'foo bar',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
})
|
||||
);
|
||||
|
@ -563,7 +505,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'foo bar',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
});
|
||||
|
||||
|
@ -573,7 +514,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [getDefaultGroupListItem(), getDefaultGroupListItem()],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'foo bar',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
})
|
||||
);
|
||||
|
@ -583,7 +523,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [getDefaultGroupListItem(), getDefaultGroupListItem()],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'foo bar',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
});
|
||||
|
||||
|
@ -593,7 +532,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'foo bar',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
})
|
||||
);
|
||||
|
@ -605,7 +543,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [getDefaultGroupListItem()],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'soup',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
});
|
||||
|
||||
|
@ -615,7 +552,6 @@ describe('LeftPaneComposeHelper', () => {
|
|||
composeGroups: [getDefaultGroupListItem(), getDefaultGroupListItem()],
|
||||
regionCode: 'US',
|
||||
searchTerm: 'soup',
|
||||
isUsernamesEnabled: true,
|
||||
uuidFetchState: {},
|
||||
})
|
||||
);
|
||||
|
|
|
@ -33,7 +33,6 @@ import { PhoneNumberSharingMode } from './phoneNumberSharingMode';
|
|||
import { strictAssert, assertDev } from './assert';
|
||||
import * as durations from './durations';
|
||||
import type { DurationInSeconds } from './durations';
|
||||
import { isPhoneNumberSharingEnabled } from './isPhoneNumberSharingEnabled';
|
||||
import * as Registration from './registration';
|
||||
import { lookupConversationWithoutServiceId } from './lookupConversationWithoutServiceId';
|
||||
import * as log from '../logging/log';
|
||||
|
@ -114,7 +113,6 @@ export type IPCEventsCallbacksType = {
|
|||
mediaType: 'screen' | 'microphone' | 'camera'
|
||||
) => Promise<string | unknown>;
|
||||
installStickerPack: (packId: string, key: string) => Promise<void>;
|
||||
isPhoneNumberSharingEnabled: () => boolean;
|
||||
isPrimary: () => boolean;
|
||||
removeCustomColor: (x: string) => void;
|
||||
removeCustomColorOnConversations: (x: string) => void;
|
||||
|
@ -461,7 +459,6 @@ export function createIPCEvents(
|
|||
return window.IPC.setAutoLaunch(value);
|
||||
},
|
||||
|
||||
isPhoneNumberSharingEnabled: () => isPhoneNumberSharingEnabled(),
|
||||
isPrimary: () => window.textsecure.storage.user.getDeviceId() === 1,
|
||||
syncRequest: () =>
|
||||
new Promise<void>((resolve, reject) => {
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import * as RemoteConfig from '../RemoteConfig';
|
||||
|
||||
export function isPhoneNumberSharingEnabled(): boolean {
|
||||
return Boolean(
|
||||
RemoteConfig.isEnabled('desktop.internalUser') ||
|
||||
RemoteConfig.isEnabled('desktop.pnp')
|
||||
);
|
||||
}
|
|
@ -30,7 +30,6 @@ installSetting('typingIndicatorSetting', {
|
|||
});
|
||||
|
||||
installCallback('deleteAllMyStories');
|
||||
installCallback('isPhoneNumberSharingEnabled');
|
||||
installCallback('isPrimary');
|
||||
installCallback('syncRequest');
|
||||
|
||||
|
|
|
@ -62,7 +62,6 @@ SettingsWindowProps.onRender(
|
|||
isHideMenuBarSupported,
|
||||
isMinimizeToAndStartInSystemTraySupported,
|
||||
isNotificationAttentionSupported,
|
||||
isPhoneNumberSharingSupported,
|
||||
isSyncSupported,
|
||||
isSystemTraySupported,
|
||||
lastSyncTime,
|
||||
|
@ -167,7 +166,6 @@ SettingsWindowProps.onRender(
|
|||
isMinimizeToAndStartInSystemTraySupported
|
||||
}
|
||||
isNotificationAttentionSupported={isNotificationAttentionSupported}
|
||||
isPhoneNumberSharingSupported={isPhoneNumberSharingSupported}
|
||||
isSyncSupported={isSyncSupported}
|
||||
isSystemTraySupported={isSystemTraySupported}
|
||||
lastSyncTime={lastSyncTime}
|
||||
|
|
|
@ -83,7 +83,6 @@ const ipcGetAvailableIODevices = createCallback('getAvailableIODevices');
|
|||
const ipcGetCustomColors = createCallback('getCustomColors');
|
||||
const ipcIsSyncNotSupported = createCallback('isPrimary');
|
||||
const ipcMakeSyncRequest = createCallback('syncRequest');
|
||||
const ipcPNP = createCallback('isPhoneNumberSharingEnabled');
|
||||
const ipcDeleteAllMyStories = createCallback('deleteAllMyStories');
|
||||
|
||||
// ChatColorPicker redux hookups
|
||||
|
@ -161,7 +160,6 @@ async function renderPreferences() {
|
|||
hasStoriesDisabled,
|
||||
hasTextFormatting,
|
||||
hasTypingIndicators,
|
||||
isPhoneNumberSharingSupported,
|
||||
lastSyncTime,
|
||||
notificationContent,
|
||||
phoneNumber,
|
||||
|
@ -204,7 +202,6 @@ async function renderPreferences() {
|
|||
hasStoriesDisabled: settingHasStoriesDisabled.getValue(),
|
||||
hasTextFormatting: settingTextFormatting.getValue(),
|
||||
hasTypingIndicators: settingTypingIndicators.getValue(),
|
||||
isPhoneNumberSharingSupported: ipcPNP(),
|
||||
lastSyncTime: settingLastSyncTime.getValue(),
|
||||
notificationContent: settingNotificationSetting.getValue(),
|
||||
phoneNumber: settingPhoneNumber.getValue(),
|
||||
|
@ -312,7 +309,6 @@ async function renderPreferences() {
|
|||
isAutoLaunchSupported: Settings.isAutoLaunchSupported(OS),
|
||||
isHideMenuBarSupported: Settings.isHideMenuBarSupported(OS),
|
||||
isNotificationAttentionSupported: Settings.isDrawAttentionSupported(OS),
|
||||
isPhoneNumberSharingSupported,
|
||||
isSyncSupported: !isSyncNotSupported,
|
||||
isSystemTraySupported: Settings.isSystemTraySupported(
|
||||
OS,
|
||||
|
|
Loading…
Reference in a new issue