diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 1c491fe3c97d..83ff26e1f661 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -6078,6 +6078,14 @@ "messageformat": "Nobody", "description": "Option for letting nobody discover you by phone number" }, + "icu:Preferences__pnp__discoverability__nobody__confirmModal__title": { + "messageformat": "Are you sure?", + "description": "Title for the confirmation modal when turning the phone number discoverability setting to nobody" + }, + "icu:Preferences__pnp__discoverability__nobody__confirmModal__description": { + "messageformat": "If you change “{settingTitle}” to “{nobodyLabel}” it will make it harder for people to find you on Signal.", + "description": "Description for the confirmation modal when turning the phone number discoverability setting to nobody" + }, "icu:Preferences--messaging": { "messageformat": "Messaging", "description": "Title for the messaging settings" diff --git a/ts/components/Preferences.tsx b/ts/components/Preferences.tsx index f859d43ba308..4bc28b982930 100644 --- a/ts/components/Preferences.tsx +++ b/ts/components/Preferences.tsx @@ -363,6 +363,8 @@ export function Preferences({ >(localeOverride); const [languageSearchInput, setLanguageSearchInput] = useState(''); const [toast, setToast] = useState(); + const [confirmPnpNotDiscoverable, setConfirmPnpNoDiscoverable] = + useState(false); function closeLanguageDialog() { setLanguageDialog(null); @@ -1484,7 +1486,13 @@ export function Preferences({ title={i18n('icu:Preferences__pnp__discoverability--title')} > { + if (value === PhoneNumberDiscoverability.NotDiscoverable) { + setConfirmPnpNoDiscoverable(true); + } else { + onWhoCanFindMeChange(value); + } + }} options={[ { text: i18n('icu:Preferences__pnp__discoverability__everyone'), @@ -1515,6 +1523,43 @@ export function Preferences({ + {confirmPnpNotDiscoverable && ( + { + setConfirmPnpNoDiscoverable(false); + }} + actions={[ + { + action: () => + onWhoCanFindMeChange( + PhoneNumberDiscoverability.NotDiscoverable + ), + style: 'affirmative', + text: i18n('icu:ok'), + }, + ]} + > + {i18n( + 'icu:Preferences__pnp__discoverability__nobody__confirmModal__description', + { + // This is a rare instance where we want to interpolate the exact + // text of the string into quotes in the translation as an + // explanation. + settingTitle: i18n( + 'icu:Preferences__pnp__discoverability--title' + ), + nobodyLabel: i18n( + 'icu:Preferences__pnp__discoverability__nobody' + ), + } + )} + + )} ); }