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